diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..e88a8a8c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +# Docker COPY does not honor .gitignore, so exclude host build artifacts and bulk here. +# Keeping the context lean also avoids baking a stale local bin/ build into the image. +.git +bin/ +*.sif +*.o +temp_dac/ +testRun/ +.idea/ +cmake-build-debug/ +rufus_figure.pdf +rufus_figure.png +rufus_figure.py +rufus_figure.pdf +src/externals/jellyfish-2.2.5/ +src/externals/gkno_launcher/ diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml new file mode 100644 index 00000000..9d0ab756 --- /dev/null +++ b/.github/workflows/build-publish.yml @@ -0,0 +1,121 @@ +name: build-publish + +# Tag mapping: +# push to docker / dev -> stefinfection/rufus:dev (development) +# push to main -> stefinfection/rufus:stage (staging) +# push git tag v* -> stefinfection/rufus: + :latest, then SIF -> Zenodo (prod) +on: + push: + branches: [docker, dev, main] + tags: ['v*'] + workflow_dispatch: + +env: + IMAGE: stefinfection/rufus + +jobs: + build: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.meta.outputs.version }} + primary_tag: ${{ steps.meta.outputs.primary_tag }} + # Records a deployment to the matching GitHub Environment, giving a glanceable dev/stage/prod + # dashboard. The name is derived from the git ref (must be known at job start, so it uses the + # github context, not a step output). Arm the release gate by adding a required reviewer to the + # `production` environment in the repo settings — a v* tag build then waits for approval here. + environment: + name: ${{ startsWith(github.ref, 'refs/tags/v') && 'production' || github.ref == 'refs/heads/main' && 'staging' || 'development' }} + url: https://hub.docker.com/r/stefinfection/rufus/tags + steps: + - uses: actions/checkout@v5 + with: + submodules: recursive # src/modifiedJellyfish is a submodule the image build needs + + - name: Resolve version and image tags + id: meta + run: | + # RUFUS_VERSION lives in resources/globals.txt as RUFUS_VERSION="vX.Y.Z" + VERSION=$(grep -E '^RUFUS_VERSION=' resources/globals.txt | cut -d'"' -f2) + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + + REF="${GITHUB_REF}" + if [[ "${REF}" == refs/tags/v* ]]; then + TAGNAME="${REF#refs/tags/}" + # Release guard: a prod tag must match RUFUS_VERSION in globals.txt, so the git tag, + # the image tag, the OCI version label, the runtime banner, and the Zenodo version + # can never disagree. Fail the release rather than publish an inconsistent one. + if [[ "${TAGNAME}" != "${VERSION}" ]]; then + echo "::error::Release tag '${TAGNAME}' does not match RUFUS_VERSION '${VERSION}' in resources/globals.txt. Bump globals.txt (and commit) before tagging, or retag to match." >&2 + exit 1 + fi + echo "tags=${IMAGE}:${TAGNAME},${IMAGE}:latest" >> "$GITHUB_OUTPUT" + echo "primary_tag=${TAGNAME}" >> "$GITHUB_OUTPUT" + echo "is_release=true" >> "$GITHUB_OUTPUT" + elif [[ "${REF}" == refs/heads/main ]]; then + echo "tags=${IMAGE}:stage" >> "$GITHUB_OUTPUT" + echo "primary_tag=stage" >> "$GITHUB_OUTPUT" + echo "is_release=false" >> "$GITHUB_OUTPUT" + else + echo "tags=${IMAGE}:dev" >> "$GITHUB_OUTPUT" + echo "primary_tag=dev" >> "$GITHUB_OUTPUT" + echo "is_release=false" >> "$GITHUB_OUTPUT" + fi + + # Runs on every build, not just releases, so drift is caught on a dev push to + # `docker` rather than at the moment of tagging. Fix with: --write + - name: Check doc version strings match globals.txt + run: bash scripts/ci/check_doc_versions.sh + + - uses: docker/setup-buildx-action@v4 + + # Build locally first (load into the runner's docker) so the smoke test can gate the push. + - name: Build image + uses: docker/build-push-action@v7 + with: + context: . + load: true + tags: ${{ env.IMAGE }}:ci-${{ github.sha }} + build-args: | + RUFUS_VERSION=${{ steps.meta.outputs.version }} + + - name: Smoke test + run: docker run --rm ${{ env.IMAGE }}:ci-${{ github.sha }} bash /opt/RUFUS/tests/smoke_test.sh + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # Re-tag the validated image and push. (The smoke test already ran on this exact build.) + - name: Tag and push + run: | + IFS=',' read -ra TAGS <<< "${{ steps.meta.outputs.tags }}" + for t in "${TAGS[@]}"; do + docker tag "${IMAGE}:ci-${{ github.sha }}" "$t" + docker push "$t" + done + + release: + needs: build + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Install apptainer + uses: eWaterCycle/setup-apptainer@v2 + + - name: Build SIF from the published image + run: | + apptainer build "rufus_${{ needs.build.outputs.primary_tag }}.sif" \ + "docker://${IMAGE}:${{ needs.build.outputs.primary_tag }}" + + - name: Upload new version to Zenodo + env: + ZENODO_TOKEN: ${{ secrets.ZENODO_TOKEN }} + ZENODO_CONCEPT_RECORD_ID: ${{ secrets.ZENODO_CONCEPT_RECORD_ID }} + run: | + bash scripts/ci/zenodo_upload.sh \ + "rufus_${{ needs.build.outputs.primary_tag }}.sif" \ + "${{ needs.build.outputs.primary_tag }}" diff --git a/.gitignore b/.gitignore index b52fdad4..b23fc9fb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,20 @@ src/externals/jellyfish-2.2.5/ src/externals/gkno_launcher/ cloud/1000G.RUFUSreference.sorted.min45.tab *.o -*test* -idea/ -idea/* +# Note: a blanket `*test*` rule used to live here. It silently dropped tracked files whose +# path contained "test" (our tests/ suite, and modified-jellyfish's tests/ dir), so it was +# removed. Add narrow, specific ignores here if test scratch output needs excluding. +# SLURM writes job logs beside the case scripts when you sbatch from tests/functional/cases/. +# Deliberately path-scoped and extension-scoped -- do NOT broaden these to `*test*` or `*.out`. +tests/functional/cases/*.out +tests/functional/cases/*.err +.idea/ +.idea/* +cmake-build-debug/* +cmake-build-debug/ +singularity/rufus_v1.0.0-epsilon.sif +temp_dac/ +cleanup.sh +rufus_figure.pdf +rufus_figure.py +rufus_figure.png diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..8aacb72c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src/modifiedJellyfish"] + path = src/modifiedJellyfish + url = https://github.com/stefinfection/modified-jellyfish.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d7a2c1dc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,102 @@ +# RUFUS — canonical container definition (single source of truth). +# SIFs are built from this image via `apptainer pull/build docker://...`; there is no separate .def file. +FROM ubuntu:22.04 + +# Build-time version, passed by CI from resources/globals.txt (defaults to "dev" for local builds). +ARG RUFUS_VERSION=dev + +LABEL author="Stephanie Georges" +LABEL org.opencontainers.image.title="RUFUS" +LABEL org.opencontainers.image.version="${RUFUS_VERSION}" +LABEL org.opencontainers.image.source="https://github.com/stefinfection/RUFUS" + +ENV DEBIAN_FRONTEND=noninteractive + +# Pinned external tool versions (last reviewed Jan 2025). +ARG HTSLIB_VERSION="1.21" +ARG BAMTOOLS_VERSION="v2.5.2" +ARG BEDTOOLS_VERSION="2.31.1" + +# System + build dependencies. Most of these (parallel, gawk, vt, bc, libgsl, the lib*-dev +# packages) are required at RUNTIME by runRufus.sh and the samtools/bcftools stack, so this +# stays a single stage rather than a slimmed multi-stage build. +# Note: the historical Dockerfiles added ppa:ubuntu-toolchain-r/test but never installed a +# newer g++ from it -- the default ubuntu 22.04 g++ 11 builds RUFUS. The PPA was vestigial and +# (under --no-install-recommends) broke the build on a missing gnupg, so it is dropped. +RUN apt-get update && \ + apt-get install -y \ + git cmake wget g++ build-essential zlib1g-dev libbz2-dev bc \ + libgsl0-dev libncurses5-dev autoconf automake make liblzma-dev \ + libcurl4-gnutls-dev libssl-dev vt parallel gawk libjsoncpp-dev \ + libjsoncpp25 curl unzip ca-certificates file && \ + rm -rf /var/lib/apt/lists/* + +# AWS CLI — required at runtime: resource_helpers/download_hash.sh fetches region-specific +# 1000G/control exclusion hashes from S3 via `aws s3 ... --no-sign-request`. +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ + unzip -q awscliv2.zip && \ + ./aws/install && \ + rm -rf awscliv2.zip aws + +# htslib (provides bgzip/tabix + the libhts that samtools/bcftools link against) -> /usr/local. +# Keep the /opt/htslib source tree so samtools/bcftools can build against it via --with-htslib; +# run ldconfig so the runtime linker picks up the freshly installed /usr/local/lib/libhts. +RUN cd /opt && \ + git clone --recurse-submodules https://github.com/samtools/htslib.git --depth 1 --branch "${HTSLIB_VERSION}" && \ + cd htslib && autoreconf -i && ./configure && make && make install && ldconfig + +# samtools -> /usr/local (linked against the /opt/htslib source above) +RUN cd /opt && \ + git clone https://github.com/samtools/samtools.git --depth 1 --branch "${HTSLIB_VERSION}" && \ + cd samtools && autoheader && autoconf -Wno-syntax && \ + ./configure --with-htslib=/opt/htslib && make && make install && \ + cd /opt && rm -rf samtools + +# bcftools -> /usr/local (last htslib consumer; drop the htslib source tree afterward) +RUN cd /opt && \ + git clone https://github.com/samtools/bcftools.git --depth 1 --branch "${HTSLIB_VERSION}" && \ + cd bcftools && autoheader && autoconf && \ + ./configure --with-htslib=/opt/htslib --enable-libgsl && make && make install && \ + cd /opt && rm -rf bcftools htslib + +# bamtools -> /usr/local +RUN cd /opt && \ + git clone https://github.com/pezmaster31/bamtools.git --depth 1 --branch "${BAMTOOLS_VERSION}" && \ + cd bamtools && mkdir build && cd build && \ + cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && make && make install && \ + cd /opt && rm -rf bamtools + +# bedtools -> /usr/local/bin +RUN cd /opt && \ + wget -q "https://github.com/arq5x/bedtools2/releases/download/v${BEDTOOLS_VERSION}/bedtools-${BEDTOOLS_VERSION}.tar.gz" && \ + tar -zxf "bedtools-${BEDTOOLS_VERSION}.tar.gz" && \ + cd bedtools2 && make && cp bin/* /usr/local/bin/ && \ + cd /opt && rm -rf bedtools2 "bedtools-${BEDTOOLS_VERSION}.tar.gz" + +# RUFUS — built from the checked-out source tree (not a pinned git clone), so each branch/tag +# builds its own code. CMake fetches and builds the bundled externals (modified jellyfish, etc.). +COPY . /opt/RUFUS +RUN cd /opt/RUFUS && mkdir -p bin && cd bin && cmake ../ && make + +# Drop the largest build-only packages; keep the rest since runtime depends on them. +RUN apt-get purge -y --auto-remove git wget && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +ENV DEBIAN_FRONTEND= +ENV PATH=/opt/RUFUS/bin:${PATH} +ENV RUFUS_ROOT=/opt/RUFUS +# Pin bcftools to the plugins we built above. Without this the HOST's BCFTOOLS_PLUGINS is +# inherited into the container (near-universal on HPC, where a bcftools module is usually +# loaded), and our bcftools dlopens the host's mismatched plugin: +# fill-from-fasta.so: undefined symbol: bcf_format_gt_v2 +# which kills the VCF post-processing stage. Setting it here makes the image immune to host env. +ENV BCFTOOLS_PLUGINS=/usr/local/libexec/bcftools +ENV LC_CTYPE=en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US.UTF-8 + +# Smoke test — fails the build if any expected binary or env var is missing. +RUN bash /opt/RUFUS/tests/smoke_test.sh + +WORKDIR /data +CMD ["/bin/bash"] diff --git a/README.md b/README.md index 2f30e13f..d69a3342 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -RUFUS Singularity Container +RUFUS ===== -K-mer based variant detection. v1.0.0-gamma. +K-mer based variant detection. v1.2.0. Developed by Stephanie Georges, MS\ Based on the thesis project of Andrew Farrell, PhD\ @@ -12,28 +12,54 @@ For questions and feature requests, please contact [stephanie.georges@genetics.u ## RUFUS Overview -RUFUS is a reference-free, K-mer based variant detection algorithm, for short-read DNA sequence data. RUFUS is intended to run on a high performance computing (HPC) cluster with singularity installed. At a high level, you'll need to download the pre-built singularity container (detailed below) and set up a batch script corresponding to your resource manager. If your HPC system uses SLURM, you can utilize the provided helper functions to create your SBATCH scripts (detailed below). +RUFUS is a reference-bias-free, K-mer based variant detection algorithm, for short-read DNA sequence data. RUFUS is intended to run on a high performance computing (HPC) cluster with Apptainer (formerly Singularity) or Docker installed. At a high level, you'll need to download the pre-built container (detailed below) and either use the provided setup script to generate a SLURM script that runs RUFUS or manually create an execution script directly. -RUFUS currently supports a single subject sample, multiple control samples, and only accepts GRCh38 as a reference genome. The samples must be in BAM format (though may be unaligned). The reference genome must be in FASTA format, and must be indexed by BWA. If the BWA indexes are not detected in the same directory as the reference genome, RUFUS will create them. +RUFUS calls variants in a single subject against one or more control samples, and currently only accepts GRCh38 as a reference genome. Input files may be FASTQ, CRAM, BAM, or a RUFUS generator file. Where a sample is split across several files, pass each file to the same flag — they are combined into one sample. The reference genome must be in FASTA format, and must be indexed by BWA. If the BWA indexes are not detected in the same directory as the reference genome, RUFUS will create them. RUFUS has two stages: a variant calling stage, and a post-processing stage. Separation of the stages is necessary because the calling stage may be run in a windowed fashion, requiring multiple parallel RUFUS jobs over all of the windows. The combination stage must wait to proceed until all calling jobs are complete. Algorithmic runtime increases roughly linearly with sample coverage. Generally with whole-genome mode, a 100x sample run will take 1 day. Windowed mode completes significantly faster. ## Running RUFUS -### Obtaining the RUFUS Singularity Image +### Obtaining the RUFUS Image - The pre-built RUFUS singularity container may be obtained from [Zenodo](https://zenodo.org/records/13871423). To download: +The pre-built RUFUS container is published to two places: Docker Hub, and +[Zenodo](https://doi.org/10.5281/zenodo.13694210) for archival and citation. Either route gives you +the same image. + +**From Docker Hub (recommended on HPC).** `apptainer` builds the SIF for you — no `sudo`, no +manual `.def`: +```bash +apptainer pull rufus.sif docker://stefinfection/rufus:latest +apptainer pull rufus.sif docker://stefinfection/rufus:v1.2.0 ``` -curl "https://zenodo.org/records/13871423/files/rufus_v1.0.0-gamma.sif" -o rufus.sif +`:latest` always points at the most recent release; pin a specific version instead for a +reproducible analysis. Published versions are listed at +https://hub.docker.com/r/stefinfection/rufus/tags. + +**From Zenodo.** The DOI above is a *concept* DOI: it always resolves to the newest release. Zenodo +does not expose a fixed download path for "latest", so ask its API which file to fetch rather than +building a URL by hand — this needs no edits between releases, and is indifferent to the asset being +renamed: +```bash +CONCEPT=13694210 # the concept DOI suffix, 10.5281/zenodo.13694210 +URL=$(curl -fsSL --retry 3 --retry-delay 5 "https://zenodo.org/api/records/${CONCEPT}" \ + | python3 -c "import sys,json;print(next(f['links']['self'] for f in json.load(sys.stdin)['files'] if f['key'].endswith('.sif')))") +[ -n "$URL" ] || { echo "could not resolve the latest RUFUS SIF from Zenodo" >&2; exit 1; } +curl -fL --retry 3 --retry-delay 5 -o rufus.sif "$URL" ``` +The `-f` and the emptiness check matter: Zenodo's API intermittently returns 504s, and without +them a failed lookup silently leaves you with a truncated or empty `rufus.sif`. If it keeps +failing, the Docker Hub route above is the more reliable one. + +To browse releases instead, https://zenodo.org/records/13694210/latest opens the newest one. ### Input Data RUFUS requires the following data to run: -1) A subject sample in BAM format (this may be unaligned) -2) One or more control samples in BAM format (these may be unaligned) -3) A reference fasta file (this must be indexed by BWA) - for use in reporting the called variants. *It's recommended to provide the BWA indexes in the same data directory if you have them to save time creating them during the RUFUS run.*\ +1) A subject sample in FASTQ/BAM/CRAM/generator format. BAM/CRAM may be unaligned when using whole genome mode; FASTQ is whole-genome only and cannot be combined with `-R/--region`. If the sample is split across several files, pass `-s` once per file — they are treated as one sample, not as separate subjects. +2) At least one of: one or more control samples (`-c`, same formats as the subject), or an exclude hash (`-e`). Multiple distinct controls are supported, e.g. mother and father for a trio. Supplying only `-e` — typically pre-built 1000G/control hashes — is single-sample mode. +3) A reference fasta file (this must be indexed by BWA) - for use in reporting the called variants. *It's recommended to provide the BWA indexes in the same directory as the reference to save time creating them during the RUFUS run.*\ \ To create the BWA indexes, run the following commands: ``` @@ -41,17 +67,18 @@ To create the BWA indexes, run the following commands: samtools faidx {REFERENCE.fa} ``` -**All of the above required files, as well as any optional ones, must be located in a single directory, which will be mounted to the singularity container.** +All input files are specified by their full paths. The necessary host directories are automatically bind-mounted into the Apptainer container. ### Output Data -RUFUS will, by default, output the following files *in the same bound directory containing the input data*: +RUFUS will, by default, output the following files *in the current working directory*: 1) A VCF file containing the called variants 2) A supplemental directory with: * A pre-filtered VCF file * A BAM file containing the raw reads containing the mutant kmers * A BAM file containing the assembled contigs from the raw reads containing the mutant kmers * A hash table containing the unique subject kmers and their counts +3) In windowed (region) mode, a `region_status.log` file summarizing the outcome of each region (variants called, no variants found with reason, or error with exit code) ### The Two Stages of RUFUS @@ -59,47 +86,58 @@ RUFUS will, by default, output the following files *in the same bound directory RUFUS has two execution stages: 1) The calling stage, invoked by the following ``` -singularity exec --bind {PATH_TO_LOCAL_DATA_DIR}:/mnt {PATH_TO_RUFUS_CONTAINER}/rufus.sif bash /opt/RUFUS/runRufus.sh [-s|--subject ] [-r|--ref ] [-t|--threads ] [-k|--kmersize ] [-m|--min ] [-h|--help] [-c|] ... [-c|] ...OPTIONS +apptainer exec {PATH_TO_RUFUS_CONTAINER}/rufus.sif bash /opt/RUFUS/runRufus.sh [-s|--subject ] [-r|--ref ] [-t|--threads ] [-k|--kmersize ] [-m|--min ] [-h|--help] [-c|] ... [-c|] ...OPTIONS ``` With the following usage: ``` Required Arguments: - -s,--subject: single bam file (may be unaligned) containing the subject of interest - -c,--controls: bam file (may be unaligned) for the sequence data of the control sample (can be used multiple times, e.g. -c control1 -c control2) - -r,--ref: file path to the desired reference file - -t,--threads: number of threads to use (min 3) + -s,--subject: bam/cram/fastq/generator file(s) containing the subject of interest. Use + multiple times ONLY for split files of the same sample (e.g. + -s subject.part1.bam -s subject.part2.bam); they are combined into one + subject, not called separately + -r,--ref: file path to the desired reference file + -t,--threads: number of threads to use (min 3) Optional Arguments: - -k,--kmersize: length of k-mer to use (defaults to 25) - -m,--min: overwrites the minimum k-mer depth count to call variant (defaults to 5) - -e,--exclude: Jhash file of kmers to exclude from mutation list (can be used multiple times, e.g. -e Jhash1 -e Jhash2) - -f,--refhash: Jhash file containing reference hashList - -h,--help: Print help + -c,--controls: bam/cram/fastq/generator file(s) for the sequence data of a control sample + (can be used multiple times for distinct controls, e.g. + -c mother.bam -c father.bam). Optional ONLY if -e/--exclude is supplied + instead: RUFUS requires at least one control or exclude source and will exit + if given neither. Supplying only -e is single-sample mode + -k,--kmersize: length of k-mer to use (defaults to 25) + -m,--min: overwrites the minimum k-mer depth count to call variant (defaults to 5) + -e,--exclude: Jhash file of kmers to exclude from mutation list (can be used multiple + times, e.g. -e Jhash1 -e Jhash2) + -f,--refhash: Jhash file containing reference hashList + -R,--region: genomic region to call variants on (e.g. chr1:1-1000000); used in windowed + mode + -h,--help: print help ``` 2) The post-processing stage, invoked by the following ``` -singularity exec --bind {PATH_TO_LOCAL_DATA_DIR}:/mnt {PATH_TO_RUFUS_CONTAINER}/rufus.sif bash /opt/RUFUS/post_process/post_process.sh [-w window_size] [-r reference] [-subject] [-c control1,control2,control3...] [-d source_dir] +apptainer exec {PATH_TO_RUFUS_CONTAINER}/rufus.sif bash /opt/RUFUS/post_process/post_process.sh -s -w ``` With the following usage: ``` Required Arguments: - -w window_size The size of the window used in the RUFUS run - -r reference The reference used in the RUFUS run - -c controls The control bam files used in the RUFUS run - -s subject_file The name of the subject file: must be the same as that supplied to the RUFUS run - -d source_dir The source directory where the vcf(s) made by the calling stage are located -Optional Arguments: - -h help Print help message + -s subject_file the name of the subject file; must be the same as that supplied to the + RUFUS run + -w window_size the size of the window used in the RUFUS run (0 for whole genome mode) + +Optional Arguments: + -h help print help message ``` +In windowed mode, the post-processing stage will print a region status summary showing how many regions called variants, how many had no variants (with breakdown by reason), and how many encountered errors. The final VCF header will include a `##RUFUS_runMode` line indicating region mode was used. + ## Using the SLURM Helper Script & Executing the SLURM Batch Scripts The SLURM helper script automatically creates the two SLURM batch scripts necessary to run RUFUS on a SLURM-managed HPC cluster, as well as a bash script to execute them. To use: 1) Execute the helper script (see full usage options below): ``` -singularity exec {PATH_TO_RUFUS_CONTAINER}/rufus.sif bash /opt/RUFUS/singularity/setup_slurm.sh [-s subject] [-c control1,control2,control3...] [-b genome_build] [-a slurm_account] [-p slurm_partition] ...OPTIONS +apptainer exec {PATH_TO_RUFUS_CONTAINER}/rufus.sif bash /opt/RUFUS/singularity/setup_slurm.sh [-s subject] [-c control1,control2,control3...] [-b genome_build] [-a slurm_account] [-p slurm_partition] ...OPTIONS ``` 2) Then execute the generated bash script: @@ -110,26 +148,44 @@ bash launch_rufus.sh The full usage options for the helper script are as follows: ``` Required Arguments: - -d data_directory The directory containing the subject, control, and reference files to be used in the run - -s subject The subject sample of interest; must be located in data_directory - -c control(s) A single control or comma-delimited array of multiple controls; must be located in data_directory - -b genome_build The desired genome build; currently only supports GRCh38 - -r reference The reference file matching the genome build; must be located in data_directory - -a slurm_account The account for the slurm job - -p slurm_partition The partition for the slurm job - -l slurm_job_array_limit The maximum amount of jobs slurm allows in an array - + -s subject full path to the subject sample BAM/CRAM + -b genome_build the desired genome build; currently only supports GRCh38 + -r reference full path to the reference file matching the genome build + -a slurm_account the account for the slurm job + -p slurm_partition the partition for the slurm job + -l slurm_job_array_limit the maximum amount of jobs slurm allows in an array + Optional Arguments: - -m kmer_depth_cutoff The amount of kMers that must overlap the variant to be included in the final call set - -w window_size The size of the windows to run RUFUS on, in units of kilabases (KB); allowed range between 500-5000; defaults to single run of entire genome if not provided - -f reference_hash: Jhash file containing reference kMer hash list - -x exclude_hash: Single or comma-delimited list of Jhash file(s) containing kMers to exclude from unique hash list - -y path_to_rufus_container If not provided, will look in current directory for rufus.sif - -z rufus_threads Number of threads provided to RUFUS; defaults to 36 - -e email The email address to notify with slurm updates - -q slurm_job_queue_limit The maximum amount of jobs able to be ran at once; defaults to 20 - -t slurm_time_limit The maximum amount of time to let the slurm job run; defaults to 7 days for full run, or one hour per window (DD-HH:MM:SS) - -h help Print usage + -c control(s) a single control or comma-delimited array of multiple controls + (full paths). Omit for single-sample mode, in which case you must + supply a hash source instead -- see "Single-sample mode" below + -m kmer_depth_cutoff the amount of kMers that must overlap the variant to be included + in the final call set + -w window_size the size of the windows to run RUFUS on, in units of kilobases + (KB); allowed range between 500-5000; defaults to a single run of + the entire genome if not provided + -f reference_hash Jhash file containing reference kMer hash list + -x exclude_hash single or comma-delimited list of Jhash file(s) containing kMers + to exclude (static, same for all regions) + -K kg1_hash_dir full path to directory of per-region KG1 Jhash files (files named + *{region}*.Jhash) + -G kg1_version KG1 hash version to download from S3 (e.g. v3.0) + -D ctrl_hash_dir full path to directory of per-region control Jhash files (files + named *{region}*.Jhash) + -V ctrl_version control hash version to download from S3 (e.g. v1.0) + -M memory_per_call how much memory to allot to the rufus calling stage job (e.g. + 150G or 20G) + -C cpus_per_call how many cpus to allot to each rufus calling stage job; defaults + to 40 for whole genome, 12 for 1MB windows. Must be greater than + the RUFUS thread count (-z), or setup will exit with an error + -y path_to_rufus_container if not provided, will look in the current directory for rufus.sif + -z rufus_threads number of threads provided to RUFUS; defaults to 36 for the + entire genome, 10 for 1MB windows + -e email the email address to notify with slurm updates + -q slurm_job_queue_limit the maximum amount of jobs able to be run at once; defaults to 20 + -t slurm_time_limit the maximum amount of time to let the slurm job run; defaults to + 7 days for a full run, or one hour per window (DD-HH:MM:SS) + -h help print usage ``` \ *Notes on SLURM arguments*:\ @@ -143,12 +199,43 @@ To maximize parallelism, filling in the slurm job queue limit (-q) is recommende scontrol show config | grep "default_queue_depth" ``` -#### Example Invocation of the helper script +#### Example Invocations of the helper script + +Basic windowed mode: ``` -singularity exec /home/my_container_path/rufus.sif bash /opt/RUFUS/singularity/setup_slurm.sh -d /home/my_data_dir/ -s subject.bam -c control_a.bam, control_b.bam -r GRCh38_reference.fa -a my-slurm-account -p my-slurm-partition -w 1000 -t "00:30:00" -m 5 -l 20 -z 36 -e "my_email@utah.edu" -f /home/my_container_path/ +apptainer exec /home/my_container_path/rufus.sif bash /opt/RUFUS/singularity/setup_slurm.sh -s /home/subjects/subject.bam -c /home/controls/control_a.bam,/home/controls/control_b.bam -r /refs/GRCh38_reference.fa -a my-slurm-account -p my-slurm-partition -w 1000 -t "00:30:00" -m 5 -l 20 -z 36 -e "my_email@utah.edu" ``` -## +With local per-region hash directories: +``` +apptainer exec /home/my_container_path/rufus.sif bash /opt/RUFUS/singularity/setup_slurm.sh -s /home/subjects/subject.bam -c /home/controls/control_a.bam -r /refs/GRCh38_reference.fa -a my-slurm-account -p my-slurm-partition -w 1000 -l 1000 -K /data/kg1_hashes/v3.0/ -D /data/ctrl_hashes/v1.0/ +``` -======= +With S3-downloaded hashes (downloaded at setup time): +``` +apptainer exec /home/my_container_path/rufus.sif bash /opt/RUFUS/singularity/setup_slurm.sh -s /home/subjects/subject.bam -c /home/controls/control_a.bam -r /refs/GRCh38_reference.fa -a my-slurm-account -p my-slurm-partition -w 1000 -l 1000 -G v3.0 -V v1.0 +``` + +#### Single-sample mode + +RUFUS does not require a matched control. If you have no control sample, omit `-c` and supply a +pre-built k-mer hash source instead — RUFUS subtracts against those hashes rather than against a +control you sequenced. Any of `-x`, `-K`/`-G`, or `-D`/`-V` satisfies this; they are passed through +to the calling stage as `-e/--exclude` arguments. + +You must supply at least one of a control or a hash source. Providing neither is rejected at the +start of the calling stage. + +Single-sample, windowed, with S3-downloaded 1000 Genomes and control hashes: +``` +apptainer exec /home/my_container_path/rufus.sif bash /opt/RUFUS/singularity/setup_slurm.sh -s /home/subjects/subject.bam -r /refs/GRCh38_reference.fa -a my-slurm-account -p my-slurm-partition -b GRCh38 -w 1000 -l 1000 -G v3.0 -V v1.0 +``` + +The same run against hash directories you already hold locally: +``` +apptainer exec /home/my_container_path/rufus.sif bash /opt/RUFUS/singularity/setup_slurm.sh -s /home/subjects/subject.bam -r /refs/GRCh38_reference.fa -a my-slurm-account -p my-slurm-partition -b GRCh38 -w 1000 -l 1000 -K /data/kg1_hashes/v3.0/ -D /data/ctrl_hashes/v1.0/ +``` + +*Note*: `-K`/`-G` (KG1 hashes) and `-D`/`-V` (control hashes) are mutually exclusive per type. You may mix local and S3 across types (e.g., `-K /local/kg1/ -V v1.0`). Hash files in local directories must be named with the region string (e.g., `*chr1_1_1000000*.Jhash` for region `chr1:1-1000000`, or `*wg*.Jhash` for whole-genome mode). +======= diff --git a/Untitled Diagram.drawio b/Untitled Diagram.drawio deleted file mode 100644 index 65ef63bc..00000000 --- a/Untitled Diagram.drawio +++ /dev/null @@ -1,902 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/aws_launch/aws_helpers/setup_storage.sh b/aws_launch/aws_helpers/setup_storage.sh new file mode 100644 index 00000000..963b88d0 --- /dev/null +++ b/aws_launch/aws_helpers/setup_storage.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +sudo mount /dev/nvme1n1 /mnt/data +sudo chown -R ubuntu:ubuntu /mnt/data + +# if need to start from zero with new volume + +#sudo file -s /dev/nvme1n1 +#sudo mkfs -t ext4 /dev/nvme1n1 +#sudo mkdir -p /mnt/data +#sudo mount /dev/nvme1n1 /mnt/data +#df -h +#sudo blkid /dev/nvme1n1 +#echo "UUID= /mnt/data ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab +#sudo chown -R ubuntu:ubuntu /mnt/data diff --git a/aws_launch/docker/DOCKER_README.md b/aws_launch/docker/DOCKER_README.md new file mode 100644 index 00000000..a1fffbd6 --- /dev/null +++ b/aws_launch/docker/DOCKER_README.md @@ -0,0 +1,80 @@ +# Running RUFUS on AWS + +## Step 0: Prerequisites +Running RUFUS on AWS requires Docker. Installation instructions for getting Docker on your machine can be found [here](https://docs.docker.com/engine/install/). + +## Step 1: Fetch RUFUS image from Docker Hub and Setup Files from S3 +```bash +docker pull stefinfection/rufus:latest + +# Required files for all modes +curl "https://s3.us-east-1.amazonaws.com/rufus.marth.lab/public_access_data/launch_resources/launch_rufus.sh" -o launch_rufus.sh +curl "https://s3.us-east-1.amazonaws.com/rufus.marth.lab/public_access_data/launch_resources/rufus.env" -o rufus.env + +# Required files for regional mode (recommended for heightened SNV/indel detection) +curl "https://s3.us-east-1.amazonaws.com/rufus.marth.lab/public_access_data/launch_resources/grch38_1mb_regions.txt" -o grch38_1mb_regions.txt +``` +## Step 2: Fill Out the RUFUS Environment File +The `rufus.env` file, downloaded in Step 1, coordinates passing arguments into the RUFUS launch script. + +## Step 3: Launch RUFUS +```bash +chmod u+x launch_rufus.sh +./launch_rufus.sh "${PATH_TO}/rufus.env" +``` +RUFUS will automatically run in and write results to the current directory, unless '$WORKING_DIR' is set to otherwise in `rufus.env`. + +## [*OPTIONAL*] Download Pre-Built or Generate BWA Indexes of Reference fasta (~5GB) +RUFUS requires BWA generated indexes during an intermediate step. While RUFUS will automatically generate these indexes when missing, it can save some time to pre-generate them. We also have pre-generated indexes available for download. Indexes should be placed in the same directory as the fasta file. +```bash +# For GCA_000001405.15_GRCh38_no_alt_analysis_set.fa +for ext in sa bwt pac amb ann fai; do + curl "https://s3.us-east-1.amazonaws.com/rufus.marth.lab/public_access_data/references/GCA_000001405.15_GRCh38_no_alt_analysis_set.fa.$ext" -o "GCA_000001405.15_GRCh38_no_alt_analysis_set.fa.$ext" +done + +# Place indexes in same file as reference fasta +mv "GCA_000001405.15_GRCh38_no_alt_analysis_set.fa*" ${REFERENCE_FASTA_PATH} + +# For GRCh38_full_analysis_set_plus_decoy_hla.fa +for ext in sa bwt pac amb ann fai; do + curl "https://s3.us-east-1.amazonaws.com/rufus.marth.lab/public_access_data/references/GRCh38_full_analysis_set_plus_decoy_hla.dict.$ext" -o "GRCh38_full_analysis_set_plus_decoy_hla.fa*.$ext" +done + +# Place indexes in same file as reference fasta +mv "GRCh38_full_analysis_set_plus_decoy_hla.fa*" ${REFERENCE_FASTA_PATH} +``` + +## [*OPTIONAL*] Download Pre-Built RUFUS Hash Tables and Reference Indexes (~1TB) +RUFUS utilizes hash tables to identify unique kmers within a subject sample. Some of these hash tables have already been created and can be downloaded and stored locally, if desired. This is a good idea if your servers have firewalls or do not allow https traffic. **NOTE: this is approximately 1TB of data.** + +If these resources are not downloaded, RUFUS will automatically fetch them as needed during the run - each run only downloads ~500MB of this data at a time, and deletes after use as to not overwhelm a host directory. + +## Step 1: Download Hashes +#### Option A: Download with AWS-CLI +```bash +# Internal control hashes (for single sample mode) +aws s3 sync s3://rufus.marth.lab/public_access_data/control_hashes/ ${LOCAL_DESTINATION_DIR}/control_hashes --no-sign-request + +# 1000G hashes +aws s3 sync s3://rufus.marth.lab/public_access_data/kg1_hashes/ ${LOCAL_DESTINATION_DIR}/kg1_hashes --no-sign-request +``` + +#### Option B: Download with Rclone +```bash +# Internal control hashes (for single sample mode) +rclone copy :s3:rufus.marth.lab/public_access_data/control_hashes/ ${LOCAL_DESTINATION_DIR}/control_hashes --s3-provider=AWS --s3-region=us-east-1 --s3-no-check-bucket --s3-env-auth=false -P + +# 1000G hashes +rclone copy :s3:rufus.marth.lab/public_access_data/kg1_hashes/ ${LOCAL_DESTINATION_DIR}/kg1_hashes --s3-provider=AWS --s3-region=us-east-1 --s3-no-check-bucket --s3-env-auth=false -P +``` + +### Step 2: Update rufus.env Variables +Add or assign the following variables in `rufus.env`: +```bash +KG1_HASH_LOCAL_DIR=${PATH_TO_KG1_HASHES} +CONTROL_HASH_LOCAL_DIR=${PATH_TO_CONTROL_HASHES} + +# Example if using download command from above +CONTROL_HASH_LOCAL_DIR=${LOCAL_DESTINATION_DIR}/control_hashes +KG1_HASH_LOCAL_DIR=${LOCAL_DESTINATION_DIR}/kg1_hashes +``` \ No newline at end of file diff --git a/aws_launch/docker/build_docker_rufus.sh b/aws_launch/docker/build_docker_rufus.sh new file mode 100644 index 00000000..ae4677f6 --- /dev/null +++ b/aws_launch/docker/build_docker_rufus.sh @@ -0,0 +1 @@ +sudo docker build --no-cache -t rufus:dac . diff --git a/aws_launch/docker/dac_pipeline_example.build b/aws_launch/docker/dac_pipeline_example.build new file mode 100644 index 00000000..a1eb58a0 --- /dev/null +++ b/aws_launch/docker/dac_pipeline_example.build @@ -0,0 +1,220 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +################################################################################ +# Simple RUFUS wrapper +# Run per shard. Requires a region file in TSV format with regions grouped +# by shards and the index for the shard to run the corresponding regions. +################################################################################ + +usage() { + cat < region, e.g. chr1:1-1000000) + + Example: + 1 chr1:1-1000000 + 1 chr1:1000001-2000000 + 1 chr1:2000001-3000000 + ... + 2 chr5:1-1000000 + 2 chr5:1000001-2000000 + 2 chr5:2000001-3000000 + ... + + -i Shard index to use to select set of regions + -d Directory where Jhash files live (PATH_RUFUS_DIR) + Expect subdirs for Control and KG1 as follows: + + - + - CONTROL + - v1.0 + - KG1 + - v3.0 + +Optional: + -m KMER_DEPTH_CUTOFF (default: 5) + -k KMER_LENGTH (default: 25) + -t THREADS per region (default: 8) + -g KG1 hash version (default: v3.0) + -c Control hash version (default: v1.0) + -o Output prefix .vcf.gz (default: output) +EOF + exit 1 +} + +# Defaults +INPUT_CRAM="" +REFERENCE="" +REGION_FILE="" +SHARD_INDEX="" +PATH_RUFUS_DIR="" +KMER_DEPTH_CUTOFF=5 +KMER_LENGTH=25 +THREADS=8 +KG1_VERSION="v3.0" +CONTROL_VERSION="v1.0" +OUTPUT_PREFIX="output" + +while getopts "s:r:f:i:d:m:k:t:g:c:o:h" opt; do + case "$opt" in + s) INPUT_CRAM="$OPTARG" ;; + r) REFERENCE="$OPTARG" ;; + f) REGION_FILE="$OPTARG" ;; + i) SHARD_INDEX="$OPTARG" ;; + d) PATH_RUFUS_DIR="$OPTARG" ;; + m) KMER_DEPTH_CUTOFF="$OPTARG" ;; + k) KMER_LENGTH="$OPTARG" ;; + t) THREADS="$OPTARG" ;; + g) KG1_VERSION="$OPTARG" ;; + c) CONTROL_VERSION="$OPTARG" ;; + o) OUTPUT_PREFIX="$OPTARG" ;; + h) usage ;; + *) usage ;; + esac +done + +# Auto-compute number of parallel jobs: total CPUs / threads per region +TOTAL_CPUS=$(nproc) +JOBS=$(( TOTAL_CPUS / THREADS )) + +# Ensure at least 1 job +if [[ "$JOBS" -lt 1 ]]; then + JOBS=1 +fi + +echo "INFO: Auto-computed JOBS = $JOBS (CPUs=$TOTAL_CPUS, THREADS per region=$THREADS)" + +# Required checks +[[ -n "$INPUT_CRAM" ]] || { echo "Error: -s subject CRAM/BAM is required"; usage; } +[[ -n "$REFERENCE" ]] || { echo "Error: -r reference FASTA is required"; usage; } +[[ -n "$REGION_FILE" ]] || { echo "Error: -f region file is required"; usage; } +[[ -n "$SHARD_INDEX" ]] || { echo "Error: -i shard index is required"; usage; } +[[ -n "$PATH_RUFUS_DIR" ]] || { echo "Error: -d PATH_RUFUS_DIR is required"; usage; } + +[[ -f "$INPUT_CRAM" ]] || { echo "Error: subject file $INPUT_CRAM not found"; exit 1; } +[[ -f "$REFERENCE" ]] || { echo "Error: reference $REFERENCE not found"; exit 1; } +[[ -f "$REGION_FILE" ]] || { echo "Error: region file $REGION_FILE not found"; exit 1; } + +# Check secondary files + # CRAM/BAM + if [[ "$INPUT_CRAM" == *.cram ]]; then + if [[ ! -f "${INPUT_CRAM}.crai" ]]; then + echo "Error: missing index for ${INPUT_CRAM}. Expected ${INPUT_CRAM}.crai" + exit 1 + fi + elif [[ "$INPUT_CRAM" == *.bam ]]; then + if [[ ! -f "${INPUT_CRAM}.bai" ]]; then + echo "Error: missing index for ${INPUT_CRAM}. Expected ${INPUT_CRAM}.bai" + exit 1 + fi + else + echo "Error: unsupported file type (must be .bam or .cram): $INPUT_CRAM" + exit 1 + fi + + # FASTA + [[ -f "${REFERENCE}.fai" ]] || { echo "Error: .fai index file for $REFERENCE not found"; exit 1; } + +# Check Tools +command -v bcftools >/dev/null 2>&1 || { echo "Error: bcftools not found in PATH"; exit 1; } +command -v tabix >/dev/null 2>&1 || { echo "Error: tabix not found in PATH"; exit 1; } + +# Define run function +run_shard_region() { + local region="$1" + + # Format region to match Jhash naming: chr1:1-1000000 -> chr1_1_1000000 + local region_fmt + region_fmt=$(echo "$region" | tr ':-' '_') + + # Build Jhash paths + # Example: chr1_1_1000000.150.1KG_v3.0.Jhash + # chr1_1_1000000.2.control_v1.0.Jhash + local kg1_hash="${PATH_RUFUS_DIR}/KG1/${KG1_VERSION}/${region_fmt}.150.1KG_${KG1_VERSION}.Jhash" + local control_hash="${PATH_RUFUS_DIR}/CONTROL/${CONTROL_VERSION}/${region_fmt}.2.control_${CONTROL_VERSION}.Jhash" + + # Existence checks + [[ -f "$kg1_hash" ]] || { echo "Error: KG1 hash not found: $kg1_hash"; exit 1; } + [[ -f "$control_hash" ]] || { echo "Error: control hash not found: $control_hash"; exit 1; } + + echo "===========================================" + echo "INFO: REGION = $region" + echo "INFO: REGION_FMT = $region_fmt" + echo "INFO: KG1 hash = $kg1_hash" + echo "INFO: Control hash = $control_hash" + echo "INFO: KMER_DEPTH = $KMER_DEPTH_CUTOFF" + echo "INFO: KMER_LENGTH = $KMER_LENGTH" + echo "INFO: THREADS = $THREADS" + + runRufus.sh \ + -s "$INPUT_CRAM" \ + -cr "$REFERENCE" \ + -m "$KMER_DEPTH_CUTOFF" \ + -k "$KMER_LENGTH" \ + -t "$THREADS" \ + -L -vs \ + -e "$kg1_hash" \ + -e "$control_hash" \ + -R "$region" \ + || { echo "Error: RUFUS failed for region $region"; exit 1; } +} + +# Run +echo "INFO: Running shard index $SHARD_INDEX from $REGION_FILE" +echo "INFO: Parallel region jobs (JOBS) = $JOBS" + +# Collect regions for this shard into a temp file +TMP_REGIONS="$(mktemp rufus_regions.${SHARD_INDEX}.XXXXXX)" +trap 'rm -f "$TMP_REGIONS"' EXIT + +awk -v idx="$SHARD_INDEX" 'NF >= 2 && $1 == idx { print $2 }' "$REGION_FILE" > "$TMP_REGIONS" + +if [[ ! -s "$TMP_REGIONS" ]]; then + echo "Warning: no regions found in $REGION_FILE for shard index $SHARD_INDEX" >&2 + exit 0 +fi + +# Export function + env so xargs sub-shells can see them +export -f run_shard_region +export PATH_RUFUS_DIR KG1_VERSION CONTROL_VERSION INPUT_CRAM REFERENCE \ + KMER_DEPTH_CUTOFF KMER_LENGTH THREADS + +# Run each region in parallel; each region gets full -t "$THREADS" inside runRufus.sh +xargs -a "$TMP_REGIONS" -n 1 -P "$JOBS" -I {} bash -c 'run_shard_region "$@"' _ {} + +echo "DEBUG: stop after running shard regions" +exit + + +# Collect shard outputs (sorted, safe if none) +shopt -s nullglob +mapfile -t REGIONS < <( + printf "%s\n" temp.RUFUS.Final.*.vcf.gz | + sort -V +) +shopt -u nullglob +(( ${#REGIONS[@]} > 0 )) || { echo "Error: no region outputs found"; exit 1; } + +# Merging annotated shards using bcftools +echo "Merging ${#REGIONS[@]} annotated regions..." +MERGED="merged.vcf" +FINAL_GZ="${OUTPUT_PREFIX}.vcf.gz" + +echo "-- BCFTools ---------------------------" +bcftools concat -a -D -O v -o "$MERGED" "${REGIONS[@]}" \ + || { echo "Error: bcftools concat failed"; exit 1; } + +bcftools sort -T "tmp_bcftools.XXXXXX" -O z -o "$FINAL_GZ" "$MERGED" \ + || { echo "Error: bcftools sort failed"; exit 1; } + +tabix -f -p vcf "$FINAL_GZ" \ + || { echo "Error: tabix failed"; exit 1; } +echo "-----------------------------------------" + +echo "Done: $FINAL_GZ" diff --git a/aws_launch/docker/test_suite/pipeline_test.sh b/aws_launch/docker/test_suite/pipeline_test.sh new file mode 100644 index 00000000..f48cc2fa --- /dev/null +++ b/aws_launch/docker/test_suite/pipeline_test.sh @@ -0,0 +1,220 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +################################################################################ +# Simple RUFUS wrapper +# Run per shard. Requires a region file in TSV format with regions grouped +# by shards and the index for the shard to run the corresponding regions. +# SJG added -p flag for testing purposes +################################################################################ + +usage() { + cat < region, e.g. chr1:1-1000000) + + Example: + 1 chr1:1-1000000 + 1 chr1:1000001-2000000 + 1 chr1:2000001-3000000 + ... + 2 chr5:1-1000000 + 2 chr5:1000001-2000000 + 2 chr5:2000001-3000000 + ... + + -i Shard index to use to select set of regions + -d Directory where Jhash files live (PATH_RUFUS_DIR) + Expect subdirs for Control and KG1 as follows: + + - + - CONTROL + - v1.0 + - KG1 + - v3.0 + +Optional: + -m KMER_DEPTH_CUTOFF (default: 5) + -k KMER_LENGTH (default: 25) + -t THREADS per region (default: 8) + -g KG1 hash version (default: v3.0) + -c Control hash version (default: v1.0) + -o Output prefix .vcf.gz (default: output) + -w Passed work dir +EOF + exit 1 +} + +# Defaults +INPUT_CRAM="" +REFERENCE="" +REGION_FILE="" +SHARD_INDEX="" +PATH_RUFUS_DIR="" +KMER_DEPTH_CUTOFF=5 +KMER_LENGTH=25 +THREADS=8 +KG1_VERSION="v3.0" +CONTROL_VERSION="v1.0" +OUTPUT_PREFIX="output" +PASSED_WORK_DIR="" + +while getopts "s:r:f:i:d:p:m:k:t:g:c:o:h" opt; do + case "$opt" in + s) INPUT_CRAM="$OPTARG" ;; + r) REFERENCE="$OPTARG" ;; + f) REGION_FILE="$OPTARG" ;; + i) SHARD_INDEX="$OPTARG" ;; + d) PATH_RUFUS_DIR="$OPTARG" ;; + p) PASSED_WORK_DIR="$OPTARG" ;; + m) KMER_DEPTH_CUTOFF="$OPTARG" ;; + k) KMER_LENGTH="$OPTARG" ;; + t) THREADS="$OPTARG" ;; + g) KG1_VERSION="$OPTARG" ;; + c) CONTROL_VERSION="$OPTARG" ;; + o) OUTPUT_PREFIX="$OPTARG" ;; + h) usage ;; + *) usage ;; + esac +done + +# Auto-compute number of parallel jobs: total CPUs / threads per region +TOTAL_CPUS=$(nproc) +JOBS=$(( TOTAL_CPUS / THREADS )) + +# Ensure at least 1 job +if [[ "$JOBS" -lt 1 ]]; then + JOBS=1 +fi + +echo "INFO: Auto-computed JOBS = $JOBS (CPUs=$TOTAL_CPUS, THREADS per region=$THREADS)" + +# Required checks +[[ -n "$INPUT_CRAM" ]] || { echo "Error: -s subject CRAM/BAM is required"; usage; } +[[ -n "$REFERENCE" ]] || { echo "Error: -r reference FASTA is required"; usage; } +[[ -n "$REGION_FILE" ]] || { echo "Error: -f region file is required"; usage; } +[[ -n "$SHARD_INDEX" ]] || { echo "Error: -i shard index is required"; usage; } +[[ -n "$PATH_RUFUS_DIR" ]] || { echo "Error: -d PATH_RUFUS_DIR is required"; usage; } + +[[ -f "$INPUT_CRAM" ]] || { echo "Error: subject file $INPUT_CRAM not found"; exit 1; } +[[ -f "$REFERENCE" ]] || { echo "Error: reference $REFERENCE not found"; exit 1; } +[[ -f "$REGION_FILE" ]] || { echo "Error: region file $REGION_FILE not found"; exit 1; } + +# Check secondary files + # CRAM/BAM + if [[ "$INPUT_CRAM" == *.cram ]]; then + if [[ ! -f "${INPUT_CRAM}.crai" ]]; then + echo "Error: missing index for ${INPUT_CRAM}. Expected ${INPUT_CRAM}.crai" + exit 1 + fi + elif [[ "$INPUT_CRAM" == *.bam ]]; then + if [[ ! -f "${INPUT_CRAM}.bai" ]]; then + echo "Error: missing index for ${INPUT_CRAM}. Expected ${INPUT_CRAM}.bai" + exit 1 + fi + else + echo "Error: unsupported file type (must be .bam or .cram): $INPUT_CRAM" + exit 1 + fi + + # FASTA + [[ -f "${REFERENCE}.fai" ]] || { echo "Error: .fai index file for $REFERENCE not found"; exit 1; } + +# Check Tools +command -v bcftools >/dev/null 2>&1 || { echo "Error: bcftools not found in PATH"; exit 1; } +command -v tabix >/dev/null 2>&1 || { echo "Error: tabix not found in PATH"; exit 1; } + +# Define run function +run_shard_region() { + local region="$1" + + # Format region to match Jhash naming: chr1:1-1000000 -> chr1_1_1000000 + local region_fmt + region_fmt=$(echo "$region" | tr ':-' '_') + + # Build Jhash paths + # Example: chr1_1_1000000.150.1KG_v3.0.Jhash + # chr1_1_1000000.2.control_v1.0.Jhash + local kg1_hash="${PATH_RUFUS_DIR}/KG1/${KG1_VERSION}/${region_fmt}.150.1KG_${KG1_VERSION}.Jhash" + local control_hash="${PATH_RUFUS_DIR}/CONTROL/${CONTROL_VERSION}/${region_fmt}.2.control_${CONTROL_VERSION}.Jhash" + + # Existence checks + [[ -f "$kg1_hash" ]] || { echo "Error: KG1 hash not found: $kg1_hash"; exit 1; } + [[ -f "$control_hash" ]] || { echo "Error: control hash not found: $control_hash"; exit 1; } + + echo "===========================================" + echo "INFO: REGION = $region" + echo "INFO: REGION_FMT = $region_fmt" + echo "INFO: KG1 hash = $kg1_hash" + echo "INFO: Control hash = $control_hash" + echo "INFO: KMER_DEPTH = $KMER_DEPTH_CUTOFF" + echo "INFO: KMER_LENGTH = $KMER_LENGTH" + echo "INFO: THREADS = $THREADS" + echo "INFO: PASSED_WORK_DIR = $PASSED_WORK_DIR" + docker exec -w /host/${PASSED_WORK_DIR} rufus-worker $RUFUS_ROOT/runRufus.sh \ + -s "$INPUT_CRAM" \ + -r "$REFERENCE" \ + -m "$KMER_DEPTH_CUTOFF" \ + -k "$KMER_LENGTH" \ + -t "$THREADS" \ + -L -vs \ + -e "$kg1_hash" \ + -e "$control_hash" \ + -R "$region" \ + || { echo "Error: RUFUS failed for region $region"; exit 1; } +} + +# Run +echo "INFO: Running shard index $SHARD_INDEX from $REGION_FILE" +echo "INFO: Parallel region jobs (JOBS) = $JOBS" + +# Collect regions for this shard into a temp file +TMP_REGIONS="$(mktemp rufus_regions.${SHARD_INDEX}.XXXXXX)" +trap 'rm -f "$TMP_REGIONS"' EXIT + +awk -v idx="$SHARD_INDEX" 'NF >= 2 && $1 == idx { print $2 }' "$REGION_FILE" > "$TMP_REGIONS" + +if [[ ! -s "$TMP_REGIONS" ]]; then + echo "Warning: no regions found in $REGION_FILE for shard index $SHARD_INDEX" >&2 + exit 0 +fi + +# Export function + env so xargs sub-shells can see them +export -f run_shard_region +export PATH_RUFUS_DIR KG1_VERSION CONTROL_VERSION INPUT_CRAM REFERENCE \ + KMER_DEPTH_CUTOFF KMER_LENGTH THREADS PASSED_WORK_DIR + +# Run each region in parallel; each region gets full -t "$THREADS" inside runRufus.sh +xargs -a "$TMP_REGIONS" -n 1 -P "$JOBS" -I {} bash -c 'run_shard_region "$@"' _ {} + +# Collect shard outputs (sorted, safe if none) +shopt -s nullglob +mapfile -t REGIONS < <( + printf "%s\n" ${PASSED_WORK_DIR}temp.RUFUS.Final.*.vcf.gz | + sort -V +) +shopt -u nullglob +(( ${#REGIONS[@]} > 0 )) || { echo "Error: no region outputs found"; exit 1; } + +# Merging annotated shards using bcftools +echo "Merging ${#REGIONS[@]} annotated regions..." +MERGED="merged.vcf" +FINAL_GZ="${OUTPUT_PREFIX}.vcf.gz" + +echo "-- BCFTools ---------------------------" +bcftools concat -a -D -O v -o "$MERGED" "${REGIONS[@]}" \ + || { echo "Error: bcftools concat failed"; exit 1; } + +bcftools sort -T "tmp_bcftools.XXXXXX" -O z -o "$FINAL_GZ" "$MERGED" \ + || { echo "Error: bcftools sort failed"; exit 1; } + +tabix -f -p vcf "$FINAL_GZ" \ + || { echo "Error: tabix failed"; exit 1; } +echo "-----------------------------------------" + +echo "Done: $FINAL_GZ" diff --git a/aws_launch/docker/test_suite/region_files/four_regions.tsv b/aws_launch/docker/test_suite/region_files/four_regions.tsv new file mode 100644 index 00000000..e6c3ff5a --- /dev/null +++ b/aws_launch/docker/test_suite/region_files/four_regions.tsv @@ -0,0 +1,4 @@ +1 chr1:1-1000000 +1 chr1:1000001-2000000 +1 chr6:32000001-33000000 +1 chr6:33000001-34000000 diff --git a/aws_launch/docker/test_suite/region_files/regions.tsv b/aws_launch/docker/test_suite/region_files/regions.tsv new file mode 100644 index 00000000..e6c3ff5a --- /dev/null +++ b/aws_launch/docker/test_suite/region_files/regions.tsv @@ -0,0 +1,4 @@ +1 chr1:1-1000000 +1 chr1:1000001-2000000 +1 chr6:32000001-33000000 +1 chr6:33000001-34000000 diff --git a/aws_launch/docker/test_suite/region_files/single_region.tsv b/aws_launch/docker/test_suite/region_files/single_region.tsv new file mode 100644 index 00000000..f1bdb1d9 --- /dev/null +++ b/aws_launch/docker/test_suite/region_files/single_region.tsv @@ -0,0 +1 @@ +1 chr6:32000001-33000000 diff --git a/aws_launch/docker/test_suite/region_files/ten_shards_100_regions.tsv b/aws_launch/docker/test_suite/region_files/ten_shards_100_regions.tsv new file mode 100644 index 00000000..70f18df7 --- /dev/null +++ b/aws_launch/docker/test_suite/region_files/ten_shards_100_regions.tsv @@ -0,0 +1,100 @@ +1 chr1:1-1000000 +1 chr1:1000001-2000000 +1 chr1:2000001-3000000 +1 chr1:3000001-4000000 +1 chr1:4000001-5000000 +1 chr1:5000001-6000000 +1 chr1:6000001-7000000 +1 chr1:7000001-8000000 +1 chr1:8000001-9000000 +1 chr1:9000001-10000000 +2 chr1:10000001-11000000 +2 chr1:11000001-12000000 +2 chr1:12000001-13000000 +2 chr1:13000001-14000000 +2 chr1:14000001-15000000 +2 chr1:15000001-16000000 +2 chr1:16000001-17000000 +2 chr1:17000001-18000000 +2 chr1:18000001-19000000 +2 chr1:19000001-20000000 +3 chr1:20000001-21000000 +3 chr1:21000001-22000000 +3 chr1:22000001-23000000 +3 chr1:23000001-24000000 +3 chr1:24000001-25000000 +3 chr1:25000001-26000000 +3 chr1:26000001-27000000 +3 chr1:27000001-28000000 +3 chr1:28000001-29000000 +3 chr1:29000001-30000000 +4 chr1:30000001-31000000 +4 chr1:31000001-32000000 +4 chr1:32000001-33000000 +4 chr1:33000001-34000000 +4 chr1:34000001-35000000 +4 chr1:35000001-36000000 +4 chr1:36000001-37000000 +4 chr1:37000001-38000000 +4 chr1:38000001-39000000 +4 chr1:39000001-40000000 +5 chr1:40000001-41000000 +5 chr1:41000001-42000000 +5 chr1:42000001-43000000 +5 chr1:43000001-44000000 +5 chr1:44000001-45000000 +5 chr1:45000001-46000000 +5 chr1:46000001-47000000 +5 chr1:47000001-48000000 +5 chr1:48000001-49000000 +5 chr1:49000001-50000000 +6 chr1:50000001-51000000 +6 chr1:51000001-52000000 +6 chr1:52000001-53000000 +6 chr1:53000001-54000000 +6 chr1:54000001-55000000 +6 chr1:55000001-56000000 +6 chr1:56000001-57000000 +6 chr1:57000001-58000000 +6 chr1:58000001-59000000 +6 chr1:59000001-60000000 +7 chr1:60000001-61000000 +7 chr1:61000001-62000000 +7 chr1:62000001-63000000 +7 chr1:63000001-64000000 +7 chr1:64000001-65000000 +7 chr1:65000001-66000000 +7 chr1:66000001-67000000 +7 chr1:67000001-68000000 +7 chr1:68000001-69000000 +7 chr1:69000001-70000000 +8 chr1:70000001-71000000 +8 chr1:71000001-72000000 +8 chr1:72000001-73000000 +8 chr1:73000001-74000000 +8 chr1:74000001-75000000 +8 chr1:75000001-76000000 +8 chr1:76000001-77000000 +8 chr1:77000001-78000000 +8 chr1:78000001-79000000 +8 chr1:79000001-80000000 +9 chr1:80000001-81000000 +9 chr1:81000001-82000000 +9 chr1:82000001-83000000 +9 chr1:83000001-84000000 +9 chr1:84000001-85000000 +9 chr1:85000001-86000000 +9 chr1:86000001-87000000 +9 chr1:87000001-88000000 +9 chr1:88000001-89000000 +9 chr1:89000001-90000000 +10 chr1:90000001-91000000 +10 chr1:91000001-92000000 +10 chr1:92000001-93000000 +10 chr1:93000001-94000000 +10 chr1:94000001-95000000 +10 chr1:95000001-96000000 +10 chr1:96000001-97000000 +10 chr1:97000001-98000000 +10 chr1:98000001-99000000 +10 chr1:99000001-100000000 diff --git a/aws_launch/docker/test_suite/region_files/two_shards_four_regions.tsv b/aws_launch/docker/test_suite/region_files/two_shards_four_regions.tsv new file mode 100644 index 00000000..ce3899fe --- /dev/null +++ b/aws_launch/docker/test_suite/region_files/two_shards_four_regions.tsv @@ -0,0 +1,4 @@ +1 chr1:1-1000000 +1 chr1:1000001-2000000 +2 chr6:32000001-33000000 +2 chr6:33000001-34000000 diff --git a/aws_launch/docker/test_suite/run_test_suite.sh b/aws_launch/docker/test_suite/run_test_suite.sh new file mode 100644 index 00000000..1919c31f --- /dev/null +++ b/aws_launch/docker/test_suite/run_test_suite.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# Test suite to check RUFUS working with DAC + +# Fill in +ST002_1D_BCM_300x=/mnt/s3/test_files/ST002-1D_BCM_ill_DS300x0.bam +ST002_1D_BCM_300x_index=/mnt/s3/test_files/ST002-1D_BCM_ill_DS300x0.bam.bai +REF_DIR=/mnt/s3/references/ +HASH_DIR=/mnt/s3/rufus_resources/ +REGION_DIR=./region_files/ +PIPELINE_TEST=./pipeline_test.sh + +TEST_MOUNT="-v $ST002_1D_BCM_300x:$ST002_1D_BCM_300x \ +-v $ST002_1D_BCM_300x_index:$ST002_1D_BCM_300x_index \ +-v $REF_DIR:$REF_DIR \ +-v $HASH_DIR:$HASH_DIR" + +stop_container() { + docker stop rufus-worker +} +trap 'stop_container' EXIT + +export RUFUS_ROOT=/opt/RUFUS/ + +# Start container +USER_SPEC="$(id -u):$(id -g)" +CONTAINER_ID=$(docker run -d --rm --name rufus-worker \ + -u "${USER_SPEC}" \ + -v ".:/host" \ + --cap-add SYS_ADMIN \ + --device /dev/fuse \ + $input_mount_clause \ + $TEST_MOUNT \ + rufus:dac \ + tail -f /dev/null) + +# Test 1 +mkdir -p dac_single_region +bash "$PIPELINE_TEST" -s "$ST002_1D_BCM_300x" -r "$REF_DIR/GCA_000001405.15_GRCh38_no_alt_analysis_set.fa" -f "${REGION_DIR}/single_region.tsv" -i 1 -d "$HASH_DIR" -p "dac_single_region" -o "test_1" + +# Test 2 +mkdir -p dac_four_regions +bash "$PIPELINE_TEST" -s "$ST002_1D_BCM_300x" -r "$REF_DIR/GCA_000001405.15_GRCh38_no_alt_analysis_set.fa" -f "$REGION_DIR/four_regions.tsv" -i 1 -d "$HASH_DIR" -p "dac_four_regions" -o "test_2" + +# Test 3 +mkdir -p dac_two_shards_four_regions +bash "$PIPELINE_TEST" -s "$ST002_1D_BCM_300x" -r "$REF_DIR/GCA_000001405.15_GRCh38_no_alt_analysis_set.fa" -f "$REGION_DIR/two_shards_four_regions.tsv" -i 1 -d "$HASH_DIR" -p "dac_two_shards_four_regions" -o "test_3" +bash "$PIPELINE_TEST" -s "$ST002_1D_BCM_300x" -r "$REF_DIR/GCA_000001405.15_GRCh38_no_alt_analysis_set.fa" -f "$REGION_DIR/two_shards_four_regions.tsv" -i 2 -d "$HASH_DIR" -p "dac_two_shards_four_regions" -o "test_3" + +# Test 4 +mkdir -p dac_ten_shards_100_regions +for i in {1..10}; do + bash "$PIPELINE_TEST" -s "$ST002_1D_BCM_300x" -r "$REF_DIR/GCA_000001405.15_GRCh38_no_alt_analysis_set.fa" -f "$REGION_DIR/ten_shards_100_regions.tsv" -i $i -d "$HASH_DIR" -p "dac_ten_shards_100_regions" -o "test_4" +done + +# Count results +TEST_OUT="test_results.out" +echo -n "test_1.vcf.gz: " +bcftools view -H "dac_single_region/test_1.vcf.gz" | wc -l >> "$TEST_OUT" + +echo -n "test_2.vcf.gz: " +bcftools view -H "dac_four_regions/test_2.vcf.gz" | wc -l >> "$TEST_OUT" + +echo -n "test_3.vcf.gz: " +bcftools view -H "dac_two_shards_four_regions/test_3.vcf.gz" | wc -l >> "$TEST_OUT" + +echo -n "test_4.vcf.gz: " +bcftools view -H "dac_ten_shards_100_regions/test_4.vcf.gz" | wc -l >> "$TEST_OUT" + +# Check same data different shard numbers produce identical results +bcftools isec -p isecs -c none dac_four_regions/test_2.vcf.gz dac_two_shards_four_regions/test_3.vcf.gz +unique_single_shard_count=$(bcftools view -H 0000.vcf | wc -l) +unique_two_shard_count=$(bcftools view -H 0001.vcf | wc -l) +if [[ "$unique_single_shard_count" -eq 0 ]] && [[ "$unique_two_shard_count" -eq 0 ]]; then + echo "Intersection test passed" >> "$TEST_OUT" +else + echo "Intersection test failed: using two shards for the same regions does not equal using a single shard" >> "$TEST_OUT" +fi + +echo "Tests completed, see $TEST_OUT for results." \ No newline at end of file diff --git a/aws_launch/docker/upload_docker_rufus.sh b/aws_launch/docker/upload_docker_rufus.sh new file mode 100644 index 00000000..2ed19ce2 --- /dev/null +++ b/aws_launch/docker/upload_docker_rufus.sh @@ -0,0 +1,2 @@ +sudo docker tag 6024a461a448 stefinfection/rufus:latest +sudo docker push stefinfection/rufus:latest diff --git a/aws_launch/launch_rufus.sh b/aws_launch/launch_rufus.sh new file mode 100644 index 00000000..303cf6fd --- /dev/null +++ b/aws_launch/launch_rufus.sh @@ -0,0 +1,478 @@ +#!/bin/bash +# Run outside of container, no access to internal ENV + +# TODO: remove after rebuilding container 12pm 26Jan +#DEV_MOUNT="-v /home/ubuntu/RUFUS/runRufus.sh:/opt/RUFUS/runRufus.sh \ +# -v /home/ubuntu/RUFUS/post_process:/opt/RUFUS/post_process" +# -v /home/ubuntu/RUFUS/scripts:/opt/RUFUS/scripts \ +# -v /home/ubuntu/RUFUS/resource_helpers:/opt/RUFUS/resource_helpers \ +# -v /home/ubuntu/RUFUS/resources:/opt/RUFUS/resources \ +# -v /home/ubuntu/RUFUS/aws_launch/process_region_worker.sh:/opt/RUFUS/aws_launch/process_region_worker.sh \ +# -v /home/ubuntu/RUFUS/bin/RUFUS.interpret:/opt/RUFUS/bin/RUFUS.interpret" +#DEV_MOUNT="" + +stop_container() { + docker stop rufus-worker +} +trap 'stop_container' EXIT + +# Check for required argument +ENV_FILE="$1" +if [ -z "$ENV_FILE" ]; then + echo "Error: Please provide PATH_TO_RUFUS_ENV argument" >&2 + exit 1 +fi + +# Check RUFUS env file arg actually exists +if [ -f "$ENV_FILE" ]; then + ENV_FILE=$(realpath "$ENV_FILE") + set -a + source <(grep -v '^#' $ENV_FILE | grep -v '^[[:space:]]*$' | sed 's/\r$//') + set +a +else + echo "Error: $ENV_FILE file not found - please provide valid path to rufus.env file" + exit 1 +fi + +# If we don't have a working dir, set it to . +if [ -z "$WORKING_DIR" ]; then + WORKING_DIR=$(pwd) + WORKING_DIR=$(realpath "$WORKING_DIR") +fi + +# Make temp env file with realpaths for all input files +TEMP_ENV_FILE=${WORKING_DIR}/rufus_temp/temp_rufus.env +mkdir -p ${WORKING_DIR}/rufus_temp +touch $TEMP_ENV_FILE +cat $ENV_FILE > $TEMP_ENV_FILE + +# Checks for required arguments and formatting + bounds of integer arguments +check_inputs() { + # Check for all required variables to be filled in rufus.env + REQUIRED_VARS=(SUBJECT_FILE KMER_DEPTH_CUTOFF THREAD_LIMIT REFERENCE_FASTA RUFUS_DOCKER_IMAGE) + for var in "${REQUIRED_VARS[@]}"; do + if [ -z "${!var}" ]; then + echo "Error: Required variable $var is not set in rufus.env" + exit 1 + fi + done + + # Check for subject file existence + subject_path=$(realpath "${SUBJECT_FILE}") + if [ ! -f "$subject_path" ]; then + echo "Error: SUBJECT_FILE $subject_path not found" >&2 + exit 1 + else + echo "SUBJECT_FILE=$subject_path" >> $TEMP_ENV_FILE + fi + + # Check for control files existence + temp_ctrl_array=() + for control in "${CONTROL_FILE_ARRAY[@]}"; do + control_path=$(realpath "$control") + if [ ! -f "$control_path" ]; then + echo "Error: Control file $control_path not found" >&2 + exit 1 + else + temp_ctrl_array+=("$control_path") + fi + done + CONTROL_FILE_ARRAY=("${temp_ctrl_array[@]}") + echo "CONTROL_FILE_ARRAY=($temp_ctrl_array)" >> $TEMP_ENV_FILE + + # Check for reference fasta existence + reference_path=$(realpath "${REFERENCE_FASTA}") + if [ ! -f "$reference_path" ]; then + echo "Error: REFERENCE_FASTA $reference_path not found" >&2 + exit 1 + else + REFERENCE_FASTA=$reference_path + echo "REFERENCE_FASTA=$reference_path" >> $TEMP_ENV_FILE + fi + + # Check if region file provided, that it exists + if [ -n "$REGION_FILE" ]; then + region_path=$(realpath "${REGION_FILE}") + if [ ! -f "$region_path" ]; then + echo "Error: REGION_FILE $region_path not found. Please provide valid file or leave empty for whole genome mode." >&2 + exit 1 + else + REGION_FILE=$region_path + echo "REGION_FILE=$region_path" >> $TEMP_ENV_FILE + fi + fi + + # Check that thread limit is an int greater than 0 + if ! [[ "$THREAD_LIMIT" =~ ^[0-9]+$ ]] || [ "$THREAD_LIMIT" -le 0 ]; then + echo "Error: THREAD_LIMIT must be a positive integer" >&2 + exit 1 + fi + + + # Check that if one of the following are filled out, the other two also are - WINDOW_SIZE, JOB_THRESHOLD, REGION_FILE + if { [ -n "$WINDOW_SIZE" ] || [ -n "$JOB_THRESHOLD" ] || [ -n "$REGION_FILE" ]; } && { [ -z "$WINDOW_SIZE" ] || [ -z "$JOB_THRESHOLD" ] || [ -z "$REGION_FILE" ]; }; then + echo "Error: If one of WINDOW_SIZE, JOB_THRESHOLD, or REGION_FILE is filled out, all three must be provided for regional processing mode" >&2 + exit 1 + fi + + # Check that if job threshold is present, it is an int greater than 0 + if [ -n "$JOB_THRESHOLD" ]; then + if ! [[ "$JOB_THRESHOLD" =~ ^[0-9]+$ ]] || [ "$JOB_THRESHOLD" -le 0 ]; then + echo "Error: JOB_THRESHOLD must be a positive integer" >&2 + exit 1 + fi + fi + + # Check that kmer depth cutoff is an int and warn if less than 3 + if ! [[ "$KMER_DEPTH_CUTOFF" =~ ^[0-9]+$ ]]; then + echo "Error: KMER_DEPTH_CUTOFF must be a positive integer" >&2 + exit 1 + elif [ "$KMER_DEPTH_CUTOFF" -lt 3 ]; then + echo "Warning: KMER_DEPTH_CUTOFF is set to less than 3, which may lead to increased false positives" >&2 + fi + + # Check if KMER_LENGTH filled out, is an int and warn if not 25 + if [ -n "$KMER_LENGTH" ]; then + if ! [[ "$KMER_LENGTH" =~ ^[0-9]+$ ]]; then + echo "Error: KMER_LENGTH must be a positive integer" >&2 + exit 1 + elif [ "$KMER_LENGTH" -ne 25 ]; then + echo "Warning: KMER_LENGTH is set to $KMER_LENGTH, RUFUS has been robustly tested with a KMER_LENGTH of 25 and is recommended" >&2 + fi + else + KMER_LENGTH=25 + echo "KMER_LENGTH=$KMER_LENGTH" >> $TEMP_ENV_FILE + fi + + # Check if WINDOW_SIZE filled out, if it is, make sure an int and is 1000 + if [ -n "$WINDOW_SIZE" ]; then + if ! [[ "$WINDOW_SIZE" =~ ^[0-9]+$ ]]; then + echo "Error: WINDOW_SIZE must be a positive integer" >&2 + exit 1 + elif [ "$WINDOW_SIZE" -ne 1000 ]; then + echo "ERROR: WINDOW_SIZE is set to $WINDOW_SIZE - must be either 1000 or empty" >&2 + exit 1 + fi + fi + + echo "WORKING_DIR=$WORKING_DIR" >> $TEMP_ENV_FILE +} +export -f check_inputs + +# Check for correct controls setup and returns paths needed for mounting if necessary +# Sets up link to realpath of file within provided directory, because may be a symlink +# WARNING: all Jhash files must be in the same realpath directory for mounting to work correctly +set_up_controls() { + # Check for controls here and notify if using internal + if [ ${#CONTROL_FILE_ARRAY[@]} -eq 0 ]; then + echo "No paired controls provided, running RUFUS in internal control mode..." >&2 + fi + + local mount_clause="" + # Make sure the local directory exists if provided + if [ ! -z "${CONTROL_HASH_LOCAL_DIR}" ]; then + control_path=$(realpath "${CONTROL_HASH_LOCAL_DIR}") + if [ ! -d "${control_path}" ]; then + echo "Error: CONTROL_HASH_LOCAL_DIR ${control_path} does not exist. Please ensure directory exists or leave CONTROL_HASH_LOCAL_DIR empty for S3 fetching." >&2 + return 1 + else + # Make sure directory has at least one *.Jhash file in it + shopt -s nullglob + jhash_files=("${control_path}"/*.Jhash) + shopt -u nullglob + + if [ ${#jhash_files[@]} -eq 0 ]; then + echo "Error: CONTROL_HASH_LOCAL_DIR ${control_path} does not contain any *.Jhash files. Please ensure directory has Jhash files or leave CONTROL_HASH_LOCAL_DIR empty for S3 fetching." >&2 + return 1 + fi + + # Verify at least one symlink target is accessible + accessible=false + for file in "${jhash_files[@]}"; do + if [ -f "$file" ]; then + file_path=$(realpath "$file") + parent_dir_file=$(dirname "$file_path") + # Mount to realpath of file rather than parent dir because file may be symlinked + mount_clause="-v ${parent_dir_file}:${parent_dir_file} " + echo "CONTROL_HASH_LOCAL_DIR=${parent_dir_file}" >> $TEMP_ENV_FILE + accessible=true + break + fi + done + + if [ "$accessible" = false ]; then + echo "Error: *.Jhash files found but none are accessible (broken symlinks or goofys issue)." >&2 + return 1 + fi + fi + fi + + # If we have paired controls provided, also use those + if [ "${#CONTROL_FILE_ARRAY[@]}" -ne 0 ]; then + # Concatenate controls into -c delimited string + ctrl_arg="" + for control in "${CONTROL_FILE_ARRAY[@]}"; do + ctrl_path=$(realpath "$control") + ctrl_arg+="-v $ctrl_path:$ctrl_path:ro " + + # Add index or error if not found + if [[ "$ctrl_basename" == *.bam ]]; then + if [ -f "${ctrl_path}.bai" ]; then + ctrl_arg+="-v ${ctrl_path}.bai:${ctrl_path}.bai:ro " + elif [ -f "${ctrl_path%.bam}.bai" ]; then + bai_path="${ctrl_path%.bam}.bai" + ctrl_arg+="-v $bai_path:$bai_path:ro " + else + echo "ERROR: Could not find index file for control BAM ${ctrl_path}. Please ensure .bai file exists." >&2 + return 1 + fi + elif [[ "$ctrl_basename" == *.cram ]]; then + if [ -f "${ctrl_path}.crai" ]; then + ctrl_arg+="-v ${ctrl_path}.crai:${ctrl_path}.crai:ro " + elif [ -f "${ctrl_path%.cram}.crai" ]; then + crai_path="${ctrl_path%.cram}.crai" + ctrl_arg+="-v $crai_path:$crai_path:ro " + else + echo "ERROR: Could not find index file for control CRAM ${ctrl_path}. Please ensure .crai file exists." >&2 + return 1 + fi + fi + done + mount_clause+="$ctrl_arg" + fi + echo "$mount_clause" +} +export -f set_up_controls + +# Check for correct 1000G setup and returns paths needed for mounting if necessary +# Sets up link to realpath of file within provided directory, because may be a symlink +# WARNING: all Jhash files must be in the same realpath directory for mounting to work correctly +set_up_kg1() { + local mount_clause="" + + # Notify if not removing 1000G variants + if [ "$NO_KG1_REMOVAL" == "true" ] || [ "$NO_KG1_REMOVAL" == "TRUE" ]; then + echo "Warning: not removing common population variants in the 1000G cohort" >&2 + else + # Make sure the local directory exists if provided + if [ ! -z "${KG1_HASH_LOCAL_DIR}" ]; then + kg1_path=$(realpath "${KG1_HASH_LOCAL_DIR}") + if [ ! -d "${kg1_path}" ]; then + echo "Error: KG1_HASH_LOCAL_DIR ${kg1_path} does not exist. Please ensure directory exists or leave KG1_HASH_LOCAL_DIR empty for S3 fetching." >&2 + return 1 + else + # Make sure directory has at least one *.Jhash file in it + shopt -s nullglob + jhash_files=("${kg1_path}"/*.Jhash) + shopt -u nullglob + if [ ${#jhash_files[@]} -eq 0 ]; then + echo "Error: KG1_HASH_LOCAL_DIR ${kg1_path} does not contain any *.Jhash files. Please ensure directory has Jhash files or leave KG1_HASH_LOCAL_DIR empty for S3 fetching." >&2 + return 1 + fi + + # Verify at least one symlink target is accessible + accessible=false + for file in "${jhash_files[@]}"; do + if [ -f "$file" ]; then + file_path=$(realpath "$file") + parent_dir_file=$(dirname "$file_path") + # Mount to realpath of file rather than parent dir because file may be symlinked + mount_clause="-v ${parent_dir_file}:${parent_dir_file} " + echo "KG1_HASH_LOCAL_DIR=${parent_dir_file}" >> $TEMP_ENV_FILE + accessible=true + break + fi + done + + if [ "$accessible" = false ]; then + echo "Error: *.Jhash files found but none are accessible (broken symlinks or goofys issue)." >&2 + return 1 + fi + fi + fi + fi + echo "$mount_clause" +} +export -f set_up_kg1 + +# Echoes the BWA index files missing for the given reference, one per line. +# Empty output means the reference is fully indexed. +# +# runRufus.sh receives this path verbatim as -r/-cr and prefers the +# extension-stripped prefix when .sa exists, falling back to the +# reference path itself, so resolve the same prefix it will actually load. +# The .fai hangs off the decompressed name, which is what samtools faidx +# indexes and what build_bwa_indexes.sh produces. +missing_ref_indexes() { + local ref_path="$1" + local index_base="$ref_path" + local fai_target="${ref_path%.gz}" + + if [[ -e "${ref_path%.*}.sa" ]]; then + index_base="${ref_path%.*}" + fi + + for ext in sa bwt pac amb ann; do + [[ -e "${index_base}.${ext}" ]] || echo "${index_base}.${ext}" + done + [[ -e "${fai_target}.fai" ]] || echo "${fai_target}.fai" +} +export -f missing_ref_indexes + +set_up_ref() { + + local ref_path=$(realpath "${REFERENCE_FASTA}") # Absolute path on host machine + local path_to_ref="$(dirname ${ref_path})" # Directory on host machine + + local build_refs="FALSE" + if [[ -n "$(missing_ref_indexes "$ref_path")" ]]; then + build_refs="TRUE" + fi + + # We'll assume indexes are in same dir as reference unless found otherwise + local mount_clause="-v ${path_to_ref}:${path_to_ref}:ro " + if [ "$build_refs" == "TRUE" ]; then + # Indexes are written next to the reference, so this cannot be read-only + mount_clause="-v ${path_to_ref}:${path_to_ref} " + fi + + echo "$mount_clause|$build_refs" +} +export -f set_up_ref + +# Start work +check_inputs +IFS='|' read -r ref_mount build_refs < <(set_up_ref) +control_mount=$(set_up_controls) || exit 1 +kg1_mount=$(set_up_kg1) || exit 1 +subject_path=$(realpath "${SUBJECT_FILE}") +input_mount_clause="$ref_mount $control_mount $kg1_mount -v ${subject_path}:${subject_path}:ro " + +# Check for subject index if bam or cram +if [[ "$subject_path" == *.bam ]]; then + if [ -f "${subject_path}.bai" ]; then + input_mount_clause+="-v ${subject_path}.bai:${subject_path}.bai:ro " + elif [ -f "${subject_path%.bam}.bai" ]; then + bai_path="${subject_path%.bam}.bai" + input_mount_clause+="-v $bai_path:$bai_path:ro " + else + echo "ERROR: Could not find index file for subject BAM ${subject_path}. Please ensure .bai file exists." >&2 + exit 1 + fi +elif [[ "$subject_path" == *.cram ]]; then + if [ -f "${subject_path}.crai" ]; then + input_mount_clause+="-v ${subject_path}.crai:${subject_path}.crai:ro " + elif [ -f "${subject_path%.cram}.crai" ]; then + crai_path="${subject_path%.cram}.crai" + input_mount_clause+="-v $crai_path:$crai_path:ro " + else + echo "ERROR: Could not find index file for subject CRAM ${subject_path}. Please ensure .crai file exists." >&2 + exit 1 + fi +fi + +USER_SPEC="$(id -u):$(id -g)" +CONTAINER_ID=$(docker run -d --rm --name rufus-worker \ + -u "${USER_SPEC}" \ + -v "$(pwd):/work" \ + -w /work \ + --cap-add SYS_ADMIN \ + --device /dev/fuse \ + $input_mount_clause \ + $DEV_MOUNT \ + $RUFUS_DOCKER_IMAGE \ + tail -f /dev/null) +exit +start_time=$(date +%s) + +# Make resource directories referenced during run +docker exec -u "${USER_SPEC}" ${CONTAINER_ID} mkdir -p /work/rufus_temp +docker exec -u "${USER_SPEC}" ${CONTAINER_ID} mkdir -p /work/rufus_supplementals +docker exec -u "${USER_SPEC}" ${CONTAINER_ID} mkdir -p /work/rufus_supplementals/logs + +# TODO: can I get rid of these? +docker exec -u "${USER_SPEC}" ${CONTAINER_ID} mkdir -p /work/control_hashes +docker exec -u "${USER_SPEC}" ${CONTAINER_ID} mkdir -p /work/kg1_hashes + +# Write commands for final vcf (do inside container so have access to RUFUS versioning) +# get RUFUS_ROOT from inside the container +# get RUFUS_ROOT from inside the container +RROOT=$(docker exec "${CONTAINER_ID}" bash -lc 'printf "%s" "$RUFUS_ROOT"') || { + echo "Failed to query RUFUS_ROOT from container ${CONTAINER_ID}" >&2 + exit 1 +} + +if [ -z "$RROOT" ]; then + echo "RUFUS_ROOT not set in container ${CONTAINER_ID}" >&2 + exit 1 +fi + +# TODO: this needs to be removed because only written outside container and CWL will not do this +#docker exec -u "${USER_SPEC}" "${CONTAINER_ID}" bash ${RROOT}/resource_helpers/write_command_args.sh "${CONTAINER_ID}" + +# Pull out worker script +PR_WORKER="process_region_worker.sh" + +# TODO: change back after rebuild 12pm 26Jan +#docker cp "${CONTAINER_ID}:${RROOT}/aws_launch/process_region_worker.sh" "${PR_WORKER}" +cp ~/RUFUS/aws_launch/process_region_worker.sh "${PR_WORKER}" + +# Check for BWA indexes and create if necessary +if [ "$build_refs" == "TRUE" ]; then + echo "Generating BWA indexes for reference fasta (roughly an hour for a human-sized reference)..." + if ! docker exec -u "${USER_SPEC}" ${CONTAINER_ID} bash ${RROOT}/resource_helpers/build_bwa_indexes.sh "${REFERENCE_FASTA}"; then + echo "ERROR: failed to build BWA indexes for ${REFERENCE_FASTA}" >&2 + exit 1 + fi +fi + +# Confirm the indexes RUFUS will load are actually present before queueing any work. +# Covers both a silently incomplete build above and indexes removed since set_up_ref ran. +# Without this the missing index only surfaces at the bwa mem step, which is hours into +# every region job. +missing_indexes=$(missing_ref_indexes "${REFERENCE_FASTA}") +if [ -n "$missing_indexes" ]; then + echo "ERROR: reference ${REFERENCE_FASTA} is missing required index files:" >&2 + while IFS= read -r missing_index; do + echo " $missing_index" >&2 + done <<< "$missing_indexes" + echo "RUFUS aligns candidate reads with BWA and cannot run without these." >&2 + echo "Build them with:" >&2 + echo " bash \${RUFUS_ROOT}/resource_helpers/build_bwa_indexes.sh ${REFERENCE_FASTA}" >&2 + exit 1 +fi + +# Start work +echo "Starting RUFUS job(s)..." +if [ -n "$REGION_FILE" ]; then + parallel -j "$JOB_THRESHOLD" bash ${PR_WORKER} "$CONTAINER_ID" "$TEMP_ENV_FILE" {} :::: "$REGION_FILE" +else + bash /work/process_region_worker.sh "$CONTAINER_ID" "$TEMP_ENV_FILE" "" +fi + +ref_base=$(basename ${REFERENCE_FASTA}) +echo "All RUFUS regional jobs completed. Concatenating into a single vcf..." + +# Concatenate all region vcfs +subject_string=$(basename $SUBJECT_FILE) +FINAL_VCF="RUFUS.Final.${subject_string}.combined.vcf.gz" +ls temp.RUFUS.Final*vcf.gz > concat.list +bcftools concat -f concat.list -Oz -o $FINAL_VCF +bcftools index "$FINAL_VCF.gz" + +# Clean up +rm -rf rufus_temp +rm -f rufus_supplementals/rufus_command_*txt +rm -rf Intermediates +rm -rf TempOverlap +rm -rf kg1_hashes +rm -rf control_hashes +find . -maxdepth 1 -type f -name "temp.RUFUS*vcf.gz*" -delete +rm concat.list + +# Stop container +echo "Shutting down RUFUS container..." + +end_time=$(date +%s) +elapsed=$((end_time - start_time)) +echo "RUFUS completed. Total run time: $elapsed" diff --git a/aws_launch/process_region_worker.sh b/aws_launch/process_region_worker.sh new file mode 100755 index 00000000..ab7c36bb --- /dev/null +++ b/aws_launch/process_region_worker.sh @@ -0,0 +1,164 @@ +#!/bin/bash + +# Env override +: "${RUFUS_ROOT:=/opt/RUFUS}" + +# Arguments +CONTAINER_ID="$1" +ENV_FILE="$2" +REGION="$3" + +# Constants +DEFAULT_KG1_HASH_VERSION="v3.0" +DEFAULT_CONTROL_HASH_VERSION="v1.0" + +# Import env file now that we're inside of container +set -a +source <(grep -v '^#' $ENV_FILE | grep -v '^[[:space:]]*$' | sed 's/\r$//') +set +a + +# Resolves a hash file for a given region and hash type. +# Checks local directory first (via shared resolve_hashes.sh), falls back to S3 download. +# +# Args: +# $1 - region: region string (e.g., chr1:1-1000000) or empty for whole-genome +# $2 - geo_type: "local" to check local dir first, "remote" for S3 only +# $3 - hash_type: e.g., "kg1", "control" +# +# Returns: prints resolved hash file path to stdout +get_hash() { + local region="$1" + local geo_type="$2" + local hash_type="$3" + local hash_type_upper + hash_type_upper=$(echo "$hash_type" | tr '[:lower:]' '[:upper:]') + + local fmtd_region + if [ -z "$region" ]; then + fmtd_region="wg" + else + fmtd_region=$(echo "$region" | tr ':-' '_') + fi + + # Try local resolution via shared resolve_hashes.sh + if [ "$geo_type" == "local" ]; then + local env_var="${hash_type_upper}_HASH_LOCAL_DIR" + local host_dir="${!env_var}" + + local resolved + resolved=$(docker exec "$CONTAINER_ID" bash -c \ + "source ${RUFUS_ROOT}/resource_helpers/resolve_hashes.sh && resolve_hash_for_region '${host_dir}' '${fmtd_region}'" 2>/dev/null) + + if [ $? -eq 0 ] && [ -n "$resolved" ]; then + echo "Using local ${hash_type} hash for ${fmtd_region}: $resolved" >&2 + echo "$resolved" + return 0 + fi + + echo "Could not find local ${hash_type} hash for ${fmtd_region} in ${host_dir}. Falling back to S3." >&2 + fi + + # S3 download fallback + local version_var="${hash_type_upper}_HASH_VERSION" + local hash_version="${!version_var}" + if [ -z "$hash_version" ]; then + local default_var="DEFAULT_${hash_type_upper}_HASH_VERSION" + hash_version="${!default_var}" + fi + + echo "Fetching version ${hash_version} ${hash_type} hash for ${fmtd_region} from S3" >&2 + docker exec "$CONTAINER_ID" bash -c \ + "cd /home/ubuntu && bash ${RUFUS_ROOT}/resource_helpers/download_hash.sh '${hash_type}' '${hash_version}' '${fmtd_region}'" >&2 \ + || { echo "ERROR: Failed to download ${hash_type} hash for ${fmtd_region} from S3" >&2; return 1; } + + echo "/home/ubuntu/${fmtd_region}_${hash_type}_${hash_version}.Jhash" +} +export -f get_hash + + +# Compose control argument of both or one of control hashes and paired control files +ctrl_arg="" +if [ "$CONTROL_HASH_LOCAL_DIR" != "" ]; then + control_hash=$(get_hash $REGION "local" "control") || exit 1 + ctrl_arg+="-e $control_hash " +elif [ "$CONTROL_HASH_VERSION" != "" ]; then + echo "Using control hash version: $CONTROL_HASH_VERSION" >&2 + control_hash=$(get_hash $REGION "remote" "control") || exit 1 + ctrl_arg+="-e $control_hash " +elif [ "${#CONTROL_FILE_ARRAY[@]}" -eq 0 ]; then + echo "No local control hashes, paired controls, or control hash version provided, fetching default $DEFAULT_CONTROL_HASH_VERSION hashes piecemeal" >&2 + CONTROL_HASH_VERSION="$DEFAULT_CONTROL_HASH_VERSION" + control_hash=$(get_hash $REGION "remote" "control") || exit 1 + ctrl_arg+="-e $control_hash " +fi + +# If we have paired controls provided, also use those +if [ "${#CONTROL_FILE_ARRAY[@]}" -ne 0 ]; then + # Concatenate controls into -c delimited string + for control in "${CONTROL_FILE_ARRAY[@]}"; do + ctrl_arg+="-c $control " + done +fi + +# Compose kg1 hash argument +if [ "$KG1_HASH_LOCAL_DIR" != "" ]; then + kg1_hash=$(get_hash $REGION "local" "kg1") || exit 1 + kg1_hash_arg="-e $kg1_hash" +elif [ "$KG1_HASH_VERSION" != "" ]; then + kg1_hash=$(get_hash $REGION "remote" "kg1") || exit 1 + kg1_hash_arg="-e $kg1_hash" +fi + +ref_arg="-r $REFERENCE_FASTA" +# If subject_file ends with cram, need to change region_arg to -cr +if [[ "$SUBJECT_FILE" == *.cram ]]; then + ref_arg="-cr $REFERENCE_FASTA" +fi + +# Region arg +if [ "$REGION" != "" ]; then + region_arg="-R $REGION" + fmtd_reg=$(echo "$REGION" | tr ':-' '_') +else + fmtd_reg="whole_genome" +fi + +cd $WORKING_DIR + +echo "Running RUFUS for $REGION on $SUBJECT_FILE..." + +RUFUS_CMD="$RUFUS_ROOT/runRufus.sh \ + -s $SUBJECT_FILE \ + $ctrl_arg \ + $ref_arg \ + -m $KMER_DEPTH_CUTOFF \ + -k $KMER_LENGTH \ + -t $THREAD_LIMIT \ + $OTHER_FLAGS \ + $kg1_hash_arg \ + $region_arg" + +docker exec "$CONTAINER_ID" bash -c \ + "$RUFUS_CMD \ + > rufus_supplementals/logs/${fmtd_reg}.out \ + 2> rufus_supplementals/logs/${fmtd_reg}.err" + +# Clean up hash files +if [ "$REGION" == "" ]; then + if [ -f "/home/ubuntu/downloaded_control_hashes/*wg*.Jhash" ]; then + docker exec ${CONTAINER_ID} rm /home/ubuntu/downloaded_control_hashes/*wg*control*.Jhash + fi + + if [ -f "/home/ubuntu/downloaded_kg1_hashes/*wg*.Jhash" ]; then + docker exec ${CONTAINER_ID} rm /home/ubuntu/downloaded_kg1_hashes/*wg*.Jhash + fi + +else + if [ -f "/home/ubuntu/downloaded_control_hashes/*$fmtd_reg*.Jhash" ]; then + docker exec ${CONTAINER_ID} rm /home/ubuntu/downloaded_control_hashes/*$fmtd_reg*control*.Jhash + fi + + if [ -f "/home/ubuntu/downloaded_kg1_hashes/*$fmtd_reg*.Jhash" ]; then + docker exec ${CONTAINER_ID} rm /home/ubuntu/downloaded_kg1_hashes/*$fmtd_reg*.Jhash + fi +fi \ No newline at end of file diff --git a/externals/external/CMakeLists.txt~ b/aws_launch/resources/checksums.md5 similarity index 100% rename from externals/external/CMakeLists.txt~ rename to aws_launch/resources/checksums.md5 diff --git a/aws_launch/resources/download_rufus_resources.sh b/aws_launch/resources/download_rufus_resources.sh new file mode 100644 index 00000000..9cebf15d --- /dev/null +++ b/aws_launch/resources/download_rufus_resources.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -e + +DEST_DIR="${1:-./rufus_resources}" + +# Constants +MANIFEST_URL=https://s3.us-east-1.amazonaws.com/rufus.marth.lab/public_access_data/rufus_resource_manifest.txt + +echo "Downloading Rufus resources to $DEST_DIR..." + +if command -v aws &> /dev/null; then + echo "Using AWS CLI..." + aws s3 sync s3://rufus.marth.lab/public_access_data/rufus_resources/ "$DEST_DIR" --no-sign-request +elif command -v rclone &> /dev/null; then + echo "Using rclone..." + rclone copy :s3:rufus.marth.lab/public_access_data/rufus_resources/ ${DEST_DIR}/rufus_resources/ --s3-provider=AWS --s3-region=us-east-1 --s3-no-check-bucket --s3-env-auth=false -P +else + # Prompt user for path to file manifest + echo "Neither AWS CLI nor rclone found. Trying wget." + FILE_LIST=$(mktemp) + wget -O "$FILE_LIST" $MANIFEST_URL + + mkdir -p ${DEST_DIR}/rufus_resources + while IFS= read -r file; do + wget -P ${DEST_DIR}/rufus_resources https://rufus.marth.lab.s3.us-east-1.amazonaws.com/"$file" + done < $FILE_LIST +fi + +echo "Download complete!" diff --git a/aws_launch/resources/generate_manifest.sh b/aws_launch/resources/generate_manifest.sh new file mode 100644 index 00000000..cb033119 --- /dev/null +++ b/aws_launch/resources/generate_manifest.sh @@ -0,0 +1,131 @@ +#!/bin/bash + +# Script to generate a manifest file for Rufus resources +# This creates a user-friendly file listing with sizes and download URLs + +BUCKET="rufus.marth.lab" +PREFIX="public_access_data/rufus_resources/" +REGION="us-east-1" +OUTPUT_DIR="." + +echo "Generating manifest for s3://${BUCKET}/${PREFIX}..." + +# Generate basic file listing with sizes +echo "Creating file listing..." +aws s3 ls s3://${BUCKET}/${PREFIX} --recursive --no-sign-request --human-readable > "${OUTPUT_DIR}/file_listing_human.txt" + +# Generate machine-readable listing (bytes) +aws s3 ls s3://${BUCKET}/${PREFIX} --recursive --no-sign-request > "${OUTPUT_DIR}/file_listing_raw.txt" + +# Create a formatted manifest with download URLs +echo "Creating formatted manifest..." +cat > "${OUTPUT_DIR}/MANIFEST.md" << 'EOF' +# Rufus Resources File Manifest + +This manifest lists all available files for download. + +## Quick Download Commands + +### Download a specific file: +```bash +wget https://rufus.marth.lab.s3.us-east-1.amazonaws.com/public_access_data/rufus_resources/ +``` + +### Download all files: +```bash +aws s3 sync s3://rufus.marth.lab/public_access_data/rufus_resources/ ./rufus_resources/ --no-sign-request +``` + +--- + +## Available Files + +EOF + +# Parse the file listing and create markdown table +echo "| File | Size | Download URL |" >> "${OUTPUT_DIR}/MANIFEST.md" +echo "|------|------|--------------|" >> "${OUTPUT_DIR}/MANIFEST.md" + +while read -r line; do + # Parse: date time size filename + if [[ $line =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2} ]]; then + date=$(echo "$line" | awk '{print $1}') + time=$(echo "$line" | awk '{print $2}') + size=$(echo "$line" | awk '{print $3}') + filename=$(echo "$line" | awk '{$1=$2=$3=""; print $0}' | sed 's/^ *//') + + # Create relative filename (remove prefix) + rel_filename="${filename#${PREFIX}}" + + # Create download URL + url="https://${BUCKET}.s3.${REGION}.amazonaws.com/${filename}" + + # Add to markdown table + echo "| \`${rel_filename}\` | ${size} | [Download](${url}) |" >> "${OUTPUT_DIR}/MANIFEST.md" + fi +done < "${OUTPUT_DIR}/file_listing_human.txt" + +# Create a simple text file list for wget +echo "Creating wget download list..." +awk '{print $4}' "${OUTPUT_DIR}/file_listing_raw.txt" | while read -r file; do + echo "https://${BUCKET}.s3.${REGION}.amazonaws.com/${file}" +done > "${OUTPUT_DIR}/download_urls.txt" + +# Create wget script +cat > "${OUTPUT_DIR}/download_all_wget.sh" << 'WGET_EOF' +#!/bin/bash +# Download all Rufus resources using wget + +set -e + +DEST_DIR="${1:-./rufus_resources}" +mkdir -p "$DEST_DIR" + +echo "Downloading Rufus resources to $DEST_DIR..." +echo "This will download approximately 50GB of data." +read -p "Continue? (y/n) " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 +fi + +wget -P "$DEST_DIR" -i download_urls.txt -nc -c + +echo "Download complete!" +WGET_EOF + +chmod +x "${OUTPUT_DIR}/download_all_wget.sh" + +# Generate checksums (optional, can be slow for large files) +read -p "Generate MD5 checksums? This may take a while for large files. (y/n) " -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "Generating MD5 checksums..." + cat > "${OUTPUT_DIR}/checksums.md5" << 'CHECKSUM_HEADER' +# MD5 Checksums for Rufus Resources +# Verify downloads with: md5sum -c checksums.md5 +CHECKSUM_HEADER + + awk '{print $4}' "${OUTPUT_DIR}/file_listing_raw.txt" | while read -r file; do + echo "Computing checksum for ${file}..." + checksum=$(aws s3 cp s3://${BUCKET}/"${file}" - --no-sign-request | md5sum | awk '{print $1}') + rel_file="${file#${PREFIX}}" + echo "${checksum} ${rel_file}" >> "${OUTPUT_DIR}/checksums.md5" + done + echo "Checksums saved to checksums.md5" +fi + +echo "" +echo "Manifest generation complete!" +echo "" +echo "Generated files:" +echo " - MANIFEST.md : Human-readable file listing with download links" +echo " - file_listing_human.txt: File listing with human-readable sizes" +echo " - file_listing_raw.txt : File listing with sizes in bytes" +echo " - download_urls.txt : Plain text list of download URLs" +echo " - download_all_wget.sh : Executable script to download all files with wget" +if [[ $REPLY =~ ^[Yy]$ ]]; then + echo " - checksums.md5 : MD5 checksums for verification" +fi +echo "" +echo "You can now commit these files to your repository for users to reference." diff --git a/aws_launch/resources/grch38_1mb_regions.txt b/aws_launch/resources/grch38_1mb_regions.txt new file mode 100644 index 00000000..b74bccac --- /dev/null +++ b/aws_launch/resources/grch38_1mb_regions.txt @@ -0,0 +1,3103 @@ +chr1:1-1000000 +chr1:1000001-2000000 +chr1:2000001-3000000 +chr1:3000001-4000000 +chr1:4000001-5000000 +chr1:5000001-6000000 +chr1:6000001-7000000 +chr1:7000001-8000000 +chr1:8000001-9000000 +chr1:9000001-10000000 +chr1:10000001-11000000 +chr1:11000001-12000000 +chr1:12000001-13000000 +chr1:13000001-14000000 +chr1:14000001-15000000 +chr1:15000001-16000000 +chr1:16000001-17000000 +chr1:17000001-18000000 +chr1:18000001-19000000 +chr1:19000001-20000000 +chr1:20000001-21000000 +chr1:21000001-22000000 +chr1:22000001-23000000 +chr1:23000001-24000000 +chr1:24000001-25000000 +chr1:25000001-26000000 +chr1:26000001-27000000 +chr1:27000001-28000000 +chr1:28000001-29000000 +chr1:29000001-30000000 +chr1:30000001-31000000 +chr1:31000001-32000000 +chr1:32000001-33000000 +chr1:33000001-34000000 +chr1:34000001-35000000 +chr1:35000001-36000000 +chr1:36000001-37000000 +chr1:37000001-38000000 +chr1:38000001-39000000 +chr1:39000001-40000000 +chr1:40000001-41000000 +chr1:41000001-42000000 +chr1:42000001-43000000 +chr1:43000001-44000000 +chr1:44000001-45000000 +chr1:45000001-46000000 +chr1:46000001-47000000 +chr1:47000001-48000000 +chr1:48000001-49000000 +chr1:49000001-50000000 +chr1:50000001-51000000 +chr1:51000001-52000000 +chr1:52000001-53000000 +chr1:53000001-54000000 +chr1:54000001-55000000 +chr1:55000001-56000000 +chr1:56000001-57000000 +chr1:57000001-58000000 +chr1:58000001-59000000 +chr1:59000001-60000000 +chr1:60000001-61000000 +chr1:61000001-62000000 +chr1:62000001-63000000 +chr1:63000001-64000000 +chr1:64000001-65000000 +chr1:65000001-66000000 +chr1:66000001-67000000 +chr1:67000001-68000000 +chr1:68000001-69000000 +chr1:69000001-70000000 +chr1:70000001-71000000 +chr1:71000001-72000000 +chr1:72000001-73000000 +chr1:73000001-74000000 +chr1:74000001-75000000 +chr1:75000001-76000000 +chr1:76000001-77000000 +chr1:77000001-78000000 +chr1:78000001-79000000 +chr1:79000001-80000000 +chr1:80000001-81000000 +chr1:81000001-82000000 +chr1:82000001-83000000 +chr1:83000001-84000000 +chr1:84000001-85000000 +chr1:85000001-86000000 +chr1:86000001-87000000 +chr1:87000001-88000000 +chr1:88000001-89000000 +chr1:89000001-90000000 +chr1:90000001-91000000 +chr1:91000001-92000000 +chr1:92000001-93000000 +chr1:93000001-94000000 +chr1:94000001-95000000 +chr1:95000001-96000000 +chr1:96000001-97000000 +chr1:97000001-98000000 +chr1:98000001-99000000 +chr1:99000001-100000000 +chr1:100000001-101000000 +chr1:101000001-102000000 +chr1:102000001-103000000 +chr1:103000001-104000000 +chr1:104000001-105000000 +chr1:105000001-106000000 +chr1:106000001-107000000 +chr1:107000001-108000000 +chr1:108000001-109000000 +chr1:109000001-110000000 +chr1:110000001-111000000 +chr1:111000001-112000000 +chr1:112000001-113000000 +chr1:113000001-114000000 +chr1:114000001-115000000 +chr1:115000001-116000000 +chr1:116000001-117000000 +chr1:117000001-118000000 +chr1:118000001-119000000 +chr1:119000001-120000000 +chr1:120000001-121000000 +chr1:121000001-122000000 +chr1:122000001-123000000 +chr1:123000001-124000000 +chr1:124000001-125000000 +chr1:125000001-126000000 +chr1:126000001-127000000 +chr1:127000001-128000000 +chr1:128000001-129000000 +chr1:129000001-130000000 +chr1:130000001-131000000 +chr1:131000001-132000000 +chr1:132000001-133000000 +chr1:133000001-134000000 +chr1:134000001-135000000 +chr1:135000001-136000000 +chr1:136000001-137000000 +chr1:137000001-138000000 +chr1:138000001-139000000 +chr1:139000001-140000000 +chr1:140000001-141000000 +chr1:141000001-142000000 +chr1:142000001-143000000 +chr1:143000001-144000000 +chr1:144000001-145000000 +chr1:145000001-146000000 +chr1:146000001-147000000 +chr1:147000001-148000000 +chr1:148000001-149000000 +chr1:149000001-150000000 +chr1:150000001-151000000 +chr1:151000001-152000000 +chr1:152000001-153000000 +chr1:153000001-154000000 +chr1:154000001-155000000 +chr1:155000001-156000000 +chr1:156000001-157000000 +chr1:157000001-158000000 +chr1:158000001-159000000 +chr1:159000001-160000000 +chr1:160000001-161000000 +chr1:161000001-162000000 +chr1:162000001-163000000 +chr1:163000001-164000000 +chr1:164000001-165000000 +chr1:165000001-166000000 +chr1:166000001-167000000 +chr1:167000001-168000000 +chr1:168000001-169000000 +chr1:169000001-170000000 +chr1:170000001-171000000 +chr1:171000001-172000000 +chr1:172000001-173000000 +chr1:173000001-174000000 +chr1:174000001-175000000 +chr1:175000001-176000000 +chr1:176000001-177000000 +chr1:177000001-178000000 +chr1:178000001-179000000 +chr1:179000001-180000000 +chr1:180000001-181000000 +chr1:181000001-182000000 +chr1:182000001-183000000 +chr1:183000001-184000000 +chr1:184000001-185000000 +chr1:185000001-186000000 +chr1:186000001-187000000 +chr1:187000001-188000000 +chr1:188000001-189000000 +chr1:189000001-190000000 +chr1:190000001-191000000 +chr1:191000001-192000000 +chr1:192000001-193000000 +chr1:193000001-194000000 +chr1:194000001-195000000 +chr1:195000001-196000000 +chr1:196000001-197000000 +chr1:197000001-198000000 +chr1:198000001-199000000 +chr1:199000001-200000000 +chr1:200000001-201000000 +chr1:201000001-202000000 +chr1:202000001-203000000 +chr1:203000001-204000000 +chr1:204000001-205000000 +chr1:205000001-206000000 +chr1:206000001-207000000 +chr1:207000001-208000000 +chr1:208000001-209000000 +chr1:209000001-210000000 +chr1:210000001-211000000 +chr1:211000001-212000000 +chr1:212000001-213000000 +chr1:213000001-214000000 +chr1:214000001-215000000 +chr1:215000001-216000000 +chr1:216000001-217000000 +chr1:217000001-218000000 +chr1:218000001-219000000 +chr1:219000001-220000000 +chr1:220000001-221000000 +chr1:221000001-222000000 +chr1:222000001-223000000 +chr1:223000001-224000000 +chr1:224000001-225000000 +chr1:225000001-226000000 +chr1:226000001-227000000 +chr1:227000001-228000000 +chr1:228000001-229000000 +chr1:229000001-230000000 +chr1:230000001-231000000 +chr1:231000001-232000000 +chr1:232000001-233000000 +chr1:233000001-234000000 +chr1:234000001-235000000 +chr1:235000001-236000000 +chr1:236000001-237000000 +chr1:237000001-238000000 +chr1:238000001-239000000 +chr1:239000001-240000000 +chr1:240000001-241000000 +chr1:241000001-242000000 +chr1:242000001-243000000 +chr1:243000001-244000000 +chr1:244000001-245000000 +chr1:245000001-246000000 +chr1:246000001-247000000 +chr1:247000001-248000000 +chr1:248000001-248956422 +chr2:1-1000000 +chr2:1000001-2000000 +chr2:2000001-3000000 +chr2:3000001-4000000 +chr2:4000001-5000000 +chr2:5000001-6000000 +chr2:6000001-7000000 +chr2:7000001-8000000 +chr2:8000001-9000000 +chr2:9000001-10000000 +chr2:10000001-11000000 +chr2:11000001-12000000 +chr2:12000001-13000000 +chr2:13000001-14000000 +chr2:14000001-15000000 +chr2:15000001-16000000 +chr2:16000001-17000000 +chr2:17000001-18000000 +chr2:18000001-19000000 +chr2:19000001-20000000 +chr2:20000001-21000000 +chr2:21000001-22000000 +chr2:22000001-23000000 +chr2:23000001-24000000 +chr2:24000001-25000000 +chr2:25000001-26000000 +chr2:26000001-27000000 +chr2:27000001-28000000 +chr2:28000001-29000000 +chr2:29000001-30000000 +chr2:30000001-31000000 +chr2:31000001-32000000 +chr2:32000001-33000000 +chr2:33000001-34000000 +chr2:34000001-35000000 +chr2:35000001-36000000 +chr2:36000001-37000000 +chr2:37000001-38000000 +chr2:38000001-39000000 +chr2:39000001-40000000 +chr2:40000001-41000000 +chr2:41000001-42000000 +chr2:42000001-43000000 +chr2:43000001-44000000 +chr2:44000001-45000000 +chr2:45000001-46000000 +chr2:46000001-47000000 +chr2:47000001-48000000 +chr2:48000001-49000000 +chr2:49000001-50000000 +chr2:50000001-51000000 +chr2:51000001-52000000 +chr2:52000001-53000000 +chr2:53000001-54000000 +chr2:54000001-55000000 +chr2:55000001-56000000 +chr2:56000001-57000000 +chr2:57000001-58000000 +chr2:58000001-59000000 +chr2:59000001-60000000 +chr2:60000001-61000000 +chr2:61000001-62000000 +chr2:62000001-63000000 +chr2:63000001-64000000 +chr2:64000001-65000000 +chr2:65000001-66000000 +chr2:66000001-67000000 +chr2:67000001-68000000 +chr2:68000001-69000000 +chr2:69000001-70000000 +chr2:70000001-71000000 +chr2:71000001-72000000 +chr2:72000001-73000000 +chr2:73000001-74000000 +chr2:74000001-75000000 +chr2:75000001-76000000 +chr2:76000001-77000000 +chr2:77000001-78000000 +chr2:78000001-79000000 +chr2:79000001-80000000 +chr2:80000001-81000000 +chr2:81000001-82000000 +chr2:82000001-83000000 +chr2:83000001-84000000 +chr2:84000001-85000000 +chr2:85000001-86000000 +chr2:86000001-87000000 +chr2:87000001-88000000 +chr2:88000001-89000000 +chr2:89000001-90000000 +chr2:90000001-91000000 +chr2:91000001-92000000 +chr2:92000001-93000000 +chr2:93000001-94000000 +chr2:94000001-95000000 +chr2:95000001-96000000 +chr2:96000001-97000000 +chr2:97000001-98000000 +chr2:98000001-99000000 +chr2:99000001-100000000 +chr2:100000001-101000000 +chr2:101000001-102000000 +chr2:102000001-103000000 +chr2:103000001-104000000 +chr2:104000001-105000000 +chr2:105000001-106000000 +chr2:106000001-107000000 +chr2:107000001-108000000 +chr2:108000001-109000000 +chr2:109000001-110000000 +chr2:110000001-111000000 +chr2:111000001-112000000 +chr2:112000001-113000000 +chr2:113000001-114000000 +chr2:114000001-115000000 +chr2:115000001-116000000 +chr2:116000001-117000000 +chr2:117000001-118000000 +chr2:118000001-119000000 +chr2:119000001-120000000 +chr2:120000001-121000000 +chr2:121000001-122000000 +chr2:122000001-123000000 +chr2:123000001-124000000 +chr2:124000001-125000000 +chr2:125000001-126000000 +chr2:126000001-127000000 +chr2:127000001-128000000 +chr2:128000001-129000000 +chr2:129000001-130000000 +chr2:130000001-131000000 +chr2:131000001-132000000 +chr2:132000001-133000000 +chr2:133000001-134000000 +chr2:134000001-135000000 +chr2:135000001-136000000 +chr2:136000001-137000000 +chr2:137000001-138000000 +chr2:138000001-139000000 +chr2:139000001-140000000 +chr2:140000001-141000000 +chr2:141000001-142000000 +chr2:142000001-143000000 +chr2:143000001-144000000 +chr2:144000001-145000000 +chr2:145000001-146000000 +chr2:146000001-147000000 +chr2:147000001-148000000 +chr2:148000001-149000000 +chr2:149000001-150000000 +chr2:150000001-151000000 +chr2:151000001-152000000 +chr2:152000001-153000000 +chr2:153000001-154000000 +chr2:154000001-155000000 +chr2:155000001-156000000 +chr2:156000001-157000000 +chr2:157000001-158000000 +chr2:158000001-159000000 +chr2:159000001-160000000 +chr2:160000001-161000000 +chr2:161000001-162000000 +chr2:162000001-163000000 +chr2:163000001-164000000 +chr2:164000001-165000000 +chr2:165000001-166000000 +chr2:166000001-167000000 +chr2:167000001-168000000 +chr2:168000001-169000000 +chr2:169000001-170000000 +chr2:170000001-171000000 +chr2:171000001-172000000 +chr2:172000001-173000000 +chr2:173000001-174000000 +chr2:174000001-175000000 +chr2:175000001-176000000 +chr2:176000001-177000000 +chr2:177000001-178000000 +chr2:178000001-179000000 +chr2:179000001-180000000 +chr2:180000001-181000000 +chr2:181000001-182000000 +chr2:182000001-183000000 +chr2:183000001-184000000 +chr2:184000001-185000000 +chr2:185000001-186000000 +chr2:186000001-187000000 +chr2:187000001-188000000 +chr2:188000001-189000000 +chr2:189000001-190000000 +chr2:190000001-191000000 +chr2:191000001-192000000 +chr2:192000001-193000000 +chr2:193000001-194000000 +chr2:194000001-195000000 +chr2:195000001-196000000 +chr2:196000001-197000000 +chr2:197000001-198000000 +chr2:198000001-199000000 +chr2:199000001-200000000 +chr2:200000001-201000000 +chr2:201000001-202000000 +chr2:202000001-203000000 +chr2:203000001-204000000 +chr2:204000001-205000000 +chr2:205000001-206000000 +chr2:206000001-207000000 +chr2:207000001-208000000 +chr2:208000001-209000000 +chr2:209000001-210000000 +chr2:210000001-211000000 +chr2:211000001-212000000 +chr2:212000001-213000000 +chr2:213000001-214000000 +chr2:214000001-215000000 +chr2:215000001-216000000 +chr2:216000001-217000000 +chr2:217000001-218000000 +chr2:218000001-219000000 +chr2:219000001-220000000 +chr2:220000001-221000000 +chr2:221000001-222000000 +chr2:222000001-223000000 +chr2:223000001-224000000 +chr2:224000001-225000000 +chr2:225000001-226000000 +chr2:226000001-227000000 +chr2:227000001-228000000 +chr2:228000001-229000000 +chr2:229000001-230000000 +chr2:230000001-231000000 +chr2:231000001-232000000 +chr2:232000001-233000000 +chr2:233000001-234000000 +chr2:234000001-235000000 +chr2:235000001-236000000 +chr2:236000001-237000000 +chr2:237000001-238000000 +chr2:238000001-239000000 +chr2:239000001-240000000 +chr2:240000001-241000000 +chr2:241000001-242000000 +chr2:242000001-242193529 +chr3:1-1000000 +chr3:1000001-2000000 +chr3:2000001-3000000 +chr3:3000001-4000000 +chr3:4000001-5000000 +chr3:5000001-6000000 +chr3:6000001-7000000 +chr3:7000001-8000000 +chr3:8000001-9000000 +chr3:9000001-10000000 +chr3:10000001-11000000 +chr3:11000001-12000000 +chr3:12000001-13000000 +chr3:13000001-14000000 +chr3:14000001-15000000 +chr3:15000001-16000000 +chr3:16000001-17000000 +chr3:17000001-18000000 +chr3:18000001-19000000 +chr3:19000001-20000000 +chr3:20000001-21000000 +chr3:21000001-22000000 +chr3:22000001-23000000 +chr3:23000001-24000000 +chr3:24000001-25000000 +chr3:25000001-26000000 +chr3:26000001-27000000 +chr3:27000001-28000000 +chr3:28000001-29000000 +chr3:29000001-30000000 +chr3:30000001-31000000 +chr3:31000001-32000000 +chr3:32000001-33000000 +chr3:33000001-34000000 +chr3:34000001-35000000 +chr3:35000001-36000000 +chr3:36000001-37000000 +chr3:37000001-38000000 +chr3:38000001-39000000 +chr3:39000001-40000000 +chr3:40000001-41000000 +chr3:41000001-42000000 +chr3:42000001-43000000 +chr3:43000001-44000000 +chr3:44000001-45000000 +chr3:45000001-46000000 +chr3:46000001-47000000 +chr3:47000001-48000000 +chr3:48000001-49000000 +chr3:49000001-50000000 +chr3:50000001-51000000 +chr3:51000001-52000000 +chr3:52000001-53000000 +chr3:53000001-54000000 +chr3:54000001-55000000 +chr3:55000001-56000000 +chr3:56000001-57000000 +chr3:57000001-58000000 +chr3:58000001-59000000 +chr3:59000001-60000000 +chr3:60000001-61000000 +chr3:61000001-62000000 +chr3:62000001-63000000 +chr3:63000001-64000000 +chr3:64000001-65000000 +chr3:65000001-66000000 +chr3:66000001-67000000 +chr3:67000001-68000000 +chr3:68000001-69000000 +chr3:69000001-70000000 +chr3:70000001-71000000 +chr3:71000001-72000000 +chr3:72000001-73000000 +chr3:73000001-74000000 +chr3:74000001-75000000 +chr3:75000001-76000000 +chr3:76000001-77000000 +chr3:77000001-78000000 +chr3:78000001-79000000 +chr3:79000001-80000000 +chr3:80000001-81000000 +chr3:81000001-82000000 +chr3:82000001-83000000 +chr3:83000001-84000000 +chr3:84000001-85000000 +chr3:85000001-86000000 +chr3:86000001-87000000 +chr3:87000001-88000000 +chr3:88000001-89000000 +chr3:89000001-90000000 +chr3:90000001-91000000 +chr3:91000001-92000000 +chr3:92000001-93000000 +chr3:93000001-94000000 +chr3:94000001-95000000 +chr3:95000001-96000000 +chr3:96000001-97000000 +chr3:97000001-98000000 +chr3:98000001-99000000 +chr3:99000001-100000000 +chr3:100000001-101000000 +chr3:101000001-102000000 +chr3:102000001-103000000 +chr3:103000001-104000000 +chr3:104000001-105000000 +chr3:105000001-106000000 +chr3:106000001-107000000 +chr3:107000001-108000000 +chr3:108000001-109000000 +chr3:109000001-110000000 +chr3:110000001-111000000 +chr3:111000001-112000000 +chr3:112000001-113000000 +chr3:113000001-114000000 +chr3:114000001-115000000 +chr3:115000001-116000000 +chr3:116000001-117000000 +chr3:117000001-118000000 +chr3:118000001-119000000 +chr3:119000001-120000000 +chr3:120000001-121000000 +chr3:121000001-122000000 +chr3:122000001-123000000 +chr3:123000001-124000000 +chr3:124000001-125000000 +chr3:125000001-126000000 +chr3:126000001-127000000 +chr3:127000001-128000000 +chr3:128000001-129000000 +chr3:129000001-130000000 +chr3:130000001-131000000 +chr3:131000001-132000000 +chr3:132000001-133000000 +chr3:133000001-134000000 +chr3:134000001-135000000 +chr3:135000001-136000000 +chr3:136000001-137000000 +chr3:137000001-138000000 +chr3:138000001-139000000 +chr3:139000001-140000000 +chr3:140000001-141000000 +chr3:141000001-142000000 +chr3:142000001-143000000 +chr3:143000001-144000000 +chr3:144000001-145000000 +chr3:145000001-146000000 +chr3:146000001-147000000 +chr3:147000001-148000000 +chr3:148000001-149000000 +chr3:149000001-150000000 +chr3:150000001-151000000 +chr3:151000001-152000000 +chr3:152000001-153000000 +chr3:153000001-154000000 +chr3:154000001-155000000 +chr3:155000001-156000000 +chr3:156000001-157000000 +chr3:157000001-158000000 +chr3:158000001-159000000 +chr3:159000001-160000000 +chr3:160000001-161000000 +chr3:161000001-162000000 +chr3:162000001-163000000 +chr3:163000001-164000000 +chr3:164000001-165000000 +chr3:165000001-166000000 +chr3:166000001-167000000 +chr3:167000001-168000000 +chr3:168000001-169000000 +chr3:169000001-170000000 +chr3:170000001-171000000 +chr3:171000001-172000000 +chr3:172000001-173000000 +chr3:173000001-174000000 +chr3:174000001-175000000 +chr3:175000001-176000000 +chr3:176000001-177000000 +chr3:177000001-178000000 +chr3:178000001-179000000 +chr3:179000001-180000000 +chr3:180000001-181000000 +chr3:181000001-182000000 +chr3:182000001-183000000 +chr3:183000001-184000000 +chr3:184000001-185000000 +chr3:185000001-186000000 +chr3:186000001-187000000 +chr3:187000001-188000000 +chr3:188000001-189000000 +chr3:189000001-190000000 +chr3:190000001-191000000 +chr3:191000001-192000000 +chr3:192000001-193000000 +chr3:193000001-194000000 +chr3:194000001-195000000 +chr3:195000001-196000000 +chr3:196000001-197000000 +chr3:197000001-198000000 +chr3:198000001-198295559 +chr4:1-1000000 +chr4:1000001-2000000 +chr4:2000001-3000000 +chr4:3000001-4000000 +chr4:4000001-5000000 +chr4:5000001-6000000 +chr4:6000001-7000000 +chr4:7000001-8000000 +chr4:8000001-9000000 +chr4:9000001-10000000 +chr4:10000001-11000000 +chr4:11000001-12000000 +chr4:12000001-13000000 +chr4:13000001-14000000 +chr4:14000001-15000000 +chr4:15000001-16000000 +chr4:16000001-17000000 +chr4:17000001-18000000 +chr4:18000001-19000000 +chr4:19000001-20000000 +chr4:20000001-21000000 +chr4:21000001-22000000 +chr4:22000001-23000000 +chr4:23000001-24000000 +chr4:24000001-25000000 +chr4:25000001-26000000 +chr4:26000001-27000000 +chr4:27000001-28000000 +chr4:28000001-29000000 +chr4:29000001-30000000 +chr4:30000001-31000000 +chr4:31000001-32000000 +chr4:32000001-33000000 +chr4:33000001-34000000 +chr4:34000001-35000000 +chr4:35000001-36000000 +chr4:36000001-37000000 +chr4:37000001-38000000 +chr4:38000001-39000000 +chr4:39000001-40000000 +chr4:40000001-41000000 +chr4:41000001-42000000 +chr4:42000001-43000000 +chr4:43000001-44000000 +chr4:44000001-45000000 +chr4:45000001-46000000 +chr4:46000001-47000000 +chr4:47000001-48000000 +chr4:48000001-49000000 +chr4:49000001-50000000 +chr4:50000001-51000000 +chr4:51000001-52000000 +chr4:52000001-53000000 +chr4:53000001-54000000 +chr4:54000001-55000000 +chr4:55000001-56000000 +chr4:56000001-57000000 +chr4:57000001-58000000 +chr4:58000001-59000000 +chr4:59000001-60000000 +chr4:60000001-61000000 +chr4:61000001-62000000 +chr4:62000001-63000000 +chr4:63000001-64000000 +chr4:64000001-65000000 +chr4:65000001-66000000 +chr4:66000001-67000000 +chr4:67000001-68000000 +chr4:68000001-69000000 +chr4:69000001-70000000 +chr4:70000001-71000000 +chr4:71000001-72000000 +chr4:72000001-73000000 +chr4:73000001-74000000 +chr4:74000001-75000000 +chr4:75000001-76000000 +chr4:76000001-77000000 +chr4:77000001-78000000 +chr4:78000001-79000000 +chr4:79000001-80000000 +chr4:80000001-81000000 +chr4:81000001-82000000 +chr4:82000001-83000000 +chr4:83000001-84000000 +chr4:84000001-85000000 +chr4:85000001-86000000 +chr4:86000001-87000000 +chr4:87000001-88000000 +chr4:88000001-89000000 +chr4:89000001-90000000 +chr4:90000001-91000000 +chr4:91000001-92000000 +chr4:92000001-93000000 +chr4:93000001-94000000 +chr4:94000001-95000000 +chr4:95000001-96000000 +chr4:96000001-97000000 +chr4:97000001-98000000 +chr4:98000001-99000000 +chr4:99000001-100000000 +chr4:100000001-101000000 +chr4:101000001-102000000 +chr4:102000001-103000000 +chr4:103000001-104000000 +chr4:104000001-105000000 +chr4:105000001-106000000 +chr4:106000001-107000000 +chr4:107000001-108000000 +chr4:108000001-109000000 +chr4:109000001-110000000 +chr4:110000001-111000000 +chr4:111000001-112000000 +chr4:112000001-113000000 +chr4:113000001-114000000 +chr4:114000001-115000000 +chr4:115000001-116000000 +chr4:116000001-117000000 +chr4:117000001-118000000 +chr4:118000001-119000000 +chr4:119000001-120000000 +chr4:120000001-121000000 +chr4:121000001-122000000 +chr4:122000001-123000000 +chr4:123000001-124000000 +chr4:124000001-125000000 +chr4:125000001-126000000 +chr4:126000001-127000000 +chr4:127000001-128000000 +chr4:128000001-129000000 +chr4:129000001-130000000 +chr4:130000001-131000000 +chr4:131000001-132000000 +chr4:132000001-133000000 +chr4:133000001-134000000 +chr4:134000001-135000000 +chr4:135000001-136000000 +chr4:136000001-137000000 +chr4:137000001-138000000 +chr4:138000001-139000000 +chr4:139000001-140000000 +chr4:140000001-141000000 +chr4:141000001-142000000 +chr4:142000001-143000000 +chr4:143000001-144000000 +chr4:144000001-145000000 +chr4:145000001-146000000 +chr4:146000001-147000000 +chr4:147000001-148000000 +chr4:148000001-149000000 +chr4:149000001-150000000 +chr4:150000001-151000000 +chr4:151000001-152000000 +chr4:152000001-153000000 +chr4:153000001-154000000 +chr4:154000001-155000000 +chr4:155000001-156000000 +chr4:156000001-157000000 +chr4:157000001-158000000 +chr4:158000001-159000000 +chr4:159000001-160000000 +chr4:160000001-161000000 +chr4:161000001-162000000 +chr4:162000001-163000000 +chr4:163000001-164000000 +chr4:164000001-165000000 +chr4:165000001-166000000 +chr4:166000001-167000000 +chr4:167000001-168000000 +chr4:168000001-169000000 +chr4:169000001-170000000 +chr4:170000001-171000000 +chr4:171000001-172000000 +chr4:172000001-173000000 +chr4:173000001-174000000 +chr4:174000001-175000000 +chr4:175000001-176000000 +chr4:176000001-177000000 +chr4:177000001-178000000 +chr4:178000001-179000000 +chr4:179000001-180000000 +chr4:180000001-181000000 +chr4:181000001-182000000 +chr4:182000001-183000000 +chr4:183000001-184000000 +chr4:184000001-185000000 +chr4:185000001-186000000 +chr4:186000001-187000000 +chr4:187000001-188000000 +chr4:188000001-189000000 +chr4:189000001-190000000 +chr4:190000001-190214555 +chr5:1-1000000 +chr5:1000001-2000000 +chr5:2000001-3000000 +chr5:3000001-4000000 +chr5:4000001-5000000 +chr5:5000001-6000000 +chr5:6000001-7000000 +chr5:7000001-8000000 +chr5:8000001-9000000 +chr5:9000001-10000000 +chr5:10000001-11000000 +chr5:11000001-12000000 +chr5:12000001-13000000 +chr5:13000001-14000000 +chr5:14000001-15000000 +chr5:15000001-16000000 +chr5:16000001-17000000 +chr5:17000001-18000000 +chr5:18000001-19000000 +chr5:19000001-20000000 +chr5:20000001-21000000 +chr5:21000001-22000000 +chr5:22000001-23000000 +chr5:23000001-24000000 +chr5:24000001-25000000 +chr5:25000001-26000000 +chr5:26000001-27000000 +chr5:27000001-28000000 +chr5:28000001-29000000 +chr5:29000001-30000000 +chr5:30000001-31000000 +chr5:31000001-32000000 +chr5:32000001-33000000 +chr5:33000001-34000000 +chr5:34000001-35000000 +chr5:35000001-36000000 +chr5:36000001-37000000 +chr5:37000001-38000000 +chr5:38000001-39000000 +chr5:39000001-40000000 +chr5:40000001-41000000 +chr5:41000001-42000000 +chr5:42000001-43000000 +chr5:43000001-44000000 +chr5:44000001-45000000 +chr5:45000001-46000000 +chr5:46000001-47000000 +chr5:47000001-48000000 +chr5:48000001-49000000 +chr5:49000001-50000000 +chr5:50000001-51000000 +chr5:51000001-52000000 +chr5:52000001-53000000 +chr5:53000001-54000000 +chr5:54000001-55000000 +chr5:55000001-56000000 +chr5:56000001-57000000 +chr5:57000001-58000000 +chr5:58000001-59000000 +chr5:59000001-60000000 +chr5:60000001-61000000 +chr5:61000001-62000000 +chr5:62000001-63000000 +chr5:63000001-64000000 +chr5:64000001-65000000 +chr5:65000001-66000000 +chr5:66000001-67000000 +chr5:67000001-68000000 +chr5:68000001-69000000 +chr5:69000001-70000000 +chr5:70000001-71000000 +chr5:71000001-72000000 +chr5:72000001-73000000 +chr5:73000001-74000000 +chr5:74000001-75000000 +chr5:75000001-76000000 +chr5:76000001-77000000 +chr5:77000001-78000000 +chr5:78000001-79000000 +chr5:79000001-80000000 +chr5:80000001-81000000 +chr5:81000001-82000000 +chr5:82000001-83000000 +chr5:83000001-84000000 +chr5:84000001-85000000 +chr5:85000001-86000000 +chr5:86000001-87000000 +chr5:87000001-88000000 +chr5:88000001-89000000 +chr5:89000001-90000000 +chr5:90000001-91000000 +chr5:91000001-92000000 +chr5:92000001-93000000 +chr5:93000001-94000000 +chr5:94000001-95000000 +chr5:95000001-96000000 +chr5:96000001-97000000 +chr5:97000001-98000000 +chr5:98000001-99000000 +chr5:99000001-100000000 +chr5:100000001-101000000 +chr5:101000001-102000000 +chr5:102000001-103000000 +chr5:103000001-104000000 +chr5:104000001-105000000 +chr5:105000001-106000000 +chr5:106000001-107000000 +chr5:107000001-108000000 +chr5:108000001-109000000 +chr5:109000001-110000000 +chr5:110000001-111000000 +chr5:111000001-112000000 +chr5:112000001-113000000 +chr5:113000001-114000000 +chr5:114000001-115000000 +chr5:115000001-116000000 +chr5:116000001-117000000 +chr5:117000001-118000000 +chr5:118000001-119000000 +chr5:119000001-120000000 +chr5:120000001-121000000 +chr5:121000001-122000000 +chr5:122000001-123000000 +chr5:123000001-124000000 +chr5:124000001-125000000 +chr5:125000001-126000000 +chr5:126000001-127000000 +chr5:127000001-128000000 +chr5:128000001-129000000 +chr5:129000001-130000000 +chr5:130000001-131000000 +chr5:131000001-132000000 +chr5:132000001-133000000 +chr5:133000001-134000000 +chr5:134000001-135000000 +chr5:135000001-136000000 +chr5:136000001-137000000 +chr5:137000001-138000000 +chr5:138000001-139000000 +chr5:139000001-140000000 +chr5:140000001-141000000 +chr5:141000001-142000000 +chr5:142000001-143000000 +chr5:143000001-144000000 +chr5:144000001-145000000 +chr5:145000001-146000000 +chr5:146000001-147000000 +chr5:147000001-148000000 +chr5:148000001-149000000 +chr5:149000001-150000000 +chr5:150000001-151000000 +chr5:151000001-152000000 +chr5:152000001-153000000 +chr5:153000001-154000000 +chr5:154000001-155000000 +chr5:155000001-156000000 +chr5:156000001-157000000 +chr5:157000001-158000000 +chr5:158000001-159000000 +chr5:159000001-160000000 +chr5:160000001-161000000 +chr5:161000001-162000000 +chr5:162000001-163000000 +chr5:163000001-164000000 +chr5:164000001-165000000 +chr5:165000001-166000000 +chr5:166000001-167000000 +chr5:167000001-168000000 +chr5:168000001-169000000 +chr5:169000001-170000000 +chr5:170000001-171000000 +chr5:171000001-172000000 +chr5:172000001-173000000 +chr5:173000001-174000000 +chr5:174000001-175000000 +chr5:175000001-176000000 +chr5:176000001-177000000 +chr5:177000001-178000000 +chr5:178000001-179000000 +chr5:179000001-180000000 +chr5:180000001-181000000 +chr5:181000001-181538259 +chr6:1-1000000 +chr6:1000001-2000000 +chr6:2000001-3000000 +chr6:3000001-4000000 +chr6:4000001-5000000 +chr6:5000001-6000000 +chr6:6000001-7000000 +chr6:7000001-8000000 +chr6:8000001-9000000 +chr6:9000001-10000000 +chr6:10000001-11000000 +chr6:11000001-12000000 +chr6:12000001-13000000 +chr6:13000001-14000000 +chr6:14000001-15000000 +chr6:15000001-16000000 +chr6:16000001-17000000 +chr6:17000001-18000000 +chr6:18000001-19000000 +chr6:19000001-20000000 +chr6:20000001-21000000 +chr6:21000001-22000000 +chr6:22000001-23000000 +chr6:23000001-24000000 +chr6:24000001-25000000 +chr6:25000001-26000000 +chr6:26000001-27000000 +chr6:27000001-28000000 +chr6:28000001-29000000 +chr6:29000001-30000000 +chr6:30000001-31000000 +chr6:31000001-32000000 +chr6:32000001-33000000 +chr6:33000001-34000000 +chr6:34000001-35000000 +chr6:35000001-36000000 +chr6:36000001-37000000 +chr6:37000001-38000000 +chr6:38000001-39000000 +chr6:39000001-40000000 +chr6:40000001-41000000 +chr6:41000001-42000000 +chr6:42000001-43000000 +chr6:43000001-44000000 +chr6:44000001-45000000 +chr6:45000001-46000000 +chr6:46000001-47000000 +chr6:47000001-48000000 +chr6:48000001-49000000 +chr6:49000001-50000000 +chr6:50000001-51000000 +chr6:51000001-52000000 +chr6:52000001-53000000 +chr6:53000001-54000000 +chr6:54000001-55000000 +chr6:55000001-56000000 +chr6:56000001-57000000 +chr6:57000001-58000000 +chr6:58000001-59000000 +chr6:59000001-60000000 +chr6:60000001-61000000 +chr6:61000001-62000000 +chr6:62000001-63000000 +chr6:63000001-64000000 +chr6:64000001-65000000 +chr6:65000001-66000000 +chr6:66000001-67000000 +chr6:67000001-68000000 +chr6:68000001-69000000 +chr6:69000001-70000000 +chr6:70000001-71000000 +chr6:71000001-72000000 +chr6:72000001-73000000 +chr6:73000001-74000000 +chr6:74000001-75000000 +chr6:75000001-76000000 +chr6:76000001-77000000 +chr6:77000001-78000000 +chr6:78000001-79000000 +chr6:79000001-80000000 +chr6:80000001-81000000 +chr6:81000001-82000000 +chr6:82000001-83000000 +chr6:83000001-84000000 +chr6:84000001-85000000 +chr6:85000001-86000000 +chr6:86000001-87000000 +chr6:87000001-88000000 +chr6:88000001-89000000 +chr6:89000001-90000000 +chr6:90000001-91000000 +chr6:91000001-92000000 +chr6:92000001-93000000 +chr6:93000001-94000000 +chr6:94000001-95000000 +chr6:95000001-96000000 +chr6:96000001-97000000 +chr6:97000001-98000000 +chr6:98000001-99000000 +chr6:99000001-100000000 +chr6:100000001-101000000 +chr6:101000001-102000000 +chr6:102000001-103000000 +chr6:103000001-104000000 +chr6:104000001-105000000 +chr6:105000001-106000000 +chr6:106000001-107000000 +chr6:107000001-108000000 +chr6:108000001-109000000 +chr6:109000001-110000000 +chr6:110000001-111000000 +chr6:111000001-112000000 +chr6:112000001-113000000 +chr6:113000001-114000000 +chr6:114000001-115000000 +chr6:115000001-116000000 +chr6:116000001-117000000 +chr6:117000001-118000000 +chr6:118000001-119000000 +chr6:119000001-120000000 +chr6:120000001-121000000 +chr6:121000001-122000000 +chr6:122000001-123000000 +chr6:123000001-124000000 +chr6:124000001-125000000 +chr6:125000001-126000000 +chr6:126000001-127000000 +chr6:127000001-128000000 +chr6:128000001-129000000 +chr6:129000001-130000000 +chr6:130000001-131000000 +chr6:131000001-132000000 +chr6:132000001-133000000 +chr6:133000001-134000000 +chr6:134000001-135000000 +chr6:135000001-136000000 +chr6:136000001-137000000 +chr6:137000001-138000000 +chr6:138000001-139000000 +chr6:139000001-140000000 +chr6:140000001-141000000 +chr6:141000001-142000000 +chr6:142000001-143000000 +chr6:143000001-144000000 +chr6:144000001-145000000 +chr6:145000001-146000000 +chr6:146000001-147000000 +chr6:147000001-148000000 +chr6:148000001-149000000 +chr6:149000001-150000000 +chr6:150000001-151000000 +chr6:151000001-152000000 +chr6:152000001-153000000 +chr6:153000001-154000000 +chr6:154000001-155000000 +chr6:155000001-156000000 +chr6:156000001-157000000 +chr6:157000001-158000000 +chr6:158000001-159000000 +chr6:159000001-160000000 +chr6:160000001-161000000 +chr6:161000001-162000000 +chr6:162000001-163000000 +chr6:163000001-164000000 +chr6:164000001-165000000 +chr6:165000001-166000000 +chr6:166000001-167000000 +chr6:167000001-168000000 +chr6:168000001-169000000 +chr6:169000001-170000000 +chr6:170000001-170805979 +chr7:1-1000000 +chr7:1000001-2000000 +chr7:2000001-3000000 +chr7:3000001-4000000 +chr7:4000001-5000000 +chr7:5000001-6000000 +chr7:6000001-7000000 +chr7:7000001-8000000 +chr7:8000001-9000000 +chr7:9000001-10000000 +chr7:10000001-11000000 +chr7:11000001-12000000 +chr7:12000001-13000000 +chr7:13000001-14000000 +chr7:14000001-15000000 +chr7:15000001-16000000 +chr7:16000001-17000000 +chr7:17000001-18000000 +chr7:18000001-19000000 +chr7:19000001-20000000 +chr7:20000001-21000000 +chr7:21000001-22000000 +chr7:22000001-23000000 +chr7:23000001-24000000 +chr7:24000001-25000000 +chr7:25000001-26000000 +chr7:26000001-27000000 +chr7:27000001-28000000 +chr7:28000001-29000000 +chr7:29000001-30000000 +chr7:30000001-31000000 +chr7:31000001-32000000 +chr7:32000001-33000000 +chr7:33000001-34000000 +chr7:34000001-35000000 +chr7:35000001-36000000 +chr7:36000001-37000000 +chr7:37000001-38000000 +chr7:38000001-39000000 +chr7:39000001-40000000 +chr7:40000001-41000000 +chr7:41000001-42000000 +chr7:42000001-43000000 +chr7:43000001-44000000 +chr7:44000001-45000000 +chr7:45000001-46000000 +chr7:46000001-47000000 +chr7:47000001-48000000 +chr7:48000001-49000000 +chr7:49000001-50000000 +chr7:50000001-51000000 +chr7:51000001-52000000 +chr7:52000001-53000000 +chr7:53000001-54000000 +chr7:54000001-55000000 +chr7:55000001-56000000 +chr7:56000001-57000000 +chr7:57000001-58000000 +chr7:58000001-59000000 +chr7:59000001-60000000 +chr7:60000001-61000000 +chr7:61000001-62000000 +chr7:62000001-63000000 +chr7:63000001-64000000 +chr7:64000001-65000000 +chr7:65000001-66000000 +chr7:66000001-67000000 +chr7:67000001-68000000 +chr7:68000001-69000000 +chr7:69000001-70000000 +chr7:70000001-71000000 +chr7:71000001-72000000 +chr7:72000001-73000000 +chr7:73000001-74000000 +chr7:74000001-75000000 +chr7:75000001-76000000 +chr7:76000001-77000000 +chr7:77000001-78000000 +chr7:78000001-79000000 +chr7:79000001-80000000 +chr7:80000001-81000000 +chr7:81000001-82000000 +chr7:82000001-83000000 +chr7:83000001-84000000 +chr7:84000001-85000000 +chr7:85000001-86000000 +chr7:86000001-87000000 +chr7:87000001-88000000 +chr7:88000001-89000000 +chr7:89000001-90000000 +chr7:90000001-91000000 +chr7:91000001-92000000 +chr7:92000001-93000000 +chr7:93000001-94000000 +chr7:94000001-95000000 +chr7:95000001-96000000 +chr7:96000001-97000000 +chr7:97000001-98000000 +chr7:98000001-99000000 +chr7:99000001-100000000 +chr7:100000001-101000000 +chr7:101000001-102000000 +chr7:102000001-103000000 +chr7:103000001-104000000 +chr7:104000001-105000000 +chr7:105000001-106000000 +chr7:106000001-107000000 +chr7:107000001-108000000 +chr7:108000001-109000000 +chr7:109000001-110000000 +chr7:110000001-111000000 +chr7:111000001-112000000 +chr7:112000001-113000000 +chr7:113000001-114000000 +chr7:114000001-115000000 +chr7:115000001-116000000 +chr7:116000001-117000000 +chr7:117000001-118000000 +chr7:118000001-119000000 +chr7:119000001-120000000 +chr7:120000001-121000000 +chr7:121000001-122000000 +chr7:122000001-123000000 +chr7:123000001-124000000 +chr7:124000001-125000000 +chr7:125000001-126000000 +chr7:126000001-127000000 +chr7:127000001-128000000 +chr7:128000001-129000000 +chr7:129000001-130000000 +chr7:130000001-131000000 +chr7:131000001-132000000 +chr7:132000001-133000000 +chr7:133000001-134000000 +chr7:134000001-135000000 +chr7:135000001-136000000 +chr7:136000001-137000000 +chr7:137000001-138000000 +chr7:138000001-139000000 +chr7:139000001-140000000 +chr7:140000001-141000000 +chr7:141000001-142000000 +chr7:142000001-143000000 +chr7:143000001-144000000 +chr7:144000001-145000000 +chr7:145000001-146000000 +chr7:146000001-147000000 +chr7:147000001-148000000 +chr7:148000001-149000000 +chr7:149000001-150000000 +chr7:150000001-151000000 +chr7:151000001-152000000 +chr7:152000001-153000000 +chr7:153000001-154000000 +chr7:154000001-155000000 +chr7:155000001-156000000 +chr7:156000001-157000000 +chr7:157000001-158000000 +chr7:158000001-159000000 +chr7:159000001-159345973 +chr8:1-1000000 +chr8:1000001-2000000 +chr8:2000001-3000000 +chr8:3000001-4000000 +chr8:4000001-5000000 +chr8:5000001-6000000 +chr8:6000001-7000000 +chr8:7000001-8000000 +chr8:8000001-9000000 +chr8:9000001-10000000 +chr8:10000001-11000000 +chr8:11000001-12000000 +chr8:12000001-13000000 +chr8:13000001-14000000 +chr8:14000001-15000000 +chr8:15000001-16000000 +chr8:16000001-17000000 +chr8:17000001-18000000 +chr8:18000001-19000000 +chr8:19000001-20000000 +chr8:20000001-21000000 +chr8:21000001-22000000 +chr8:22000001-23000000 +chr8:23000001-24000000 +chr8:24000001-25000000 +chr8:25000001-26000000 +chr8:26000001-27000000 +chr8:27000001-28000000 +chr8:28000001-29000000 +chr8:29000001-30000000 +chr8:30000001-31000000 +chr8:31000001-32000000 +chr8:32000001-33000000 +chr8:33000001-34000000 +chr8:34000001-35000000 +chr8:35000001-36000000 +chr8:36000001-37000000 +chr8:37000001-38000000 +chr8:38000001-39000000 +chr8:39000001-40000000 +chr8:40000001-41000000 +chr8:41000001-42000000 +chr8:42000001-43000000 +chr8:43000001-44000000 +chr8:44000001-45000000 +chr8:45000001-46000000 +chr8:46000001-47000000 +chr8:47000001-48000000 +chr8:48000001-49000000 +chr8:49000001-50000000 +chr8:50000001-51000000 +chr8:51000001-52000000 +chr8:52000001-53000000 +chr8:53000001-54000000 +chr8:54000001-55000000 +chr8:55000001-56000000 +chr8:56000001-57000000 +chr8:57000001-58000000 +chr8:58000001-59000000 +chr8:59000001-60000000 +chr8:60000001-61000000 +chr8:61000001-62000000 +chr8:62000001-63000000 +chr8:63000001-64000000 +chr8:64000001-65000000 +chr8:65000001-66000000 +chr8:66000001-67000000 +chr8:67000001-68000000 +chr8:68000001-69000000 +chr8:69000001-70000000 +chr8:70000001-71000000 +chr8:71000001-72000000 +chr8:72000001-73000000 +chr8:73000001-74000000 +chr8:74000001-75000000 +chr8:75000001-76000000 +chr8:76000001-77000000 +chr8:77000001-78000000 +chr8:78000001-79000000 +chr8:79000001-80000000 +chr8:80000001-81000000 +chr8:81000001-82000000 +chr8:82000001-83000000 +chr8:83000001-84000000 +chr8:84000001-85000000 +chr8:85000001-86000000 +chr8:86000001-87000000 +chr8:87000001-88000000 +chr8:88000001-89000000 +chr8:89000001-90000000 +chr8:90000001-91000000 +chr8:91000001-92000000 +chr8:92000001-93000000 +chr8:93000001-94000000 +chr8:94000001-95000000 +chr8:95000001-96000000 +chr8:96000001-97000000 +chr8:97000001-98000000 +chr8:98000001-99000000 +chr8:99000001-100000000 +chr8:100000001-101000000 +chr8:101000001-102000000 +chr8:102000001-103000000 +chr8:103000001-104000000 +chr8:104000001-105000000 +chr8:105000001-106000000 +chr8:106000001-107000000 +chr8:107000001-108000000 +chr8:108000001-109000000 +chr8:109000001-110000000 +chr8:110000001-111000000 +chr8:111000001-112000000 +chr8:112000001-113000000 +chr8:113000001-114000000 +chr8:114000001-115000000 +chr8:115000001-116000000 +chr8:116000001-117000000 +chr8:117000001-118000000 +chr8:118000001-119000000 +chr8:119000001-120000000 +chr8:120000001-121000000 +chr8:121000001-122000000 +chr8:122000001-123000000 +chr8:123000001-124000000 +chr8:124000001-125000000 +chr8:125000001-126000000 +chr8:126000001-127000000 +chr8:127000001-128000000 +chr8:128000001-129000000 +chr8:129000001-130000000 +chr8:130000001-131000000 +chr8:131000001-132000000 +chr8:132000001-133000000 +chr8:133000001-134000000 +chr8:134000001-135000000 +chr8:135000001-136000000 +chr8:136000001-137000000 +chr8:137000001-138000000 +chr8:138000001-139000000 +chr8:139000001-140000000 +chr8:140000001-141000000 +chr8:141000001-142000000 +chr8:142000001-143000000 +chr8:143000001-144000000 +chr8:144000001-145000000 +chr8:145000001-145138636 +chr9:1-1000000 +chr9:1000001-2000000 +chr9:2000001-3000000 +chr9:3000001-4000000 +chr9:4000001-5000000 +chr9:5000001-6000000 +chr9:6000001-7000000 +chr9:7000001-8000000 +chr9:8000001-9000000 +chr9:9000001-10000000 +chr9:10000001-11000000 +chr9:11000001-12000000 +chr9:12000001-13000000 +chr9:13000001-14000000 +chr9:14000001-15000000 +chr9:15000001-16000000 +chr9:16000001-17000000 +chr9:17000001-18000000 +chr9:18000001-19000000 +chr9:19000001-20000000 +chr9:20000001-21000000 +chr9:21000001-22000000 +chr9:22000001-23000000 +chr9:23000001-24000000 +chr9:24000001-25000000 +chr9:25000001-26000000 +chr9:26000001-27000000 +chr9:27000001-28000000 +chr9:28000001-29000000 +chr9:29000001-30000000 +chr9:30000001-31000000 +chr9:31000001-32000000 +chr9:32000001-33000000 +chr9:33000001-34000000 +chr9:34000001-35000000 +chr9:35000001-36000000 +chr9:36000001-37000000 +chr9:37000001-38000000 +chr9:38000001-39000000 +chr9:39000001-40000000 +chr9:40000001-41000000 +chr9:41000001-42000000 +chr9:42000001-43000000 +chr9:43000001-44000000 +chr9:44000001-45000000 +chr9:45000001-46000000 +chr9:46000001-47000000 +chr9:47000001-48000000 +chr9:48000001-49000000 +chr9:49000001-50000000 +chr9:50000001-51000000 +chr9:51000001-52000000 +chr9:52000001-53000000 +chr9:53000001-54000000 +chr9:54000001-55000000 +chr9:55000001-56000000 +chr9:56000001-57000000 +chr9:57000001-58000000 +chr9:58000001-59000000 +chr9:59000001-60000000 +chr9:60000001-61000000 +chr9:61000001-62000000 +chr9:62000001-63000000 +chr9:63000001-64000000 +chr9:64000001-65000000 +chr9:65000001-66000000 +chr9:66000001-67000000 +chr9:67000001-68000000 +chr9:68000001-69000000 +chr9:69000001-70000000 +chr9:70000001-71000000 +chr9:71000001-72000000 +chr9:72000001-73000000 +chr9:73000001-74000000 +chr9:74000001-75000000 +chr9:75000001-76000000 +chr9:76000001-77000000 +chr9:77000001-78000000 +chr9:78000001-79000000 +chr9:79000001-80000000 +chr9:80000001-81000000 +chr9:81000001-82000000 +chr9:82000001-83000000 +chr9:83000001-84000000 +chr9:84000001-85000000 +chr9:85000001-86000000 +chr9:86000001-87000000 +chr9:87000001-88000000 +chr9:88000001-89000000 +chr9:89000001-90000000 +chr9:90000001-91000000 +chr9:91000001-92000000 +chr9:92000001-93000000 +chr9:93000001-94000000 +chr9:94000001-95000000 +chr9:95000001-96000000 +chr9:96000001-97000000 +chr9:97000001-98000000 +chr9:98000001-99000000 +chr9:99000001-100000000 +chr9:100000001-101000000 +chr9:101000001-102000000 +chr9:102000001-103000000 +chr9:103000001-104000000 +chr9:104000001-105000000 +chr9:105000001-106000000 +chr9:106000001-107000000 +chr9:107000001-108000000 +chr9:108000001-109000000 +chr9:109000001-110000000 +chr9:110000001-111000000 +chr9:111000001-112000000 +chr9:112000001-113000000 +chr9:113000001-114000000 +chr9:114000001-115000000 +chr9:115000001-116000000 +chr9:116000001-117000000 +chr9:117000001-118000000 +chr9:118000001-119000000 +chr9:119000001-120000000 +chr9:120000001-121000000 +chr9:121000001-122000000 +chr9:122000001-123000000 +chr9:123000001-124000000 +chr9:124000001-125000000 +chr9:125000001-126000000 +chr9:126000001-127000000 +chr9:127000001-128000000 +chr9:128000001-129000000 +chr9:129000001-130000000 +chr9:130000001-131000000 +chr9:131000001-132000000 +chr9:132000001-133000000 +chr9:133000001-134000000 +chr9:134000001-135000000 +chr9:135000001-136000000 +chr9:136000001-137000000 +chr9:137000001-138000000 +chr9:138000001-138394717 +chr10:1-1000000 +chr10:1000001-2000000 +chr10:2000001-3000000 +chr10:3000001-4000000 +chr10:4000001-5000000 +chr10:5000001-6000000 +chr10:6000001-7000000 +chr10:7000001-8000000 +chr10:8000001-9000000 +chr10:9000001-10000000 +chr10:10000001-11000000 +chr10:11000001-12000000 +chr10:12000001-13000000 +chr10:13000001-14000000 +chr10:14000001-15000000 +chr10:15000001-16000000 +chr10:16000001-17000000 +chr10:17000001-18000000 +chr10:18000001-19000000 +chr10:19000001-20000000 +chr10:20000001-21000000 +chr10:21000001-22000000 +chr10:22000001-23000000 +chr10:23000001-24000000 +chr10:24000001-25000000 +chr10:25000001-26000000 +chr10:26000001-27000000 +chr10:27000001-28000000 +chr10:28000001-29000000 +chr10:29000001-30000000 +chr10:30000001-31000000 +chr10:31000001-32000000 +chr10:32000001-33000000 +chr10:33000001-34000000 +chr10:34000001-35000000 +chr10:35000001-36000000 +chr10:36000001-37000000 +chr10:37000001-38000000 +chr10:38000001-39000000 +chr10:39000001-40000000 +chr10:40000001-41000000 +chr10:41000001-42000000 +chr10:42000001-43000000 +chr10:43000001-44000000 +chr10:44000001-45000000 +chr10:45000001-46000000 +chr10:46000001-47000000 +chr10:47000001-48000000 +chr10:48000001-49000000 +chr10:49000001-50000000 +chr10:50000001-51000000 +chr10:51000001-52000000 +chr10:52000001-53000000 +chr10:53000001-54000000 +chr10:54000001-55000000 +chr10:55000001-56000000 +chr10:56000001-57000000 +chr10:57000001-58000000 +chr10:58000001-59000000 +chr10:59000001-60000000 +chr10:60000001-61000000 +chr10:61000001-62000000 +chr10:62000001-63000000 +chr10:63000001-64000000 +chr10:64000001-65000000 +chr10:65000001-66000000 +chr10:66000001-67000000 +chr10:67000001-68000000 +chr10:68000001-69000000 +chr10:69000001-70000000 +chr10:70000001-71000000 +chr10:71000001-72000000 +chr10:72000001-73000000 +chr10:73000001-74000000 +chr10:74000001-75000000 +chr10:75000001-76000000 +chr10:76000001-77000000 +chr10:77000001-78000000 +chr10:78000001-79000000 +chr10:79000001-80000000 +chr10:80000001-81000000 +chr10:81000001-82000000 +chr10:82000001-83000000 +chr10:83000001-84000000 +chr10:84000001-85000000 +chr10:85000001-86000000 +chr10:86000001-87000000 +chr10:87000001-88000000 +chr10:88000001-89000000 +chr10:89000001-90000000 +chr10:90000001-91000000 +chr10:91000001-92000000 +chr10:92000001-93000000 +chr10:93000001-94000000 +chr10:94000001-95000000 +chr10:95000001-96000000 +chr10:96000001-97000000 +chr10:97000001-98000000 +chr10:98000001-99000000 +chr10:99000001-100000000 +chr10:100000001-101000000 +chr10:101000001-102000000 +chr10:102000001-103000000 +chr10:103000001-104000000 +chr10:104000001-105000000 +chr10:105000001-106000000 +chr10:106000001-107000000 +chr10:107000001-108000000 +chr10:108000001-109000000 +chr10:109000001-110000000 +chr10:110000001-111000000 +chr10:111000001-112000000 +chr10:112000001-113000000 +chr10:113000001-114000000 +chr10:114000001-115000000 +chr10:115000001-116000000 +chr10:116000001-117000000 +chr10:117000001-118000000 +chr10:118000001-119000000 +chr10:119000001-120000000 +chr10:120000001-121000000 +chr10:121000001-122000000 +chr10:122000001-123000000 +chr10:123000001-124000000 +chr10:124000001-125000000 +chr10:125000001-126000000 +chr10:126000001-127000000 +chr10:127000001-128000000 +chr10:128000001-129000000 +chr10:129000001-130000000 +chr10:130000001-131000000 +chr10:131000001-132000000 +chr10:132000001-133000000 +chr10:133000001-133797422 +chr11:1-1000000 +chr11:1000001-2000000 +chr11:2000001-3000000 +chr11:3000001-4000000 +chr11:4000001-5000000 +chr11:5000001-6000000 +chr11:6000001-7000000 +chr11:7000001-8000000 +chr11:8000001-9000000 +chr11:9000001-10000000 +chr11:10000001-11000000 +chr11:11000001-12000000 +chr11:12000001-13000000 +chr11:13000001-14000000 +chr11:14000001-15000000 +chr11:15000001-16000000 +chr11:16000001-17000000 +chr11:17000001-18000000 +chr11:18000001-19000000 +chr11:19000001-20000000 +chr11:20000001-21000000 +chr11:21000001-22000000 +chr11:22000001-23000000 +chr11:23000001-24000000 +chr11:24000001-25000000 +chr11:25000001-26000000 +chr11:26000001-27000000 +chr11:27000001-28000000 +chr11:28000001-29000000 +chr11:29000001-30000000 +chr11:30000001-31000000 +chr11:31000001-32000000 +chr11:32000001-33000000 +chr11:33000001-34000000 +chr11:34000001-35000000 +chr11:35000001-36000000 +chr11:36000001-37000000 +chr11:37000001-38000000 +chr11:38000001-39000000 +chr11:39000001-40000000 +chr11:40000001-41000000 +chr11:41000001-42000000 +chr11:42000001-43000000 +chr11:43000001-44000000 +chr11:44000001-45000000 +chr11:45000001-46000000 +chr11:46000001-47000000 +chr11:47000001-48000000 +chr11:48000001-49000000 +chr11:49000001-50000000 +chr11:50000001-51000000 +chr11:51000001-52000000 +chr11:52000001-53000000 +chr11:53000001-54000000 +chr11:54000001-55000000 +chr11:55000001-56000000 +chr11:56000001-57000000 +chr11:57000001-58000000 +chr11:58000001-59000000 +chr11:59000001-60000000 +chr11:60000001-61000000 +chr11:61000001-62000000 +chr11:62000001-63000000 +chr11:63000001-64000000 +chr11:64000001-65000000 +chr11:65000001-66000000 +chr11:66000001-67000000 +chr11:67000001-68000000 +chr11:68000001-69000000 +chr11:69000001-70000000 +chr11:70000001-71000000 +chr11:71000001-72000000 +chr11:72000001-73000000 +chr11:73000001-74000000 +chr11:74000001-75000000 +chr11:75000001-76000000 +chr11:76000001-77000000 +chr11:77000001-78000000 +chr11:78000001-79000000 +chr11:79000001-80000000 +chr11:80000001-81000000 +chr11:81000001-82000000 +chr11:82000001-83000000 +chr11:83000001-84000000 +chr11:84000001-85000000 +chr11:85000001-86000000 +chr11:86000001-87000000 +chr11:87000001-88000000 +chr11:88000001-89000000 +chr11:89000001-90000000 +chr11:90000001-91000000 +chr11:91000001-92000000 +chr11:92000001-93000000 +chr11:93000001-94000000 +chr11:94000001-95000000 +chr11:95000001-96000000 +chr11:96000001-97000000 +chr11:97000001-98000000 +chr11:98000001-99000000 +chr11:99000001-100000000 +chr11:100000001-101000000 +chr11:101000001-102000000 +chr11:102000001-103000000 +chr11:103000001-104000000 +chr11:104000001-105000000 +chr11:105000001-106000000 +chr11:106000001-107000000 +chr11:107000001-108000000 +chr11:108000001-109000000 +chr11:109000001-110000000 +chr11:110000001-111000000 +chr11:111000001-112000000 +chr11:112000001-113000000 +chr11:113000001-114000000 +chr11:114000001-115000000 +chr11:115000001-116000000 +chr11:116000001-117000000 +chr11:117000001-118000000 +chr11:118000001-119000000 +chr11:119000001-120000000 +chr11:120000001-121000000 +chr11:121000001-122000000 +chr11:122000001-123000000 +chr11:123000001-124000000 +chr11:124000001-125000000 +chr11:125000001-126000000 +chr11:126000001-127000000 +chr11:127000001-128000000 +chr11:128000001-129000000 +chr11:129000001-130000000 +chr11:130000001-131000000 +chr11:131000001-132000000 +chr11:132000001-133000000 +chr11:133000001-134000000 +chr11:134000001-135000000 +chr11:135000001-135086622 +chr12:1-1000000 +chr12:1000001-2000000 +chr12:2000001-3000000 +chr12:3000001-4000000 +chr12:4000001-5000000 +chr12:5000001-6000000 +chr12:6000001-7000000 +chr12:7000001-8000000 +chr12:8000001-9000000 +chr12:9000001-10000000 +chr12:10000001-11000000 +chr12:11000001-12000000 +chr12:12000001-13000000 +chr12:13000001-14000000 +chr12:14000001-15000000 +chr12:15000001-16000000 +chr12:16000001-17000000 +chr12:17000001-18000000 +chr12:18000001-19000000 +chr12:19000001-20000000 +chr12:20000001-21000000 +chr12:21000001-22000000 +chr12:22000001-23000000 +chr12:23000001-24000000 +chr12:24000001-25000000 +chr12:25000001-26000000 +chr12:26000001-27000000 +chr12:27000001-28000000 +chr12:28000001-29000000 +chr12:29000001-30000000 +chr12:30000001-31000000 +chr12:31000001-32000000 +chr12:32000001-33000000 +chr12:33000001-34000000 +chr12:34000001-35000000 +chr12:35000001-36000000 +chr12:36000001-37000000 +chr12:37000001-38000000 +chr12:38000001-39000000 +chr12:39000001-40000000 +chr12:40000001-41000000 +chr12:41000001-42000000 +chr12:42000001-43000000 +chr12:43000001-44000000 +chr12:44000001-45000000 +chr12:45000001-46000000 +chr12:46000001-47000000 +chr12:47000001-48000000 +chr12:48000001-49000000 +chr12:49000001-50000000 +chr12:50000001-51000000 +chr12:51000001-52000000 +chr12:52000001-53000000 +chr12:53000001-54000000 +chr12:54000001-55000000 +chr12:55000001-56000000 +chr12:56000001-57000000 +chr12:57000001-58000000 +chr12:58000001-59000000 +chr12:59000001-60000000 +chr12:60000001-61000000 +chr12:61000001-62000000 +chr12:62000001-63000000 +chr12:63000001-64000000 +chr12:64000001-65000000 +chr12:65000001-66000000 +chr12:66000001-67000000 +chr12:67000001-68000000 +chr12:68000001-69000000 +chr12:69000001-70000000 +chr12:70000001-71000000 +chr12:71000001-72000000 +chr12:72000001-73000000 +chr12:73000001-74000000 +chr12:74000001-75000000 +chr12:75000001-76000000 +chr12:76000001-77000000 +chr12:77000001-78000000 +chr12:78000001-79000000 +chr12:79000001-80000000 +chr12:80000001-81000000 +chr12:81000001-82000000 +chr12:82000001-83000000 +chr12:83000001-84000000 +chr12:84000001-85000000 +chr12:85000001-86000000 +chr12:86000001-87000000 +chr12:87000001-88000000 +chr12:88000001-89000000 +chr12:89000001-90000000 +chr12:90000001-91000000 +chr12:91000001-92000000 +chr12:92000001-93000000 +chr12:93000001-94000000 +chr12:94000001-95000000 +chr12:95000001-96000000 +chr12:96000001-97000000 +chr12:97000001-98000000 +chr12:98000001-99000000 +chr12:99000001-100000000 +chr12:100000001-101000000 +chr12:101000001-102000000 +chr12:102000001-103000000 +chr12:103000001-104000000 +chr12:104000001-105000000 +chr12:105000001-106000000 +chr12:106000001-107000000 +chr12:107000001-108000000 +chr12:108000001-109000000 +chr12:109000001-110000000 +chr12:110000001-111000000 +chr12:111000001-112000000 +chr12:112000001-113000000 +chr12:113000001-114000000 +chr12:114000001-115000000 +chr12:115000001-116000000 +chr12:116000001-117000000 +chr12:117000001-118000000 +chr12:118000001-119000000 +chr12:119000001-120000000 +chr12:120000001-121000000 +chr12:121000001-122000000 +chr12:122000001-123000000 +chr12:123000001-124000000 +chr12:124000001-125000000 +chr12:125000001-126000000 +chr12:126000001-127000000 +chr12:127000001-128000000 +chr12:128000001-129000000 +chr12:129000001-130000000 +chr12:130000001-131000000 +chr12:131000001-132000000 +chr12:132000001-133000000 +chr12:133000001-133275309 +chr13:1-1000000 +chr13:1000001-2000000 +chr13:2000001-3000000 +chr13:3000001-4000000 +chr13:4000001-5000000 +chr13:5000001-6000000 +chr13:6000001-7000000 +chr13:7000001-8000000 +chr13:8000001-9000000 +chr13:9000001-10000000 +chr13:10000001-11000000 +chr13:11000001-12000000 +chr13:12000001-13000000 +chr13:13000001-14000000 +chr13:14000001-15000000 +chr13:15000001-16000000 +chr13:16000001-17000000 +chr13:17000001-18000000 +chr13:18000001-19000000 +chr13:19000001-20000000 +chr13:20000001-21000000 +chr13:21000001-22000000 +chr13:22000001-23000000 +chr13:23000001-24000000 +chr13:24000001-25000000 +chr13:25000001-26000000 +chr13:26000001-27000000 +chr13:27000001-28000000 +chr13:28000001-29000000 +chr13:29000001-30000000 +chr13:30000001-31000000 +chr13:31000001-32000000 +chr13:32000001-33000000 +chr13:33000001-34000000 +chr13:34000001-35000000 +chr13:35000001-36000000 +chr13:36000001-37000000 +chr13:37000001-38000000 +chr13:38000001-39000000 +chr13:39000001-40000000 +chr13:40000001-41000000 +chr13:41000001-42000000 +chr13:42000001-43000000 +chr13:43000001-44000000 +chr13:44000001-45000000 +chr13:45000001-46000000 +chr13:46000001-47000000 +chr13:47000001-48000000 +chr13:48000001-49000000 +chr13:49000001-50000000 +chr13:50000001-51000000 +chr13:51000001-52000000 +chr13:52000001-53000000 +chr13:53000001-54000000 +chr13:54000001-55000000 +chr13:55000001-56000000 +chr13:56000001-57000000 +chr13:57000001-58000000 +chr13:58000001-59000000 +chr13:59000001-60000000 +chr13:60000001-61000000 +chr13:61000001-62000000 +chr13:62000001-63000000 +chr13:63000001-64000000 +chr13:64000001-65000000 +chr13:65000001-66000000 +chr13:66000001-67000000 +chr13:67000001-68000000 +chr13:68000001-69000000 +chr13:69000001-70000000 +chr13:70000001-71000000 +chr13:71000001-72000000 +chr13:72000001-73000000 +chr13:73000001-74000000 +chr13:74000001-75000000 +chr13:75000001-76000000 +chr13:76000001-77000000 +chr13:77000001-78000000 +chr13:78000001-79000000 +chr13:79000001-80000000 +chr13:80000001-81000000 +chr13:81000001-82000000 +chr13:82000001-83000000 +chr13:83000001-84000000 +chr13:84000001-85000000 +chr13:85000001-86000000 +chr13:86000001-87000000 +chr13:87000001-88000000 +chr13:88000001-89000000 +chr13:89000001-90000000 +chr13:90000001-91000000 +chr13:91000001-92000000 +chr13:92000001-93000000 +chr13:93000001-94000000 +chr13:94000001-95000000 +chr13:95000001-96000000 +chr13:96000001-97000000 +chr13:97000001-98000000 +chr13:98000001-99000000 +chr13:99000001-100000000 +chr13:100000001-101000000 +chr13:101000001-102000000 +chr13:102000001-103000000 +chr13:103000001-104000000 +chr13:104000001-105000000 +chr13:105000001-106000000 +chr13:106000001-107000000 +chr13:107000001-108000000 +chr13:108000001-109000000 +chr13:109000001-110000000 +chr13:110000001-111000000 +chr13:111000001-112000000 +chr13:112000001-113000000 +chr13:113000001-114000000 +chr13:114000001-114364328 +chr14:1-1000000 +chr14:1000001-2000000 +chr14:2000001-3000000 +chr14:3000001-4000000 +chr14:4000001-5000000 +chr14:5000001-6000000 +chr14:6000001-7000000 +chr14:7000001-8000000 +chr14:8000001-9000000 +chr14:9000001-10000000 +chr14:10000001-11000000 +chr14:11000001-12000000 +chr14:12000001-13000000 +chr14:13000001-14000000 +chr14:14000001-15000000 +chr14:15000001-16000000 +chr14:16000001-17000000 +chr14:17000001-18000000 +chr14:18000001-19000000 +chr14:19000001-20000000 +chr14:20000001-21000000 +chr14:21000001-22000000 +chr14:22000001-23000000 +chr14:23000001-24000000 +chr14:24000001-25000000 +chr14:25000001-26000000 +chr14:26000001-27000000 +chr14:27000001-28000000 +chr14:28000001-29000000 +chr14:29000001-30000000 +chr14:30000001-31000000 +chr14:31000001-32000000 +chr14:32000001-33000000 +chr14:33000001-34000000 +chr14:34000001-35000000 +chr14:35000001-36000000 +chr14:36000001-37000000 +chr14:37000001-38000000 +chr14:38000001-39000000 +chr14:39000001-40000000 +chr14:40000001-41000000 +chr14:41000001-42000000 +chr14:42000001-43000000 +chr14:43000001-44000000 +chr14:44000001-45000000 +chr14:45000001-46000000 +chr14:46000001-47000000 +chr14:47000001-48000000 +chr14:48000001-49000000 +chr14:49000001-50000000 +chr14:50000001-51000000 +chr14:51000001-52000000 +chr14:52000001-53000000 +chr14:53000001-54000000 +chr14:54000001-55000000 +chr14:55000001-56000000 +chr14:56000001-57000000 +chr14:57000001-58000000 +chr14:58000001-59000000 +chr14:59000001-60000000 +chr14:60000001-61000000 +chr14:61000001-62000000 +chr14:62000001-63000000 +chr14:63000001-64000000 +chr14:64000001-65000000 +chr14:65000001-66000000 +chr14:66000001-67000000 +chr14:67000001-68000000 +chr14:68000001-69000000 +chr14:69000001-70000000 +chr14:70000001-71000000 +chr14:71000001-72000000 +chr14:72000001-73000000 +chr14:73000001-74000000 +chr14:74000001-75000000 +chr14:75000001-76000000 +chr14:76000001-77000000 +chr14:77000001-78000000 +chr14:78000001-79000000 +chr14:79000001-80000000 +chr14:80000001-81000000 +chr14:81000001-82000000 +chr14:82000001-83000000 +chr14:83000001-84000000 +chr14:84000001-85000000 +chr14:85000001-86000000 +chr14:86000001-87000000 +chr14:87000001-88000000 +chr14:88000001-89000000 +chr14:89000001-90000000 +chr14:90000001-91000000 +chr14:91000001-92000000 +chr14:92000001-93000000 +chr14:93000001-94000000 +chr14:94000001-95000000 +chr14:95000001-96000000 +chr14:96000001-97000000 +chr14:97000001-98000000 +chr14:98000001-99000000 +chr14:99000001-100000000 +chr14:100000001-101000000 +chr14:101000001-102000000 +chr14:102000001-103000000 +chr14:103000001-104000000 +chr14:104000001-105000000 +chr14:105000001-106000000 +chr14:106000001-107000000 +chr14:107000001-107043718 +chr15:1-1000000 +chr15:1000001-2000000 +chr15:2000001-3000000 +chr15:3000001-4000000 +chr15:4000001-5000000 +chr15:5000001-6000000 +chr15:6000001-7000000 +chr15:7000001-8000000 +chr15:8000001-9000000 +chr15:9000001-10000000 +chr15:10000001-11000000 +chr15:11000001-12000000 +chr15:12000001-13000000 +chr15:13000001-14000000 +chr15:14000001-15000000 +chr15:15000001-16000000 +chr15:16000001-17000000 +chr15:17000001-18000000 +chr15:18000001-19000000 +chr15:19000001-20000000 +chr15:20000001-21000000 +chr15:21000001-22000000 +chr15:22000001-23000000 +chr15:23000001-24000000 +chr15:24000001-25000000 +chr15:25000001-26000000 +chr15:26000001-27000000 +chr15:27000001-28000000 +chr15:28000001-29000000 +chr15:29000001-30000000 +chr15:30000001-31000000 +chr15:31000001-32000000 +chr15:32000001-33000000 +chr15:33000001-34000000 +chr15:34000001-35000000 +chr15:35000001-36000000 +chr15:36000001-37000000 +chr15:37000001-38000000 +chr15:38000001-39000000 +chr15:39000001-40000000 +chr15:40000001-41000000 +chr15:41000001-42000000 +chr15:42000001-43000000 +chr15:43000001-44000000 +chr15:44000001-45000000 +chr15:45000001-46000000 +chr15:46000001-47000000 +chr15:47000001-48000000 +chr15:48000001-49000000 +chr15:49000001-50000000 +chr15:50000001-51000000 +chr15:51000001-52000000 +chr15:52000001-53000000 +chr15:53000001-54000000 +chr15:54000001-55000000 +chr15:55000001-56000000 +chr15:56000001-57000000 +chr15:57000001-58000000 +chr15:58000001-59000000 +chr15:59000001-60000000 +chr15:60000001-61000000 +chr15:61000001-62000000 +chr15:62000001-63000000 +chr15:63000001-64000000 +chr15:64000001-65000000 +chr15:65000001-66000000 +chr15:66000001-67000000 +chr15:67000001-68000000 +chr15:68000001-69000000 +chr15:69000001-70000000 +chr15:70000001-71000000 +chr15:71000001-72000000 +chr15:72000001-73000000 +chr15:73000001-74000000 +chr15:74000001-75000000 +chr15:75000001-76000000 +chr15:76000001-77000000 +chr15:77000001-78000000 +chr15:78000001-79000000 +chr15:79000001-80000000 +chr15:80000001-81000000 +chr15:81000001-82000000 +chr15:82000001-83000000 +chr15:83000001-84000000 +chr15:84000001-85000000 +chr15:85000001-86000000 +chr15:86000001-87000000 +chr15:87000001-88000000 +chr15:88000001-89000000 +chr15:89000001-90000000 +chr15:90000001-91000000 +chr15:91000001-92000000 +chr15:92000001-93000000 +chr15:93000001-94000000 +chr15:94000001-95000000 +chr15:95000001-96000000 +chr15:96000001-97000000 +chr15:97000001-98000000 +chr15:98000001-99000000 +chr15:99000001-100000000 +chr15:100000001-101000000 +chr15:101000001-101991189 +chr16:1-1000000 +chr16:1000001-2000000 +chr16:2000001-3000000 +chr16:3000001-4000000 +chr16:4000001-5000000 +chr16:5000001-6000000 +chr16:6000001-7000000 +chr16:7000001-8000000 +chr16:8000001-9000000 +chr16:9000001-10000000 +chr16:10000001-11000000 +chr16:11000001-12000000 +chr16:12000001-13000000 +chr16:13000001-14000000 +chr16:14000001-15000000 +chr16:15000001-16000000 +chr16:16000001-17000000 +chr16:17000001-18000000 +chr16:18000001-19000000 +chr16:19000001-20000000 +chr16:20000001-21000000 +chr16:21000001-22000000 +chr16:22000001-23000000 +chr16:23000001-24000000 +chr16:24000001-25000000 +chr16:25000001-26000000 +chr16:26000001-27000000 +chr16:27000001-28000000 +chr16:28000001-29000000 +chr16:29000001-30000000 +chr16:30000001-31000000 +chr16:31000001-32000000 +chr16:32000001-33000000 +chr16:33000001-34000000 +chr16:34000001-35000000 +chr16:35000001-36000000 +chr16:36000001-37000000 +chr16:37000001-38000000 +chr16:38000001-39000000 +chr16:39000001-40000000 +chr16:40000001-41000000 +chr16:41000001-42000000 +chr16:42000001-43000000 +chr16:43000001-44000000 +chr16:44000001-45000000 +chr16:45000001-46000000 +chr16:46000001-47000000 +chr16:47000001-48000000 +chr16:48000001-49000000 +chr16:49000001-50000000 +chr16:50000001-51000000 +chr16:51000001-52000000 +chr16:52000001-53000000 +chr16:53000001-54000000 +chr16:54000001-55000000 +chr16:55000001-56000000 +chr16:56000001-57000000 +chr16:57000001-58000000 +chr16:58000001-59000000 +chr16:59000001-60000000 +chr16:60000001-61000000 +chr16:61000001-62000000 +chr16:62000001-63000000 +chr16:63000001-64000000 +chr16:64000001-65000000 +chr16:65000001-66000000 +chr16:66000001-67000000 +chr16:67000001-68000000 +chr16:68000001-69000000 +chr16:69000001-70000000 +chr16:70000001-71000000 +chr16:71000001-72000000 +chr16:72000001-73000000 +chr16:73000001-74000000 +chr16:74000001-75000000 +chr16:75000001-76000000 +chr16:76000001-77000000 +chr16:77000001-78000000 +chr16:78000001-79000000 +chr16:79000001-80000000 +chr16:80000001-81000000 +chr16:81000001-82000000 +chr16:82000001-83000000 +chr16:83000001-84000000 +chr16:84000001-85000000 +chr16:85000001-86000000 +chr16:86000001-87000000 +chr16:87000001-88000000 +chr16:88000001-89000000 +chr16:89000001-90000000 +chr16:90000001-90338345 +chr17:1-1000000 +chr17:1000001-2000000 +chr17:2000001-3000000 +chr17:3000001-4000000 +chr17:4000001-5000000 +chr17:5000001-6000000 +chr17:6000001-7000000 +chr17:7000001-8000000 +chr17:8000001-9000000 +chr17:9000001-10000000 +chr17:10000001-11000000 +chr17:11000001-12000000 +chr17:12000001-13000000 +chr17:13000001-14000000 +chr17:14000001-15000000 +chr17:15000001-16000000 +chr17:16000001-17000000 +chr17:17000001-18000000 +chr17:18000001-19000000 +chr17:19000001-20000000 +chr17:20000001-21000000 +chr17:21000001-22000000 +chr17:22000001-23000000 +chr17:23000001-24000000 +chr17:24000001-25000000 +chr17:25000001-26000000 +chr17:26000001-27000000 +chr17:27000001-28000000 +chr17:28000001-29000000 +chr17:29000001-30000000 +chr17:30000001-31000000 +chr17:31000001-32000000 +chr17:32000001-33000000 +chr17:33000001-34000000 +chr17:34000001-35000000 +chr17:35000001-36000000 +chr17:36000001-37000000 +chr17:37000001-38000000 +chr17:38000001-39000000 +chr17:39000001-40000000 +chr17:40000001-41000000 +chr17:41000001-42000000 +chr17:42000001-43000000 +chr17:43000001-44000000 +chr17:44000001-45000000 +chr17:45000001-46000000 +chr17:46000001-47000000 +chr17:47000001-48000000 +chr17:48000001-49000000 +chr17:49000001-50000000 +chr17:50000001-51000000 +chr17:51000001-52000000 +chr17:52000001-53000000 +chr17:53000001-54000000 +chr17:54000001-55000000 +chr17:55000001-56000000 +chr17:56000001-57000000 +chr17:57000001-58000000 +chr17:58000001-59000000 +chr17:59000001-60000000 +chr17:60000001-61000000 +chr17:61000001-62000000 +chr17:62000001-63000000 +chr17:63000001-64000000 +chr17:64000001-65000000 +chr17:65000001-66000000 +chr17:66000001-67000000 +chr17:67000001-68000000 +chr17:68000001-69000000 +chr17:69000001-70000000 +chr17:70000001-71000000 +chr17:71000001-72000000 +chr17:72000001-73000000 +chr17:73000001-74000000 +chr17:74000001-75000000 +chr17:75000001-76000000 +chr17:76000001-77000000 +chr17:77000001-78000000 +chr17:78000001-79000000 +chr17:79000001-80000000 +chr17:80000001-81000000 +chr17:81000001-82000000 +chr17:82000001-83000000 +chr17:83000001-83257441 +chr18:1-1000000 +chr18:1000001-2000000 +chr18:2000001-3000000 +chr18:3000001-4000000 +chr18:4000001-5000000 +chr18:5000001-6000000 +chr18:6000001-7000000 +chr18:7000001-8000000 +chr18:8000001-9000000 +chr18:9000001-10000000 +chr18:10000001-11000000 +chr18:11000001-12000000 +chr18:12000001-13000000 +chr18:13000001-14000000 +chr18:14000001-15000000 +chr18:15000001-16000000 +chr18:16000001-17000000 +chr18:17000001-18000000 +chr18:18000001-19000000 +chr18:19000001-20000000 +chr18:20000001-21000000 +chr18:21000001-22000000 +chr18:22000001-23000000 +chr18:23000001-24000000 +chr18:24000001-25000000 +chr18:25000001-26000000 +chr18:26000001-27000000 +chr18:27000001-28000000 +chr18:28000001-29000000 +chr18:29000001-30000000 +chr18:30000001-31000000 +chr18:31000001-32000000 +chr18:32000001-33000000 +chr18:33000001-34000000 +chr18:34000001-35000000 +chr18:35000001-36000000 +chr18:36000001-37000000 +chr18:37000001-38000000 +chr18:38000001-39000000 +chr18:39000001-40000000 +chr18:40000001-41000000 +chr18:41000001-42000000 +chr18:42000001-43000000 +chr18:43000001-44000000 +chr18:44000001-45000000 +chr18:45000001-46000000 +chr18:46000001-47000000 +chr18:47000001-48000000 +chr18:48000001-49000000 +chr18:49000001-50000000 +chr18:50000001-51000000 +chr18:51000001-52000000 +chr18:52000001-53000000 +chr18:53000001-54000000 +chr18:54000001-55000000 +chr18:55000001-56000000 +chr18:56000001-57000000 +chr18:57000001-58000000 +chr18:58000001-59000000 +chr18:59000001-60000000 +chr18:60000001-61000000 +chr18:61000001-62000000 +chr18:62000001-63000000 +chr18:63000001-64000000 +chr18:64000001-65000000 +chr18:65000001-66000000 +chr18:66000001-67000000 +chr18:67000001-68000000 +chr18:68000001-69000000 +chr18:69000001-70000000 +chr18:70000001-71000000 +chr18:71000001-72000000 +chr18:72000001-73000000 +chr18:73000001-74000000 +chr18:74000001-75000000 +chr18:75000001-76000000 +chr18:76000001-77000000 +chr18:77000001-78000000 +chr18:78000001-79000000 +chr18:79000001-80000000 +chr18:80000001-80373285 +chr19:1-1000000 +chr19:1000001-2000000 +chr19:2000001-3000000 +chr19:3000001-4000000 +chr19:4000001-5000000 +chr19:5000001-6000000 +chr19:6000001-7000000 +chr19:7000001-8000000 +chr19:8000001-9000000 +chr19:9000001-10000000 +chr19:10000001-11000000 +chr19:11000001-12000000 +chr19:12000001-13000000 +chr19:13000001-14000000 +chr19:14000001-15000000 +chr19:15000001-16000000 +chr19:16000001-17000000 +chr19:17000001-18000000 +chr19:18000001-19000000 +chr19:19000001-20000000 +chr19:20000001-21000000 +chr19:21000001-22000000 +chr19:22000001-23000000 +chr19:23000001-24000000 +chr19:24000001-25000000 +chr19:25000001-26000000 +chr19:26000001-27000000 +chr19:27000001-28000000 +chr19:28000001-29000000 +chr19:29000001-30000000 +chr19:30000001-31000000 +chr19:31000001-32000000 +chr19:32000001-33000000 +chr19:33000001-34000000 +chr19:34000001-35000000 +chr19:35000001-36000000 +chr19:36000001-37000000 +chr19:37000001-38000000 +chr19:38000001-39000000 +chr19:39000001-40000000 +chr19:40000001-41000000 +chr19:41000001-42000000 +chr19:42000001-43000000 +chr19:43000001-44000000 +chr19:44000001-45000000 +chr19:45000001-46000000 +chr19:46000001-47000000 +chr19:47000001-48000000 +chr19:48000001-49000000 +chr19:49000001-50000000 +chr19:50000001-51000000 +chr19:51000001-52000000 +chr19:52000001-53000000 +chr19:53000001-54000000 +chr19:54000001-55000000 +chr19:55000001-56000000 +chr19:56000001-57000000 +chr19:57000001-58000000 +chr19:58000001-58617616 +chr20:1-1000000 +chr20:1000001-2000000 +chr20:2000001-3000000 +chr20:3000001-4000000 +chr20:4000001-5000000 +chr20:5000001-6000000 +chr20:6000001-7000000 +chr20:7000001-8000000 +chr20:8000001-9000000 +chr20:9000001-10000000 +chr20:10000001-11000000 +chr20:11000001-12000000 +chr20:12000001-13000000 +chr20:13000001-14000000 +chr20:14000001-15000000 +chr20:15000001-16000000 +chr20:16000001-17000000 +chr20:17000001-18000000 +chr20:18000001-19000000 +chr20:19000001-20000000 +chr20:20000001-21000000 +chr20:21000001-22000000 +chr20:22000001-23000000 +chr20:23000001-24000000 +chr20:24000001-25000000 +chr20:25000001-26000000 +chr20:26000001-27000000 +chr20:27000001-28000000 +chr20:28000001-29000000 +chr20:29000001-30000000 +chr20:30000001-31000000 +chr20:31000001-32000000 +chr20:32000001-33000000 +chr20:33000001-34000000 +chr20:34000001-35000000 +chr20:35000001-36000000 +chr20:36000001-37000000 +chr20:37000001-38000000 +chr20:38000001-39000000 +chr20:39000001-40000000 +chr20:40000001-41000000 +chr20:41000001-42000000 +chr20:42000001-43000000 +chr20:43000001-44000000 +chr20:44000001-45000000 +chr20:45000001-46000000 +chr20:46000001-47000000 +chr20:47000001-48000000 +chr20:48000001-49000000 +chr20:49000001-50000000 +chr20:50000001-51000000 +chr20:51000001-52000000 +chr20:52000001-53000000 +chr20:53000001-54000000 +chr20:54000001-55000000 +chr20:55000001-56000000 +chr20:56000001-57000000 +chr20:57000001-58000000 +chr20:58000001-59000000 +chr20:59000001-60000000 +chr20:60000001-61000000 +chr20:61000001-62000000 +chr20:62000001-63000000 +chr20:63000001-64000000 +chr20:64000001-64444167 +chr21:1-1000000 +chr21:1000001-2000000 +chr21:2000001-3000000 +chr21:3000001-4000000 +chr21:4000001-5000000 +chr21:5000001-6000000 +chr21:6000001-7000000 +chr21:7000001-8000000 +chr21:8000001-9000000 +chr21:9000001-10000000 +chr21:10000001-11000000 +chr21:11000001-12000000 +chr21:12000001-13000000 +chr21:13000001-14000000 +chr21:14000001-15000000 +chr21:15000001-16000000 +chr21:16000001-17000000 +chr21:17000001-18000000 +chr21:18000001-19000000 +chr21:19000001-20000000 +chr21:20000001-21000000 +chr21:21000001-22000000 +chr21:22000001-23000000 +chr21:23000001-24000000 +chr21:24000001-25000000 +chr21:25000001-26000000 +chr21:26000001-27000000 +chr21:27000001-28000000 +chr21:28000001-29000000 +chr21:29000001-30000000 +chr21:30000001-31000000 +chr21:31000001-32000000 +chr21:32000001-33000000 +chr21:33000001-34000000 +chr21:34000001-35000000 +chr21:35000001-36000000 +chr21:36000001-37000000 +chr21:37000001-38000000 +chr21:38000001-39000000 +chr21:39000001-40000000 +chr21:40000001-41000000 +chr21:41000001-42000000 +chr21:42000001-43000000 +chr21:43000001-44000000 +chr21:44000001-45000000 +chr21:45000001-46000000 +chr21:46000001-46709983 +chr22:1-1000000 +chr22:1000001-2000000 +chr22:2000001-3000000 +chr22:3000001-4000000 +chr22:4000001-5000000 +chr22:5000001-6000000 +chr22:6000001-7000000 +chr22:7000001-8000000 +chr22:8000001-9000000 +chr22:9000001-10000000 +chr22:10000001-11000000 +chr22:11000001-12000000 +chr22:12000001-13000000 +chr22:13000001-14000000 +chr22:14000001-15000000 +chr22:15000001-16000000 +chr22:16000001-17000000 +chr22:17000001-18000000 +chr22:18000001-19000000 +chr22:19000001-20000000 +chr22:20000001-21000000 +chr22:21000001-22000000 +chr22:22000001-23000000 +chr22:23000001-24000000 +chr22:24000001-25000000 +chr22:25000001-26000000 +chr22:26000001-27000000 +chr22:27000001-28000000 +chr22:28000001-29000000 +chr22:29000001-30000000 +chr22:30000001-31000000 +chr22:31000001-32000000 +chr22:32000001-33000000 +chr22:33000001-34000000 +chr22:34000001-35000000 +chr22:35000001-36000000 +chr22:36000001-37000000 +chr22:37000001-38000000 +chr22:38000001-39000000 +chr22:39000001-40000000 +chr22:40000001-41000000 +chr22:41000001-42000000 +chr22:42000001-43000000 +chr22:43000001-44000000 +chr22:44000001-45000000 +chr22:45000001-46000000 +chr22:46000001-47000000 +chr22:47000001-48000000 +chr22:48000001-49000000 +chr22:49000001-50000000 +chr22:50000001-50818468 +chrX:1-1000000 +chrX:1000001-2000000 +chrX:2000001-3000000 +chrX:3000001-4000000 +chrX:4000001-5000000 +chrX:5000001-6000000 +chrX:6000001-7000000 +chrX:7000001-8000000 +chrX:8000001-9000000 +chrX:9000001-10000000 +chrX:10000001-11000000 +chrX:11000001-12000000 +chrX:12000001-13000000 +chrX:13000001-14000000 +chrX:14000001-15000000 +chrX:15000001-16000000 +chrX:16000001-17000000 +chrX:17000001-18000000 +chrX:18000001-19000000 +chrX:19000001-20000000 +chrX:20000001-21000000 +chrX:21000001-22000000 +chrX:22000001-23000000 +chrX:23000001-24000000 +chrX:24000001-25000000 +chrX:25000001-26000000 +chrX:26000001-27000000 +chrX:27000001-28000000 +chrX:28000001-29000000 +chrX:29000001-30000000 +chrX:30000001-31000000 +chrX:31000001-32000000 +chrX:32000001-33000000 +chrX:33000001-34000000 +chrX:34000001-35000000 +chrX:35000001-36000000 +chrX:36000001-37000000 +chrX:37000001-38000000 +chrX:38000001-39000000 +chrX:39000001-40000000 +chrX:40000001-41000000 +chrX:41000001-42000000 +chrX:42000001-43000000 +chrX:43000001-44000000 +chrX:44000001-45000000 +chrX:45000001-46000000 +chrX:46000001-47000000 +chrX:47000001-48000000 +chrX:48000001-49000000 +chrX:49000001-50000000 +chrX:50000001-51000000 +chrX:51000001-52000000 +chrX:52000001-53000000 +chrX:53000001-54000000 +chrX:54000001-55000000 +chrX:55000001-56000000 +chrX:56000001-57000000 +chrX:57000001-58000000 +chrX:58000001-59000000 +chrX:59000001-60000000 +chrX:60000001-61000000 +chrX:61000001-62000000 +chrX:62000001-63000000 +chrX:63000001-64000000 +chrX:64000001-65000000 +chrX:65000001-66000000 +chrX:66000001-67000000 +chrX:67000001-68000000 +chrX:68000001-69000000 +chrX:69000001-70000000 +chrX:70000001-71000000 +chrX:71000001-72000000 +chrX:72000001-73000000 +chrX:73000001-74000000 +chrX:74000001-75000000 +chrX:75000001-76000000 +chrX:76000001-77000000 +chrX:77000001-78000000 +chrX:78000001-79000000 +chrX:79000001-80000000 +chrX:80000001-81000000 +chrX:81000001-82000000 +chrX:82000001-83000000 +chrX:83000001-84000000 +chrX:84000001-85000000 +chrX:85000001-86000000 +chrX:86000001-87000000 +chrX:87000001-88000000 +chrX:88000001-89000000 +chrX:89000001-90000000 +chrX:90000001-91000000 +chrX:91000001-92000000 +chrX:92000001-93000000 +chrX:93000001-94000000 +chrX:94000001-95000000 +chrX:95000001-96000000 +chrX:96000001-97000000 +chrX:97000001-98000000 +chrX:98000001-99000000 +chrX:99000001-100000000 +chrX:100000001-101000000 +chrX:101000001-102000000 +chrX:102000001-103000000 +chrX:103000001-104000000 +chrX:104000001-105000000 +chrX:105000001-106000000 +chrX:106000001-107000000 +chrX:107000001-108000000 +chrX:108000001-109000000 +chrX:109000001-110000000 +chrX:110000001-111000000 +chrX:111000001-112000000 +chrX:112000001-113000000 +chrX:113000001-114000000 +chrX:114000001-115000000 +chrX:115000001-116000000 +chrX:116000001-117000000 +chrX:117000001-118000000 +chrX:118000001-119000000 +chrX:119000001-120000000 +chrX:120000001-121000000 +chrX:121000001-122000000 +chrX:122000001-123000000 +chrX:123000001-124000000 +chrX:124000001-125000000 +chrX:125000001-126000000 +chrX:126000001-127000000 +chrX:127000001-128000000 +chrX:128000001-129000000 +chrX:129000001-130000000 +chrX:130000001-131000000 +chrX:131000001-132000000 +chrX:132000001-133000000 +chrX:133000001-134000000 +chrX:134000001-135000000 +chrX:135000001-136000000 +chrX:136000001-137000000 +chrX:137000001-138000000 +chrX:138000001-139000000 +chrX:139000001-140000000 +chrX:140000001-141000000 +chrX:141000001-142000000 +chrX:142000001-143000000 +chrX:143000001-144000000 +chrX:144000001-145000000 +chrX:145000001-146000000 +chrX:146000001-147000000 +chrX:147000001-148000000 +chrX:148000001-149000000 +chrX:149000001-150000000 +chrX:150000001-151000000 +chrX:151000001-152000000 +chrX:152000001-153000000 +chrX:153000001-154000000 +chrX:154000001-155000000 +chrX:155000001-156000000 +chrX:156000001-156040895 +chrY:1-1000000 +chrY:1000001-2000000 +chrY:2000001-3000000 +chrY:3000001-4000000 +chrY:4000001-5000000 +chrY:5000001-6000000 +chrY:6000001-7000000 +chrY:7000001-8000000 +chrY:8000001-9000000 +chrY:9000001-10000000 +chrY:10000001-11000000 +chrY:11000001-12000000 +chrY:12000001-13000000 +chrY:13000001-14000000 +chrY:14000001-15000000 +chrY:15000001-16000000 +chrY:16000001-17000000 +chrY:17000001-18000000 +chrY:18000001-19000000 +chrY:19000001-20000000 +chrY:20000001-21000000 +chrY:21000001-22000000 +chrY:22000001-23000000 +chrY:23000001-24000000 +chrY:24000001-25000000 +chrY:25000001-26000000 +chrY:26000001-27000000 +chrY:27000001-28000000 +chrY:28000001-29000000 +chrY:29000001-30000000 +chrY:30000001-31000000 +chrY:31000001-32000000 +chrY:32000001-33000000 +chrY:33000001-34000000 +chrY:34000001-35000000 +chrY:35000001-36000000 +chrY:36000001-37000000 +chrY:37000001-38000000 +chrY:38000001-39000000 +chrY:39000001-40000000 +chrY:40000001-41000000 +chrY:41000001-42000000 +chrY:42000001-43000000 +chrY:43000001-44000000 +chrY:44000001-45000000 +chrY:45000001-46000000 +chrY:46000001-47000000 +chrY:47000001-48000000 +chrY:48000001-49000000 +chrY:49000001-50000000 +chrY:50000001-51000000 +chrY:51000001-52000000 +chrY:52000001-53000000 +chrY:53000001-54000000 +chrY:54000001-55000000 +chrY:55000001-56000000 +chrY:56000001-57000000 +chrY:57000001-57227415 +chrM:1-16569 diff --git a/aws_launch/rufus.env b/aws_launch/rufus.env new file mode 100644 index 00000000..919b9f48 --- /dev/null +++ b/aws_launch/rufus.env @@ -0,0 +1,30 @@ +# Required arguments for all modes +SUBJECT_FILE=" # Full path to file +REFERENCE_FASTA="" # Full path to file +THREAD_LIMIT=20 # Number of threads allotted to individual RUFUS run +KMER_DEPTH_CUTOFF=5 # How many times a kmer must be seen in a subject to be retained (recommend >=3) +RUFUS_DOCKER_IMAGE="stefinfection/rufus:latest" + +# Required for region mode +WINDOW_SIZE=1000 # Leave empty for whole genome mode +JOB_THRESHOLD=10 # Number of jobs to run in parallel if using region mode +REGION_FILE="" # Leave empty for whole genome, use full path if not + +# Required for paired control mode +CONTROL_FILE_ARRAY=() # May be in different locations, use full paths + +# Optional run time arguments +WORKING_DIR="" # Set if you don't want RUFUS working in and writing to the current directory + +# Optional algorithmic arguments +KMER_LENGTH= # Defaults to 25 +OTHER_FLAGS="-L -vs" # See RUFUS github for all options + +# Optional internal control arguments +CONTROL_HASH_VERSION="v1.0" # Necessary only if want to fetch non-default hash version +CONTROL_HASH_LOCAL_DIR="" # Leave empty if only using paired control or want to fetch from S3 as needed + +# Optional 1000G arguments +KG1_HASH_VERSION="v3.0" # Necessary only if want to fetch non-default hash version +KG1_HASH_LOCAL_DIR="" # Leave empty if want to fetch from S3 as needed +NO_KG1_REMOVAL="" # Set to "TRUE" if want to keep variants found in 1000G cohort (will override KG1_HASH_LOCAL_DIR and KG1_HASH_VERSION) \ No newline at end of file diff --git a/aws_launch/singularity/build_singularity_rufus.sh b/aws_launch/singularity/build_singularity_rufus.sh new file mode 100644 index 00000000..94943d65 --- /dev/null +++ b/aws_launch/singularity/build_singularity_rufus.sh @@ -0,0 +1,2 @@ +export SINGULARITY_TMPDIR=/home/ubuntu/singularity_tmp +sudo -E singularity build rufus.sif rufus_singularity.def diff --git a/build_updated.sh b/build_updated.sh new file mode 100644 index 00000000..3610ba24 --- /dev/null +++ b/build_updated.sh @@ -0,0 +1,4 @@ +export LDFLAGS="-L/opt/libstdc++-compat -Wl,-rpath,/opt/libstdc++-compat" +cmake -DCMAKE_EXE_LINKER_FLAGS="-L/opt/libstdc++-compat -Wl,-rpath,/opt/libstdc++-compat" .. +make + diff --git a/docs/RUFUS.interpret.audit.md b/docs/RUFUS.interpret.audit.md new file mode 100644 index 00000000..d6b402b7 --- /dev/null +++ b/docs/RUFUS.interpret.audit.md @@ -0,0 +1,504 @@ +# RUFUS.interpret — functional documentation and defect audit + +Audit of `src/RUFUS.interpret.cpp` (7,388 lines) and its pipeline boundary, July 2026. +Produced by a nine-way parallel review covering every region of the file plus the upstream contract. + +**Confidence marking.** Findings marked **[V]** were verified directly against source, compiled +test programs, or real run output. Findings marked **[R]** are reported by review and are +well-argued but were not independently re-checked. Treat [R] as a strong lead, not a fact. + +--- + +# Part 1 — What RUFUS.interpret does + +## 1.1 Position in the pipeline + +`RUFUS.interpret` is the final stage. It is invoked from exactly one place, +`scripts/Overlap.shorter.sh:373`: + +``` +samtools view -h .bam | perl AddSAtoReadSame.pl | grep -v chrUn \ + | RUFUS.interpret -mob … -mod … -mQ 10 -r -hf -o \ + -m -sR … -s … -e … -rp … -ip … -plct … +``` + +Input is **assembled contigs aligned back to the reference**, not reads. By this point the +read→contig mapping has been discarded by the overlap assembler. Everything the caller knows +about allele support arrives as k-mer count tables. + +## 1.2 The five inputs and what they populate + +| Flag | File | In-memory table | Notes | +|---|---|---|---| +| `-hf` | `.k25_c.HashList` | `Hash` (`map`) | Subject-unique k-mers. **Also sets global `HashSize` from the first line's string length.** | +| `-s` / `-sR` | `…fastq.sample` / `…fastq.Ref.sample` | `MutantHashes` (merged) | Subject counts for contig k-mers and for reference k-mers | +| `-c` / `-cR` ×N | `ctrlhash.…` | `ParentHashes[i]` (merged) | One map per control; **paired with `-c` by ordinal position only** | +| `-e` | `.ref.RepRefHash` | `ExcludeHashes` | Repeat/artifact veto | +| `-mod` | `.Jhash.histo.7.7.dist` | `DistGlobal`, `GenPrior` | Copy-number depth model — **see §2.1, this usually fails to load** | + +Two extra channels are smuggled through the SAM rather than passed explicitly: + +- **The QUAL string is not base quality.** `AnnotateOverlap` overwrites it with the per-base + count of subject-unique k-mers covering that base, ASCII+33, **capped at 93**. `createPeakMap()` + reads it as a signal and marks local maxima; those peaks are what designate a variant "DeNovo" + and what gate nearly every SV breakpoint decision. +- **Strand counts live in the contig name.** `parse()` splits QNAME on `:` and reads fields 1 and 2 + as forward/reverse read counts. This is the *only* strand information in the program. + +## 1.3 The core data model — `SamRead` + +`getRefSeq()` (2821) expands each contig into a **column-aligned** representation. One column per +expanded-CIGAR position, and every vector shares that index space: + +| CIGAR op | `RefSeq` | `seq` | `cigarString` out | `Positions` | +|---|---|---|---|---| +| `M` | ref base | read base | `M` if match, **`X` if mismatch** | `pos+i-InsOffset` | +| `I` | `-` | read base | `I` | previous ref position | +| `D` | ref base | `-` | `D` | ref position | +| `S` | `-` | read base | `S` | fabricated (extrapolated) | +| `H` | `H` | `H` | `H` | `-1` | +| `Y` | `-` | read base | `Y` | (tandem dup, injected by `BetterWay`) | + +**The invariant** (nothing asserts it, and it is broken in several places — §3): + +``` +seq == RefSeq == cigarString == qual == strand == Positions == ChrPositions == PeakMap + == AltKmers == RefKmers == MutAltCounts == MutRefCounts == MutContigCounts + == MutHashListCounts == ParAltCounts[pi] == ParRefCounts[pi] (all same length) +``` + +**The sentinel convention** in the count vectors: + +| Value | Meaning | +|---|---| +| `> 0` | a real k-mer count | +| `0` | alt k-mer is identical to the ref k-mer (this column is not variant) | +| `-1` | a k-mer exists here but is absent from the lookup table | +| `-3` | no k-mer at this column (`getHash` returned `""`) | +| `< 0` in `MutContigCounts` only | a *negated real count* — collides with the `-3` sentinel | + +Live consumers filter with `> 0`, which correctly excludes all three sentinels. `CheckPhase` is +the exception and is broken because of it (§3, D3). + +## 1.4 Processing flow in `main()` + +After setup, `main()` makes **six sequential passes** over one `vector reads`. +Contigs are never explicitly grouped into events; grouping is emergent via the `alignments` list +and, for multi-contig SVs, via **adjacency in the vector**. + +| Pass | Lines | What it does | +|---|---|---| +| 0 | 5437–5461 | Pair alignments by QNAME string match (O(n²)); build `alignments` lists | +| 1 | 5462–5466 | `LookUpKmers`, `CheckPhase`, `clipPattern = ClipPattern()` | +| 2 | 5471–5660 | Multi-contig mobile elements → `` | +| 3 | 5661–5907 | Multi-contig large DEL/DUP → ``, `` (**only >1 kb**) | +| 4 | 5909–5982 | `BetterWay` collapse, then `parseMutations` → all SNVs/indels | +| 5 | 5986–7377 | Six independent SV blocks: translocation/BND, inversion, triple-align insertion, large insertion, orphan MOB, `LastDitch` BND | + +### `clipPattern` vocabulary + +`ClipPattern()` collapses the expanded CIGAR into `{c, m}`, keeping only runs longer than ~10. +The SV code branches on this constantly: + +- `"mc"` — aligned block then clip; breakend at the **right** end +- `"cm"` — clip then aligned block; breakend at the **left** end +- `"mc"`/`"cm"` as a *pair* is the canonical split-contig signature +- `"mcm"`, `"cmc"` — multi-junction; mostly unhandled +- `"mm"`, `"cc"` — **non-alternating**, produced when an intervening short run is dropped without + resetting the run character. Accepted by the `length()==2` gates as if they were real pairs. [R] + +### `parseMutations` — the small-variant caller (2402–2778) + +Single loop `for (i = 25; i < cigarString.size() - 25; i++)`. A record is emitted iff: + +1. contig passed `mapQual > MinMapQual` and `alignments.size() <= 2`; +2. `cigarString[i] ∈ {X, I, D, Y}` and `RefSeq[i] != 'N'`; +3. at least one column in the maximal run has encoded depth `> '!'`. + +**No filter suppresses emission** — filters only decorate the ID and FILTER columns. The run is +extended forward while the op stays in `{X,I,D,Y}`, so `XIX` and `XDDX` become single complex +records. Indels get a left-anchor base by walking backward to the first column with a real +`ChrPositions` entry. + +### `BetterWay` — split-contig collapse (3158–4128) + +Takes exactly two `SamRead`s (primary + supplementary of the same contig) **by value** and returns +one synthetic read with the inter-alignment gap materialised as explicit `D` or `Y` columns — the +form `parseMutations` understands. So a split-read SV becomes an ordinary indel call. Six phases: + +1. Build a 2-row column alignment, inserting gaps so both reads share an index space +2. Find the first anchored column +3. `bestQual` — restore the k-mer depth track destroyed by hard clipping +4. The merge walk: emit `D` runs for deletions, `Y` runs for tandem dups, classify oversize events +5. Rewrite internal clips to `I`; **discard the entire merge if ≥150 clip bases remain** +6. Opposite-strand branch: writes side-channel files only, produces no merged record + +Because the input is by value, nothing written to `reads[1]` escapes; and the caller assigns the +result into a *local copy*, so the master `reads` vector is never updated either. + +### Genotyping and AO/RO + +Three independent paths that share almost no code: + +| Path | Function | AO/RO estimator | Genotyper | +|---|---|---|---| +| SNV/indel (WGS) | `GetModes3` (1651) | filtered arithmetic **mean** (`PickDepthSomatic`) | `BayseanGenotyper` | +| SNV/indel (exome) | `GetModes` (1770) | off-center **median** `[(size-2)/2]` | `ShittyGenotyper` | +| SV/BND | `createStructGenotype` (879) | sorted `[0]` — the **minimum** | `ShittyGenotyper` | + +`resources/vcf_header.txt` describes all of them as "Mode of … kmer counts", which is wrong in +every path. **AO/RO are k-mer depth statistics, not read counts.** QUAL is +`SupportingHashes / PossibleAltKmer * 100` — a percentage, not a Phred score. + +The Bayesian model, as implemented: for each column of `DistGlobal` it **sums** per-k-mer +likelihoods rather than multiplying them, so evidence never accumulates (3 k-mers and 300 give the +same posterior shape) and a single repeat-inflated k-mer can outvote fifty consistent ones. The +normalizer `Pb` omits the prior, so `PaB` is not a probability — harmless for `argmax`, but the +posterior is then discarded anyway, which is why there is no GQ or PL anywhere in the output. [R] + +--- + +# Part 2 — The findings that change the plan + +These are the four things worth knowing before touching anything else. + +## 2.1 The copy-number model is never built, in any run mode, and the genotyper is inert **[V]** + +`ModelDist` writes **both** `.7.7.model` and `.7.7.dist` (`src/ModelDist.cpp:392, 403`), but it +never runs. The model phase is gated on `[ -z "$_arg_min" ] && [ $_arg_exome == "FALSE" ]`, and +`_arg_min` is initialised to `5` in the defaults block and **never cleared** — so the first test +is never true and the `else` branch always executes, hand-writing a 4-line `.7.7.model` +placeholder and never creating `.7.7.dist` at all. + +This is **not** a property of `-min` or exome mode; passing `-min` changes nothing, because the +default already defeats the condition. The commented-out prior condition one line above the gate +is the smoking gun: originally every non-exome run built the model, and adding the +`-z "$_arg_min"` conjunct silently disabled it for everyone. The help text compounded it by +claiming `-m,--min` has "no default", which is false. + +Confirmed across **every** run in `resources/reg_test_files/runs/`: zero `*.7.7.dist` files, +fifteen `*.7.7.model` placeholders, zero logs containing "Starting model phase", six containing +"min was provided". The actual behaviour is now documented inline at the gate, at the `_arg_min` +default, and in both help blocks in `runRufus.sh`. + +`Overlap.shorter.sh:373` unconditionally passes `-mod .Jhash.histo.7.7.dist`. +`ProcessDist` (4755) treats a failed open as **non-fatal** — it prints and returns, leaving +`DistGlobal` and `GenPrior` empty. + +Verified in the `chr20_m5` regression run: + +``` +chr20_17559175.out:173: Error no model file given, not worring abou this now +on disk: …Jhash.histo.7.7.model (exists) + …Jhash.histo.7.7.dist (absent) +``` + +Downstream consequence, verified on that run's final post-processed VCF (1,137 records): + +``` +GT distribution: 1137 "." ← zero genotypes +FILTER distribution: 1137 "." ← zero PASS +``` + +**Scope correction (added after building the replay harness).** Replaying interpret +directly on the same inputs gives 1,680 raw records, of which **3 carry `FILTER=PASS` and +5 carry real genotypes** (4× `0/1`, 1× `1/1`). So the failure is confined to the +**SNV/indel path**, which routes through `BayseanGenotyper` and therefore depends on the +model file. The SV/BND paths use `ShittyGenotyper` — pure arithmetic on two counts, no +model — and set `FILTER=PASS` independently, so they still produce genotypes and passing +calls. Post-processing then removes those few, which is why the final VCF looks totally +empty of both. Read every claim in this section as "in the SNV/indel path". Reproduce with: + +``` +./tests/replay/replay.sh run ../resources/reg_test_files/runs/chr20_m5/rufus_chr20 +``` + +The cascade: `DistGlobal` empty → `sums` empty → `maxI = -1` → no genotype branch matches → +`ParseGenotype("","")` returns `"."` → line 2609 sees no `1` in the genotype and overwrites +`Denovo = "Mosaic"` on **every** variant, erasing the PeakMap-derived DeNovo signal → line 2670's +`PASS` condition (`Denovo == "DeNovo"`) becomes unreachable. + +So three of the most visible output defects — no genotypes, everything labelled Mosaic, no PASS — +are one plumbing failure. `Dist1XCutoff` also falls back to `100000`, which disables +`PickDepthSomatic`'s repeat filter; this is exactly the value the author's TODO at line 1451 +recorded observing in real COLO829 output without following up. + +**Important caveat before fixing:** simply making the model load will *not* produce correct +genotypes. It activates three currently-dormant defects — the shadowing bug at 1586 (which +specifically breaks homozygous calls, since `maxI ≥ 3` ⇔ ≥2 copies), out-of-bounds reads at +1488/1509/1539, and unconstrained GT ploidy in `ParseGenotype`. Those must be fixed in the same +change or the first real model file makes output worse. + +## 2.2 There is no "is this allele present in the control?" check for SNVs **[R]** + +For a tool whose premise is subtracting the control, this is the biggest functional gap. + +The genotype-based comparison is **commented out** at 2693–2696. Per-parent genotypes *are* +computed (2512–2522, at the cost of four full vector copies per parent per variant) and *are* +emitted in the sample columns — and then used for nothing. + +What remains is a k-mer heuristic at 2583 that requires `parentCounts[k][j] ≤ ParLowCovThreshold` +(default 7). It has an **upper** bound, so a control carrying the variant at normal depth is +invisible to it. The review reports 129/1675 emitted calls in a production VCF with control +`AO > 7`, 17 of them carrying no filter at all. + +The SV path uses a different function (`SVCheckParentsForLowCov`) with the **opposite** convention: +SNVs sum low counts *across* controls, SVs *reject* anything low in more than one control. + +## 2.3 A large class of coordinate and VCF-validity defects, partly masked by downstream band-aids + +`runRufus.sh:1496–1585` contains an awk sanitizer that drops records with empty/invalid REF or ALT, +a tabix retry loop that deletes up to 50 more malformed records, and +`bcftools +fill-from-fasta -c REF` which **overwrites REF from the reference FASTA**. Those exist +because interpret emits exactly those defects — and the `fill-from-fasta` step converts a +detectable inconsistency into a plausible-looking, undetectable wrong call. + +Concretely: REF is fetched one base to the right of POS at 5 of 13 SV emission sites (the other 8 +are consistent, so this is a divergence, not a uniform convention error); every non-PASS FILTER +value carries a trailing `;` producing an empty filter ID; `FEX=` embeds raw semicolons from +`filterSV()`; `EN=` emits six comma-separated values plus a 50 bp raw sequence under a +`Number=1,Type=String` declaration; ``, ``, ``, `` and `FILTER=fail` are +undeclared in the header. **100% of BND records are unmated** — the ID column is a composite +string like `OrphanBND-LC=0bnd_1-DeNovo` while MATEID is the bare `bnd_2`, so they can never +match, and the reciprocal `LastDitch` call reassigns both BNDids anyway. [R] + +**Verified on a production run (SMHT004 3A, 300× whole-genome, `-m 5`, DSA + tech control, Jul 2026) [V]:** +the undeclared `FILTER=fail` is real and reaches downstream tools — `bcftools` emitted +`[W::vcf_parse_filter] FILTER 'fail' is not defined in the header` on the RUFUS.Interpret output, +and the `runRufus.sh` sanitizer dropped **13 of 2662 records** as malformed (2649 kept). The +surviving genotyped VCF (`gx.wg.vcf.gz`, 1,354 calls) carries `FILTER=.` on **100%** of records — +i.e. §2.1's inert-genotyper failure also reproduces here. So both the §2.3 header-validity defects +and the §2.1 model-absent cascade reproduce on real whole-genome data, not just the `chr20_m5` +regression. (This run did pass `-min`, but per the corrected §2.1 that is immaterial: the model +phase is unreachable regardless, so `-min` versus whole-genome was never the distinguishing +factor.) + +## 2.4 Two independent k-mer extraction passes with different correctness properties **[R]** + +`LookUpKmers` (2948) and `BuildUpHashCountTable` (1310) both walk the contig building k-mer/count +arrays, with different masking rules and different sentinels. `GetModes3`/`GetModes` consume the +first; the parent low-coverage heuristics consume the second. Only the second guards k-mer length. + +This matters because `HashToLong` (100) is **length-blind** (verified by compiling it): unused bits +are zero and `00` encodes `A`, so a truncated 20-mer hashes identically to the full 25-mer with +`AAAAA` appended. `getHash` returns short strings at contig ends, so the trailing `HashSize-1` +columns of every contig look up whatever count the A-padded k-mer happens to have. It is also +silently degenerate above k=32 with no validation on `-hs`, and non-ACGT characters (including +**lowercase** — i.e. any soft-masked reference) encode as `A`. + +Consolidating these two passes should precede any AO/RO work. + +--- + +# Part 3 — Defect inventory + +Ranked within each tier. `file:line` refers to `src/RUFUS.interpret.cpp` unless stated. + +## Tier 1 — silently wrong output + +| # | Location | Defect | +|---|---|---| +| A1 | `runRufus.sh:1177` + `4759` | Model file absent in `-min`/exome runs; failure is non-fatal → genotyper inert **[V]** | +| A2 | `1586–1590` | Variable shadowing leaves `C` uninitialized when `maxI > 2` → garbage AO/RO at copy number >2 **[V]** | +| A3 | `2840–2853` | Leading `H` followed by `S`: only the hard clip is subtracted, so **every coordinate in the contig shifts**. Author's own comment at 2900 flags it **[R]** | +| A4 | `2693–2696` | Parent genotype comparison commented out; surviving check has an upper bound (§2.2) **[R]** | +| A5 | `2609` / `2670` | `Denovo` overwritten to `Mosaic` on every record; `PASS` unreachable **[V]** | +| A6 | `1678` vs `1686` | AO filtered against `ExcludeHashes`, RO not → AF biased wherever the artifact control touches a locus **[V]** | +| A7 | `2454–2462` | Indel anchor accepts `I`/`D`/`S` columns → REF or ALT becomes `"-"` or empty; record dropped downstream and **the real indel is lost** **[R]** | +| A8 | `1431` vs `1651` | QUAL numerator/denominator use different windows and filters → QUAL > 100 **[V]** | +| A9 | `2419` + `2467` | Interior non-ACGT bases silently dropped from REF/ALT, shortening the allele **[R]** | +| A10 | `1826` | Exome path filters *parent* alt counts using the *reference* k-mer (copy-paste) **[R]** | +| A11 | `3200`, `3221` | `BetterWay` indexes `reads[B].cigarString` with `Acount` → rows de-phase, heap over-read **[R]** | +| A12 | `3897` | `BetterWay` hard-codes `'M'` for B's cigar → **all SNVs/indels on the B side of a collapsed split read are never called** **[R]** | +| A13 | `3432` | Deletion REF fill indexes by column `i` instead of reference coordinate `j` **[R]** | +| A14 | `2137–2158` | `CheckPhase` misreads the `0` sentinel; all branches dead → `PH=none` on every record **[R]** | +| A15 | `2306` | `tempPeakMap[i] == tempPeakMap[i-1];` — comparison not assignment; the deletion fixup never runs **[R]** | + +## Tier 2 — crashes, UB, out-of-bounds + +| # | Location | Defect | +|---|---|---| +| B1 | `100–121` | `HashToLong` length-blind, non-ACGT→`A`, silent aliasing above k=32, `-hs` unvalidated **[V]** | +| B2 | `4783–4791` | `ProcessDist` writes one past the end of `DistGlobal`; first data row stored one column off **[R]** | +| B3 | `1488`, `1509`, `1539` | Depth clamp uses `>` where `>=` needed, then indexes at exactly `size()` **[R]** | +| B4 | `6371`, `6582`, `6820` | Mutating loop variable `i` inside the inner `j` loop → `alignments[1]` out of bounds **[R]** | +| B5 | `2414`, `1313`, `2289` | `size() - 25` / `size() - HashSize` unsigned underflow on short contigs **[R]** | +| B6 | `3277`, `3314` | Unhandled CIGAR op doesn't advance the cursor → infinite loop + unbounded growth **[R]** | +| B7 | `2910` | `=`/`X`/`N`/`P` unhandled: `N`/`P` walk `seq` index past the end; `=`/`X` silently drop every base **[R]** | +| B8 | `3443` + 12 sites | `PeakMap[Abreak-1]` evaluated before the `Abreak > 0` guard (`and` short-circuits left to right) **[R]** | +| B9 | `6918` | `substr` with `pos = -1` → `SIZE_MAX` → uncaught `out_of_range` **aborts mid-VCF** **[R]** | +| B10 | `3352–3364` | Unbounded scan for first anchored column **[R]** | +| B11 | `3076–3083` | Guard is `size() >= 2` but body reads `temp2[2]` **[R]** | +| B12 | `2833–2837` | `getRefSeq` early-returns on unknown contig but the read is still admitted → empty `Positions`, OOB later. Directly relevant to chromosome-sharded runs **[R]** | +| B13 | `4914–4982` | Every flag reads `argv[i+1]` with no bounds check **[R]** | +| B14 | `5107–5109` | `-cR` loop writes into `ParentHashes[i]` sized by the `-c` count **[R]** | + +## Tier 3 — silent-failure / operability + +- **Fatal errors return 0.** Unknown flag, missing `-r`, missing `-hf`, unopenable SAM all exit + successfully (`4987, 4994, 4998, 5276`), and interpret runs at the end of a pipe. The driver + reports "no variants found for this region". Note `-hS` in the help text vs `-hs` in the parser. [R] +- **No `is_open()` check on any of the six hash inputs** (`5036, 5076, 5101, 5126, 5138, 5156`). + An empty `ParentHashes` makes every variant look de novo, with no warning. `CheckJellyHashList.sh` + wraps `jellyfish query` in `timeout 1h` with no `set -e`, so a timeout writes a **truncated file + and reports success**. [R] +- **Early `return 0` before the `#CHROM` line** (`5404`) emits a VCF with meta-lines and no header + line for any empty shard — `bcftools` rejects it. [R] +- **SV records emit one sample column** while the header declares `1 + controls` (`4744` et al.), + so any trio/tumour-normal run that emits an SV produces a ragged VCF. [R] +- **`operator[]` used for read-only lookups** on `ExcludeHashes`, `Hash`, `ParentHashes` + (`768, 829, 1672, 1691, 1802, 1838`) — inserts a zero entry on every miss, growing the tables + without bound. Worse, at `1684` the membership gate is `Hash.count(...)` while `1691` does + `Hash[...]`, so **AO becomes order-dependent**: a k-mer inserted by one variant passes the gate + for a later one. [R] +- **`##fileDate` is epoch seconds**, not `YYYYMMDD` (`5301`). [R] +- Non-unique ID column throughout; `SVTYPE=TRANS` and `COPY:PASTE` are not valid VCF types. [R] + +## Tier 4 — dead, stubbed, or never wired up + +- **`src/SamRead.h` / `src/SamRead.cpp` are a second, divergent copy of the `SamRead` class that + nothing compiles** (absent from `CMakeLists.txt`). A fix applied there will appear to do nothing. + Worth resolving as part of the CI/CD consolidation. **[R]** +- `processMultiAlignment()` (2030) — empty stub, `//check if this is a mis-joined contig`. Never + called. Mis-joined contigs are exactly what produces the dominant `PA` filter. +- `FixTandemRef()` (2798) — **never called** (only call site commented out at 4116). So `RefSeq` + over `Y` columns stays `-` and every tandem dup is emitted as a plain insertion, built on a + knowingly-wrong reference. The whole DUP:TANDEM path operates on it. +- `StructCall` is computed by `compressVar` and **omitted from the live output statement** — all + `SVTYPE=DUP`/`END`/`SVLEN` annotation for tandem dups is computed and thrown away. It is also + never cleared between variants, so uncommenting the alternative output line at 2740 would + immediately mis-annotate SNVs as duplications. +- The mmap/binary-search block (`checkPage`/`ProcessPage`/`search`, 123–310) is entirely dead and + contains a use-after-`munmap` — it has never successfully run. Delete it. **[R]** +- `CheckTranslocation`, `CheckMob`, `CheckPolyATail`, `CheckLargeInsert` (4299–4313) — all + `return false;`, none called. Note `CheckMob` shadows the live member `SamRead::checkMob` by + capitalization only. +- `StartsWithAlign`, `EndsWithAlign`, `StartsWithAlignAtPeak`, `EndsWithAlignAtPeak` — defined, + never called, and each carries out-of-bounds indexing. +- `GetModes2` (1719–1769) — fully commented-out earlier draft of `GetModes3`, plus a live + declaration and a commented call. Delete. +- `PickDepth` never called; `PickDepthAverage` reachable only via the shadowed-`C` branch. +- `-w`/`isWindowed` parsed and never read; `-hs` always overwritten at 5218; `-plct` undocumented. +- `totalDeleted`, `totalAdded`, `ScGlobal`, `candidateHash`, `MaxBND`, `UsedForBigVar` — never read. +- `MutHashListCounts` and `MutContigCounts` — computed at cost per base per contig, read only by + the never-called `writeVertical` and by the inert `CheckPhase`. +- Entropy (`w1`–`w5`) is emitted into `EN=` and never thresholded or used. +- **Six auxiliary output files** (`BEDOutFile`, `BEDBigStuff`, `BEDNotHandled`, `Invertions`, + `Translocations`, `Unaligned`) — nothing in the repository reads any of them. Two are + misleadingly named: `Invertions` and `Translocations` are written only by `BetterWay`, never by + the SV classifier that actually emits `` and BND records. **[R]** +- All SV classification inside `BetterWay` (inversions, translocations, mobile elements, oversize + events) writes to those side channels and **produces no VCF output at all**. + +## Hard-coded values that should be parameters + +`0.997` (dist coverage), `100000` (no-model `Dist1XCutoff`), `GenPrior = 1/i`, `< 400` AO/RO +ceilings (×4, with the author's own "should be based on cov" comment), `150` (BetterWay merge +discard), `MaxVarentSize + 1000` (×8), `25` in `parseMutations`' loop bounds (should be +`HashSize`), `10` (clipPattern run length), `NumLowCov > 25`, `"hs37d5"` hard-coded as the decoy +contig in five branches (silently never fires on GRCh38/T2T), strand-bias thresholds of +`0.99/0.01` in `filterSV` versus `0.99999/0.00001` in `parseMutations` — the two paths disagree +with each other, and neither matches the 95/5 + DP≥30 model from the strand-bias work. + +--- + +# Part 4 — Upstream data needs + +This is the question that determines whether fixes are local or structural. + +## 4.1 Fixable entirely inside interpret + +Everything in Tier 1 A2/A5/A6/A7/A9/A10/A13, all of Tier 2, all of Tier 3, all of Tier 4. +Also: reference-orient `SB` using the SAM `0x10` flag before emitting it; validate `HashSize <= 32` +and cross-check k across all hash files at load; replace `operator[]` with `find()` on every table. + +## 4.2 Requires an upstream change, ranked by value per unit cost + +**Rank 1 — make the model file reach interpret, or make its absence fatal.** +`runRufus.sh` must either run `ModelDist` in `-min`/exome mode or pass an explicit +`--no-model` so that "model missing" and "model deliberately not used" are distinguishable from +"model failed to build". Today all three are silent. Cost: a few lines. This is the single +highest-value change in the list, but see the §2.1 caveat — fix A2/B3 and GT ploidy in the same +change. + +**Rank 2 — control k-mers counted at `-L 1`, or a "was-filtered" marker.** +`jellyfish count -L 2` on controls means a k-mer seen **exactly once** in a parent does not exist +in the control table. `jellyfish query` returns 0, interpret reads "not in parent", and it +contributes to a de novo call. The whole `ParLowCovThreshold` band (1..7) can never observe count 1 +at current defaults. Cost: one default change, or a cheap second query pass restricted to the +contig k-mer set. **No new file format.** [R] + +**Rank 3 — stop capping counts at `MaxCov=100000` silently.** +k-mers above the ceiling are *deleted from the file*, so interpret sees them as absent rather than +as saturating repeats — a high-copy repeat k-mer looks like clean de novo evidence. Emit a +saturation sentinel instead and teach interpret to treat it as "repeat, do not call". [R] + +**Rank 4 — parse `SA:Z:`.** It is already in the input (`AddSAtoReadSame.pl` puts it there) and +interpret ignores it entirely — `parse()` scans optional fields for `AS` only. It states directly +what several code paths spend hundreds of lines re-deriving by heuristic: which alignments belong +together, and where the clipped sequence goes. It would replace the O(n²) QNAME matching in Pass 0, +the vector-adjacency window scans in Passes 2/3/5 (currently `j ∈ [-2,2]`, so contig pairing +depends on the aligner emitting the two halves of a junction within two lines of each other), and +the `H`-vs-`S` position asymmetry. **This is the highest-value item for SV quality.** [R] + +**Rank 5 — align with `bwa mem -Y`.** Hard-clipped supplementary alignments physically lack their +bases, so `getRefSeq` writes literal `'H'` into `seq`/`RefSeq` and every k-mer overlapping the clip +becomes `-3`. A supplementary alignment therefore contributes **no k-mer evidence near its own +breakpoint** — the most informative region. `-Y` supplies the bases and also removes the entire +`bestQual` phase in `BetterWay`. Cost: one flag. [R] + +**Rank 6 — pass real read-level support.** Two tiers: +- *Cheap:* `F` and `R` in the QNAME are already a read count (`F+R` = reads assembled into the + contig), and interpret uses them only for the strand ratio. Reporting `F+R` in INFO needs no + upstream change. [R] +- *Real:* a sidecar `contig → [read, offset, orientation]` from the overlap assembler. This is the + **only** route to true AO/RO, and it simultaneously enables position-level strand bias. Largest + cost, largest quality win. + +**Rank 7 — preserve per-base assembly depth.** `AnnotateOverlap` overwrites the depth-encoded QUAL +with the k-mer count, and the ASCII channel caps at 93 — already below the depth of the samples +this runs on. `'!'` doubles as both "depth zero" and "no data". An integer array tag would remove +the ambiguity and the ceiling. + +**Rank 8 — replace filename-as-API with a manifest.** Sample names are reverse-engineered by string +surgery: the subject from `-o` (truncate at `.generator`, strip trailing `.chr`), controls from the +literal marker `"overlap.asembly.hash.fastq."`. In whole-genome mode there is no `.chr`, so the +same subject gets a **different VCF sample name** in WG versus region runs. `Overlap.shorter.sh` +carries a comment explicitly documenting that it is named to accommodate this C++ parsing quirk. +A small manifest (subject name, control names in `-c` order, k, cutoffs actually applied, region) +retires that coupling and makes the other fixes safe to ship. This is the same class of problem as +the 255-char filename bug already fixed. [R] + +**Also needed:** hash files carry no header, so interpret *infers* k from the first line's length, +*assumes* the separator, and *assumes* canonicalization. A one-line header recording k, canonical +yes/no, min/max coverage and producer version would turn a whole class of silent-wrong-answer +failures into startup errors. And `MaxBND`/`CurrentSVeventID` are per-process globals starting at +0, so BND and SV event IDs **collide across shards** when per-shard VCFs are concatenated. + +--- + +# Part 5 — Suggested sequencing + +0. **Replay harness — done.** `tests/replay/` re-runs interpret standalone against a + preserved run directory in ~3 minutes and diffs VCF, scraped log signals and exit code + against a frozen baseline. `tests/replay/baselines/chr20_m5` is frozen and verified + deterministic. Run `./tests/replay/replay.sh check ` after every + change; exit 2 means behaviour moved. Note the chr20_m5 baseline exercises the + *model-absent* path only — a baseline from a run with a real `.7.7.dist` is needed + before touching `BayseanGenotyper`. + +1. **Instrument first.** Turn the silent failures into loud ones: `is_open()` checks on all six + inputs, non-zero exit on fatal paths, validate `HashSize <= 32` and k-consistency across hash + files, fail on an unknown contig. Nothing else can be trusted until a broken run looks broken. +2. **Fix the model plumbing plus its three dormant dependents together** (A1 + A2 + B3 + GT ploidy). + Expect the output to change substantially — genotypes and PASS will appear for the first time. +3. **Consolidate the two k-mer extraction passes** and fix `HashToLong` length handling (§2.4). + This is a prerequisite for any trustworthy AO/RO work. +4. **Then** the AO/RO and QUAL fixes that started this investigation (A6, A8) — they are cheap once + 3 is done, and premature without it. +5. **Coordinate correctness pass** (A3, A7, A9, A13, the REF/POS off-by-ones) with a round-trip + test against the reference, so the downstream `fill-from-fasta` band-aid can be removed. +6. **Delete the dead code** (Tier 4) before restructuring anything — roughly 1,500 lines, including + one whole uncompiled duplicate class. +7. **Then** decide on the upstream changes. `SA:Z:` parsing (Rank 4) and `bwa mem -Y` (Rank 5) are + the two that unlock the most, and neither requires a new file format. diff --git a/docs/publish_new_sif.md b/docs/publish_new_sif.md index 579f2d76..e31d146b 100644 --- a/docs/publish_new_sif.md +++ b/docs/publish_new_sif.md @@ -1,7 +1,98 @@ -To publish a new sif image: +# Building and publishing RUFUS containers -1. Create a new zenodo upload with proper new versioning -2. Update singularity git branch README.md to point to new sif -3. Merge singularity branch into master -4. Pull request master to marthlab git repo -5. Put a copy of sif on chpc at /uufs/chpc.utah.edu/common/HIPAA/u0746015/marth_software/RUFUS/zenodo_images +RUFUS has **one** container definition — the root [`Dockerfile`](../Dockerfile). There is no +separate Singularity `.def`; SIFs are produced from the Docker image via `apptainer`. Builds, +tests, and publishing are automated by [`.github/workflows/build-publish.yml`](../.github/workflows/build-publish.yml). + +## Submodule: modified jellyfish + +RUFUS's custom jellyfish fork lives in its own repository +([stefinfection/modified-jellyfish](https://github.com/stefinfection/modified-jellyfish)) and is +pinned here as a git submodule at `src/modifiedJellyfish`. The container build compiles it from +that submodule. **Clone RUFUS with the submodule**, or the build (and any local `cmake`) will fail: +```bash +git clone --recursive https://github.com/stefinfection/RUFUS.git +# already cloned without --recursive: +git submodule update --init --recursive +``` +To change the jellyfish source: edit/commit/tag the modified-jellyfish repo, then in RUFUS +`cd src/modifiedJellyfish && git checkout && cd ../.. && git add src/modifiedJellyfish` +and commit the updated pointer. + +## Tag mapping (CI) + +| Git event | Docker Hub tag(s) | Stage | +|--------------------------|-------------------------------------------|-------| +| push to `docker` / `dev` | `stefinfection/rufus:dev` | dev | +| push to `main` | `stefinfection/rufus:stage` | stage | +| push git tag `v*` | `stefinfection/rufus:` + `:latest` | prod | + +Every build runs [`tests/smoke_test.sh`](../tests/smoke_test.sh) inside the freshly built image +and only pushes if it passes. + +## Cutting a production release + +1. Bump `RUFUS_VERSION` in [`resources/globals.txt`](../resources/globals.txt), commit, and merge + to `main`. The release guard in CI fails the build if the git tag and `RUFUS_VERSION` disagree, + so the bump must be committed *before* tagging and must be on the commit you tag. +2. Tag and push. Read the version out of `globals.txt` rather than typing it, so the tag and the + guard can never disagree — this is the same extraction the workflow performs: + ```bash + VERSION=$(grep -E '^RUFUS_VERSION=' resources/globals.txt | cut -d'"' -f2) + echo "tagging $VERSION" + git tag "$VERSION" + git push origin "$VERSION" + ``` +3. CI then automatically: + - builds the image, smoke-tests it, and pushes `:` + `:latest` to Docker Hub; + - builds a SIF from that image with `apptainer`; + - publishes it as a **new version of the existing Zenodo concept record** (shared concept DOI). + +## Staging / using an image on HPC (CHPC) + +Pull a published image straight into a SIF — no `sudo`, no manual `.def` build: +```bash +bash singularity/pull_staged_image.sh stage # staging image +bash singularity/pull_staged_image.sh "$(grep -E '^RUFUS_VERSION=' resources/globals.txt \ + | cut -d'"' -f2)" # current prod release +``` +This writes `rufus_.sif` into the zenodo_images dir and runs the smoke test against it. + +## Required GitHub repo secrets + +Set these on the `stefinfection/RUFUS` repository (Settings → Secrets and variables → Actions): + +| Secret | Purpose | +|----------------------------|----------------------------------------------------| +| `DOCKERHUB_USERNAME` | Docker Hub login | +| `DOCKERHUB_TOKEN` | Docker Hub access token (push) | +| `ZENODO_TOKEN` | Zenodo token (`deposit:write` + `deposit:actions`) | +| `ZENODO_CONCEPT_RECORD_ID` | Concept (all-versions) record id of the RUFUS Zenodo record | + +## Known follow-up: give the Zenodo asset a stable name + +**Do this after the first `v*` tag has published successfully — not before.** + +`README.md` is the only place that still has to carry a literal version, and the reason is the +Zenodo download URL. Both halves of that URL move every release: the record id, because each +release is a new version record, and the filename, because +[`scripts/ci/zenodo_upload.sh`](../scripts/ci/zenodo_upload.sh) uploads +`$(basename "$SIF_PATH")`, i.e. `rufus_.sif`. So the README needs editing every release, +which is exactly the drift [`scripts/ci/check_doc_versions.sh`](../scripts/ci/check_doc_versions.sh) +currently exists to police. + +The durable fix removes the problem rather than guarding it: + +1. Upload the SIF under a **stable name** (`rufus.sif`) in `zenodo_upload.sh` — either instead of, + or in addition to, the versioned name. The image self-identifies its version anyway, via the + OCI `org.opencontainers.image.version` label and the runtime banner. +2. Point the README at the **concept record**, which always resolves to the latest version, giving + a permanent URL of the form + `https://zenodo.org/records//files/rufus.sif`. +3. Drop the README rules from `check_doc_versions.sh`; the guard becomes unnecessary. + +Two things to confirm when doing this. The README currently references **two different** record ids +(`18284901` in the prose link, and the download URL) — establish which is the concept record and use +that one consistently. And the reason for waiting is that step 1 modifies the release job, which is +the single irreversible, least-exercised part of the pipeline: a published Zenodo version cannot be +retracted, so it should not be the change under test on the run that first proves the job works. diff --git a/externals/jellyfish.cmake b/externals/jellyfish.cmake index 13c32dce..f38a1d90 100644 --- a/externals/jellyfish.cmake +++ b/externals/jellyfish.cmake @@ -21,5 +21,4 @@ ExternalProject_Get_Property(${JELLYFISH_PROJECT} INSTALL_DIR) ExternalProject_Get_Property(${JELLYFISH_PROJECT} SOURCE_DIR) ExternalProject_Get_Property(${JELLYFISH_PROJECT} BINARY_DIR) -SET(JELLYFISH_INCLUDE ${SOURCE_DIR} CACHE INTERNAL "JELLYFISH INCLUDE") - +SET(JELLYFISH_INCLUDE ${SOURCE_DIR} CACHE INTERNAL "JELLYFISH INCLUDE") \ No newline at end of file diff --git a/externals/modifiedJellyfish.cmake b/externals/modifiedJellyfish.cmake index 5a3915c8..ce681070 100644 --- a/externals/modifiedJellyfish.cmake +++ b/externals/modifiedJellyfish.cmake @@ -7,7 +7,16 @@ SET(MODIFIED_JELLYFISH_LIB) ExternalProject_Add(${MODIFIED_JELLYFISH_PROJECT} - URL ${PROJECT_SOURCE_DIR}/src/modifiedJellyfish.tar.gz + # Source lives in the src/modifiedJellyfish git submodule (repo: stefinfection/modified-jellyfish). + # Copy it into the build tree and build there (BUILD_IN_SOURCE) so the tracked submodule working + # copy stays pristine -- no configure/make artifacts leak back into it. + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/src/modifiedJellyfish ${PROJECT_SOURCE_DIR}/bin/externals/modified_jellyfish/src/modified_jellyfish_project + + # git checkout / copy_directory reset file mtimes, so make would see configure as older than + # configure.ac and try to regenerate it with autoconf (which fails). Touch the generated + # autotools files AFTER their sources so they look up-to-date and no regeneration is attempted. + # (The old tarball path avoided this because tar preserved the original mtime ordering.) + PATCH_COMMAND bash -c "touch configure.ac aclocal.m4 && find . -name Makefile.am -exec touch {} + && touch configure config.h.in && find . -name Makefile.in -exec touch {} +" CONFIGURE_COMMAND ${PROJECT_SOURCE_DIR}/bin/externals/modified_jellyfish/src/modified_jellyfish_project/configure --prefix=${PROJECT_SOURCE_DIR}/bin/externals/modified_jellyfish/src/modified_jellyfish_project/ BUILD_IN_SOURCE 1 diff --git a/post_process/add_hd_med.add_hd_af.sh b/post_process/add_hd_med.add_hd_af.sh index 69f9c138..c6bfa1f3 100644 --- a/post_process/add_hd_med.add_hd_af.sh +++ b/post_process/add_hd_med.add_hd_af.sh @@ -1,15 +1,39 @@ #!/bin/bash +set -euo pipefail + +: "${WORK_DIR:?WORK_DIR must be set}" # Calculates and adds an HD_MED info field and allele frequency field to the first column of the vcf file (in RUFUS, this is the tumor/subject) and adds a format field to that same first column with the tag HD_AF. This value is the HD_MED / DP[0]. Prints new file to "hd_af.$IN_VCF". -IN_VCF=$1 +IN_VCF=$1 # THIS VCF MUST HAVE A REGION SPECIFIC NAME IF RUNNING REGION MODE IN PARALLEL SUBJECT_SAMPLE_NAME="$2" -TEMP_FILE="fields.tsv" -TEMP_HD_FILE="hd.tsv" -TEMP_AF_FILE="af.tsv" +FORMATTED_REGION="$3" + +if [ -z "${3:-}" ]; then + echo "ERROR: FORMATTED_REGION (arg 3) is required" >&2 + echo "ERROR - $FORMATTED_REGION is fmtd region and $IN_VCF is in_vcf" + exit 1 +fi + +TEMP_FILE="$WORK_DIR/fields.$FORMATTED_REGION.tsv" +TEMP_HD_FILE="$WORK_DIR/hd.$FORMATTED_REGION.tsv" +TEMP_AF_FILE="$WORK_DIR/af.$FORMATTED_REGION.tsv" +TEMP_HDR_FILE="$WORK_DIR/hdr.$FORMATTED_REGION.txt" +IN_VCF_BASENAME="$(basename "$IN_VCF")" +HD_MED_VCF="$WORK_DIR/hd_med.$IN_VCF_BASENAME" +HD_AF_VCF="$WORK_DIR/hd_af.$IN_VCF_BASENAME" + +cleanup() { +rm -f "$TEMP_FILE" \ + "${TEMP_AF_FILE}.gz" "${TEMP_AF_FILE}.gz.tbi" \ + "${TEMP_HD_FILE}.gz" "${TEMP_HD_FILE}.gz.tbi" \ + "$HD_MED_VCF" \ + "$TEMP_HDR_FILE" +} +trap "cleanup" EXIT # Add HD_MED info field if it doesn't already exist -bcftools query -s $SUBJECT_SAMPLE_NAME -f '%CHROM\t%POS\t%REF\t%ALT\t%HD\n' $IN_VCF > $TEMP_FILE +bcftools query -s "$SUBJECT_SAMPLE_NAME" -f '%CHROM\t%POS\t%REF\t%ALT\t%HD\n' "$IN_VCF" > "$TEMP_FILE" awk -F'\t' ' function median(arr, n) { @@ -25,6 +49,10 @@ function median(arr, n) { } { # Split the comma-delimited list + if ($5 == "" || $5 == ".") { + print $0 "\t0" + next + } split($5, values, "_") count = 0 # Filter out -1 values and store remaining in new array @@ -42,38 +70,30 @@ function median(arr, n) { } # Print the original line with the median value appended print $0 "\t" med -}' $TEMP_FILE > $TEMP_HD_FILE +}' "$TEMP_FILE" > "$TEMP_HD_FILE" -bgzip $TEMP_HD_FILE +bgzip "$TEMP_HD_FILE" # Index text file -tabix -s1 -b2 -e2 ${TEMP_HD_FILE}.gz +tabix -f -s1 -b2 -e2 "${TEMP_HD_FILE}.gz" # Make a header line to insert -echo -e '##INFO=' > hdr.txt +echo -e '##INFO=' > "$TEMP_HDR_FILE" # Write HD_MED file out -bcftools annotate -s $SUBJECT_SAMPLE_NAME -a ${TEMP_HD_FILE}.gz -h hdr.txt -Oz -c CHROM,POS,REF,ALT,-,HD_MED $IN_VCF > "hd_med".$IN_VCF +bcftools annotate -s "$SUBJECT_SAMPLE_NAME" -a "${TEMP_HD_FILE}.gz" -h "$TEMP_HDR_FILE" -Oz -c CHROM,POS,REF,ALT,-,HD_MED "$IN_VCF" > "$HD_MED_VCF" # Pull out fields to text file -bcftools query -s $SUBJECT_SAMPLE_NAME -f '%CHROM\t%POS\t%REF\t%ALT\t%HD_MED\t[%DP]\n' "hd_med.$IN_VCF" > $TEMP_FILE +bcftools query -s "$SUBJECT_SAMPLE_NAME" -f '%CHROM\t%POS\t%REF\t%ALT\t%HD_MED\t[%DP]\n' "$HD_MED_VCF" > "$TEMP_FILE" # Calculate AF to 4-digit precision, add as column 7 awk '{ if($6 == 0) printf "%s\t%s\t%s\t%s\t%s\t%s\t%.4f\n", $1, $2, $3, $4, $5, $6, 0; else if($6 < $5) printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\n", $1, $2, $3, $4, $5, $6, "1.00"; else printf "%s\t%s\t%s\t%s\t%s\t%s\t%.4f\n", $1, $2, $3, $4, $5, $6, $5/$6; }' $TEMP_FILE > $TEMP_AF_FILE -bgzip $TEMP_AF_FILE +bgzip "$TEMP_AF_FILE" # Index text file -tabix -s1 -b2 -e2 ${TEMP_AF_FILE}.gz +tabix -f -s1 -b2 -e2 "${TEMP_AF_FILE}.gz" # Make a header line to insert -echo -e '##FORMAT=' >> hdr.txt - -bcftools annotate -s $SUBJECT_SAMPLE_NAME -a ${TEMP_AF_FILE}.gz -h hdr.txt -Oz -c CHROM,POS,REF,ALT,-,-,FORMAT/HD_AF "hd_med.$IN_VCF" > "hd_af.$IN_VCF" +echo -e '##FORMAT=' > "$TEMP_HDR_FILE" -rm $TEMP_FILE -rm ${TEMP_AF_FILE}.gz -rm ${TEMP_AF_FILE}.gz.tbi -rm ${TEMP_HD_FILE}.gz -rm ${TEMP_HD_FILE}.gz.tbi -rm "hd_med".$IN_VCF -rm hdr.txt +bcftools annotate -s "$SUBJECT_SAMPLE_NAME" -a "${TEMP_AF_FILE}.gz" -h "$TEMP_HDR_FILE" -Oz -c CHROM,POS,REF,ALT,-,-,FORMAT/HD_AF "$HD_MED_VCF" > "$HD_AF_VCF" \ No newline at end of file diff --git a/post_process/file_stubs/combined.header.start b/post_process/file_stubs/combined.header.start index 94ce4bff..a6f0e01a 100644 --- a/post_process/file_stubs/combined.header.start +++ b/post_process/file_stubs/combined.header.start @@ -13,7 +13,7 @@ ##INFO= ##INFO= ##INFO= -##INFO= +##INFO= ##INFO= ##INFO= ##INFO= @@ -21,7 +21,7 @@ ##INFO= ##INFO= ##INFO= -##INFO= +##INFO= ##INFO= ##INFO= ##INFO= @@ -31,7 +31,7 @@ ##INFO= ##INFO= ##INFO= -##INFO= +##INFO= ##INFO= ##INFO= ##INFO= diff --git a/post_process/file_stubs/combined.preheader.start b/post_process/file_stubs/combined.preheader.start index 13dd380f..3b0eaf2a 100644 --- a/post_process/file_stubs/combined.preheader.start +++ b/post_process/file_stubs/combined.preheader.start @@ -13,7 +13,7 @@ ##INFO= ##INFO= ##INFO= -##INFO= +##INFO= ##INFO= ##INFO= ##INFO= @@ -21,7 +21,7 @@ ##INFO= ##INFO= ##INFO= -##INFO= +##INFO= ##INFO= ##INFO= ##INFO= diff --git a/post_process/post_process.sh b/post_process/post_process.sh index d05f4565..76fef0d9 100644 --- a/post_process/post_process.sh +++ b/post_process/post_process.sh @@ -1,33 +1,42 @@ #!/bin/bash usage() { - echo "Usage: $0 [-w window_size] [-r reference] [-s subject] [-c control1,control2,control3...] [-d source_dir] [-h]" + echo "Usage: $0 -s -w [-h]" echo "Options:" - echo " -w window_size Required: The size of the window used in the RUFUS run" - echo " -r reference Required: The reference used in the RUFUS run" - echo " -c controls Required: The control bam files used in the RUFUS run" echo " -s subject_file Required: The name of the subject file: must be the same as that supplied to the RUFUS run" - echo " -d source_dir Required: The source directory where the RUFUS vcf(s) are located" + echo " -w window_size Required: The window size used for the RUFUS run (0 for whole genome mode)" echo " -h help Print help message" exit 1 } -# initialize vars -CONTROLS=() -WINDOW_SIZE=0 -REFERENCE="" -SUBJECT_FILE="" -SOURCE_DIR="/mnt" +# Cleans up intermediate files, reports no variants found in both out + error, and exits failure code +clean_up_post_temps() { + files=("$TEMP_FINAL_VCF") + + for file in "${files[@]}"; do + if [ "$file" != "" ]; then + find . -maxdepth 1 -type f -name "$file*" -delete + fi + done + + find . -maxdepth 1 -type f -name "temp.RUFUS.Final*vcf.gz*" -delete + find . -maxdepth 1 -type f -name "regions.chunk.*" -delete + find . -maxdepth 1 -type f -name "regions.txt" -delete + find . -maxdepth 1 -type f -name "final.list" -delete + rm -f "$MERGED" "$NO_HEAD" "rufus.cmd" + find . -type d -name "Intermediates" -exec rm -rf {} + + find . -type d -name "TempOverlap" -exec rm -rf {} + +} +trap 'clean_up_post_temps' EXIT # parse command line arguments -while getopts ":w:r:c:s:d:h" option; do +SUBJECT_FILE="" + +while getopts "hw:s:" option; do case $option in h) usage;; - w) WINDOW_SIZE=$OPTARG;; - r) REFERENCE=$OPTARG;; s) SUBJECT_FILE=$OPTARG;; - d) SOURCE_DIR=$OPTARG;; - c) IFS=',' read -r -a CONTROLS <<< "$OPTARG";; + w) WINDOW_SIZE=$OPTARG;; \?) echo "Invalid option: -$OPTARG" >&2 usage;; *) echo "Option -$OPTARG requires an argument" >&2 @@ -36,170 +45,121 @@ while getopts ":w:r:c:s:d:h" option; do done shift $((OPTIND-1)) -# check for mandatory command line arguments +if [[ -z "$SUBJECT_FILE" ]]; then + echo "ERROR: Missing required option -s (subject cram/bam)" >&2 + usage +fi + if [[ -z "$WINDOW_SIZE" ]]; then - echo "Error: Missing required option -w (window size)" >&2 - usage + echo "ERROR: Missing required option -w (window size)" >&2 + usage fi -if [[ -z "$REFERENCE" ]]; then - echo "Error: Missing required option -r (reference)" >&2 - usage + +echo "RUFUS post-process version d-1.1.9" +date +start_time=$(date +"%s") + +# Have to define all of these before first possible exit +SUBJECT_STRING=$(basename "$SUBJECT_FILE") +TEMP_FINAL_VCF="temp.RUFUS.Final.${SUBJECT_STRING}.combined.vcf.gz" +TEMP_PREFILTERED_VCF="temp.RUFUS.Prefiltered.${SUBJECT_STRING}.combined.vcf.gz" +FINAL_VCF="RUFUS.Final.${SUBJECT_STRING}.vcf" + +# Slight name change if not doing a windowed run. The calling stage writes the whole-genome file with +# a .wg region postfix (temp.RUFUS.Final..wg.vcf.gz), so match that here. +if [ "$WINDOW_SIZE" -eq 0 ]; then + TEMP_FINAL_VCF="temp.RUFUS.Final.${SUBJECT_STRING}.wg.vcf.gz" fi -if [[ -z "$SOURCE_DIR" ]]; then - echo "Error: Missing required option -d (source directory for RUFUS vcf(s))" >&2 - usage +# Check to see if temp vcf(s) exists, if not report empty results and exit +if read -r first_match < <(compgen -G "temp.RUFUS.Final*vcf.gz"); then + echo "Found temporary vcf(s)" +else + echo "Could not find any temporary vcf(s) from calling stage. Exiting..." + exit 1 fi -if [ ${#CONTROLS[@]} -eq 0 ]; then - echo "Error: Must supply at least one control bam" >&2 - usage +# Summarize region status log if present (generated by runRufus.sh in region mode) +REGION_LOG="region_status.log" +if [ -f "$REGION_LOG" ] && [ "$WINDOW_SIZE" -ne 0 ]; then + total=$(wc -l < "$REGION_LOG") + called=$(grep -c "VARIANTS_CALLED" "$REGION_LOG" || true) + nocall=$(grep -c "NO_VARIANTS" "$REGION_LOG" || true) + errors=$(grep -c "ERROR" "$REGION_LOG" || true) + echo "========== Region Status Summary ==========" + printf "Total regions: %d\n" "$total" + printf " Variants called: %d\n" "$called" + printf " No variants: %d\n" "$nocall" + printf " Errors: %d\n" "$errors" + if [ "$nocall" -gt 0 ]; then + echo "--- No-variant breakdown ---" + grep "NO_VARIANTS" "$REGION_LOG" | cut -f3 | sort | uniq -c | sort -rn + fi + if [ "$errors" -gt 0 ]; then + echo "--- Error breakdown ---" + grep "ERROR" "$REGION_LOG" | cut -f2,3 | sort | uniq -c | sort -rn + fi + echo "===========================================" + echo "Full region log: $(realpath "$REGION_LOG")" fi -cd $SOURCE_DIR -echo "RUFUS post-process version C.0.1" -date -start_time=$(date +"%s") +MERGED="merged.vcf" +NO_HEAD="no_header.vcf" +FINAL_GZ="${FINAL_VCF}.gz" -POST_PROCESS_DIR=/opt/RUFUS/post_process/ -TEMP_FINAL_VCF="temp.RUFUS.Final.${SUBJECT_FILE}.combined.vcf.gz" -TEMP_PREFILTERED_VCF="temp.RUFUS.Prefiltered.${SUBJECT_FILE}.combined.vcf.gz" - -if [ "$WINDOW_SIZE" != "0" ]; then - IFS=$'\t' - TAB_DELIM_CONTROL_STRING="${CONTROLS[*]}" - echo "Windowed run performed, trimming and combining region vcfs..." - bash ${POST_PROCESS_DIR}trim_and_combine.sh $SUBJECT_FILE $TAB_DELIM_CONTROL_STRING $WINDOW_SIZE -else - # Slight name change if not doing a windowed run - TEMP_FINAL_VCF="temp.RUFUS.Final.${SUBJECT_FILE}.vcf.gz" - TEMP_PREFILTERED_VCF="${SUPP_DIR}temp.RUFUS.Prefiltered.${SUBJECT_FILE}.vcf.gz" -fi +# Concat vcfs if in windowed mode +if [ "$WINDOW_SIZE" -ne 0 ]; then + # Concatenate all intermediates + find . -maxdepth 1 -type f -name 'temp.RUFUS.Final.*.vcf.gz' -print | + sort -V > regions.txt -# TODO: check to see if we had any variants in final, and if not, stop and report -VARS_REPORTED=$(bcftools view -H $TEMP_FINAL_VCF | wc -l) -if [ "$VARS_REPORTED" = "0" ]; then - echo "RUFUS did not find any variants for the provided parameters. Please adjust and try again." - rm /mnt/${SUBJECT_FILE}*.generator* - for control in "${CONTROLS[@]}"; do - rm /mnt/${control}*.generator* + split -l 200 regions.txt regions.chunk. + + for f in regions.chunk.*; do + echo "-- BCFTools ---------------------------" + bcftools concat -a -D -f $f -Oz -o "$f".vcf.gz + bcftools index "$f".vcf.gz done - rm -r /mnt/Intermediates - rm -r /mnt/TempOverlap - rm -r /mnt/rufus.cmd - rm /mnt/temp*.vcf* - echo "RUFUS did not find any variants for the provided parameters. Please adjust and try again." > fail.out - exit 0 -fi + ls regions.chunk.*.vcf.gz > final.list + bcftools concat -a -D -f final.list -Ov -o $MERGED + + bcftools sort -T "tmp_bcftools.XXXXXX" -Ov -o "$NO_HEAD" "$MERGED" \ + || { echo "Error: bcftools sort failed"; exit 1; } -# Check for empty lines -echo "Checking vcf formatting..." -bash ${POST_PROCESS_DIR}remove_no_genotype.sh $TEMP_FINAL_VCF "final_no_gx.vcf" -bash ${POST_PROCESS_DIR}remove_no_genotype.sh $TEMP_PREFILTERED_VCF "prefiltered_no_gx.vcf" -rm $TEMP_FINAL_VCF -rm $TEMP_PREFILTERED_VCF -mv "final_no_gx.vcf.gz" $TEMP_FINAL_VCF -mv "prefiltered_no_gx.vcf.gz" $TEMP_PREFILTERED_VCF - -# Sort -echo "Sorting..." -bcftools sort $TEMP_FINAL_VCF | bgzip > "sorted.${TEMP_FINAL_VCF}" -# TODO: when fix formatting on prefiltered vcf, comment two lines below back in -#bcftools sort $TEMP_PREFILTERED_VCF | bgzip > "sorted.${TEMP_PREFILTERED_VCF}" - -rm $TEMP_FINAL_VCF -#rm $TEMP_PREFILTERED_VCF -bcftools index "sorted.$TEMP_FINAL_VCF" - -# Remove coinheriteds -echo "Removing coinheriteds..." -IFS=$',' -CONTROL_STRING="${CONTROLS[*]}" -COINHERITED_REMOVED_VCF="coinherited_removed.vcf.gz" -bash ${POST_PROCESS_DIR}remove_coinheriteds.sh "$REFERENCE" "sorted.${TEMP_FINAL_VCF}" "$COINHERITED_REMOVED_VCF" "$SOURCE_DIR" "$CONTROL_STRING" - -# Add HD_AF field -echo "Adding kmer-based allele frequencies..." -AF_ADDED_VCF="hd_af.${COINHERITED_REMOVED_VCF}" -SUBJECT_SAMPLE_NAME=$(bcftools view -h $COINHERITED_REMOVED_VCF | tail -n 1 | awk -F'\t' '{ print $10 }') -bash ${POST_PROCESS_DIR}add_hd_med.add_hd_af.sh "$COINHERITED_REMOVED_VCF" "$SUBJECT_SAMPLE_NAME" -bcftools index $AF_ADDED_VCF - -# Compose final vcfs -SUBJECT_STRING=$(basename $SUBJECT_FILE) -FINAL_VCF="RUFUS.Final.${SUBJECT_STRING}.combined.vcf" -PREFILTERED_VCF="RUFUS.Prefiltered.${SUBJECT_STRING}.combined.vcf" - -# Inject RUFUS command into header -echo "Composing final vcfs..." -bcftools view -h $AF_ADDED_VCF | head -n -1 > $FINAL_VCF -cat /mnt/rufus.cmd >> $FINAL_VCF -bcftools view -h $AF_ADDED_VCF | tail -n 1 >> $FINAL_VCF -bcftools view -H $AF_ADDED_VCF >> $FINAL_VCF -bgzip $FINAL_VCF -bcftools index "$FINAL_VCF.gz" - -#TODO: Comment back in after prefiltered vcf cleaned up -#bcftools view -h $TEMP_PREFILTERED_VCF | head -n -1 > $PREFILTERED_VCF -#cat /mnt/rufus.cmd >> $PREFILTERED_VCF -#bcftools view -h $TEMP_PREFILTERED_VCF | tail -n 1 >> $PREFILTERED_VCF -#bcftools view -H $TEMP_PREFILTERED_VCF >> $PREFILTERED_VCF -#bgzip $PREFILTERED_VCF -#bcftools index "$PREFILTERED_VCF.gz" -#mv "$PREFILTERED_VCF.gz"* rufus_supplementals/ - -# Only need to move and rename if did a windowed run -if [ "$WINDOW_SIZE" != "0" ]; then - mv $TEMP_PREFILTERED_VCF prefiltered.vcf.gz - mv $TEMP_PREFILTERED_VCF.tbi prefiltered.vcf.gz.tbi - mv prefiltered.vcf.gz* rufus_supplementals/ +else + # Just sort and add header for whole genome mode + bcftools sort -T "tmp_bcftools.XXXXXX" -Ov -o "$NO_HEAD" "$TEMP_FINAL_VCF" \ + || { echo "Error: bcftools sort failed"; exit 1; } fi +# Build final VCF with correct header +# Strip per-region RUFUSCommandLine and inject full-run rufus.cmd instead +RUFUS_CMD_FILE="rufus.cmd" +if [ "$WINDOW_SIZE" -ne 0 ] && [ -f "$RUFUS_CMD_FILE" ]; then + bcftools view -h "$NO_HEAD" | grep -v "^##RUFUSCommandLine" | head -n -1 > "$FINAL_VCF" \ + || { echo "Error: bcftools view on merged vcf failed"; exit 1; } + cat "$RUFUS_CMD_FILE" >> "$FINAL_VCF" + echo "##RUFUS_runMode=region (window_size=${WINDOW_SIZE})" >> "$FINAL_VCF" + bcftools view -h "$NO_HEAD" | tail -n 1 >> "$FINAL_VCF" +else + bcftools view -h "$NO_HEAD" | head -n -1 > "$FINAL_VCF" \ + || { echo "Error: bcftools view on merged vcf failed"; exit 1; } + bcftools view -h "$NO_HEAD" | tail -n 1 >> "$FINAL_VCF" +fi +bcftools view -H "$NO_HEAD" >> "$FINAL_VCF" -# TODO: Separate SVs and SNV/Indels -#echo "Separating snvs/indels and SVs..." - -# Cleanup -echo "Cleaning up intermediate post-processing files..." -#rm $TEMP_PREFILTERED_VCF* -rm $TEMP_FINAL_VCF* -#rm "sorted.$TEMP_PREFILTERED_VCF"* -rm "sorted.$TEMP_FINAL_VCF"* -rm $COINHERITED_REMOVED_VCF* -rm "normed.sorted.$TEMP_FINAL_VCF"* -rm -r "/mnt/Intermediates" -rm -r "/mnt/TempOverlap" -rm "/mnt/rufus.cmd" -rm "$AF_ADDED_VCF"* - -# Combining supplementals -SUPPLEMENTAL_DIR=/mnt/rufus_supplementals/ -# TODO: only do this if not reporting in developer mode -ls ${SUPPLEMENTAL_DIR}*generator.V2.overlap.hashcount.fastq.bam | xargs samtools merge ${SUPPLEMENTAL_DIR}unique_contigs.bam -ls ${SUPPLEMENTAL_DIR}*generator.Mutations.fastq.bam | xargs samtools merge ${SUPPLEMENTAL_DIR}unique_reads.bam -samtools sort ${SUPPLEMENTAL_DIR}unique_contigs.bam -o ${SUPPLEMENTAL_DIR}unique_contigs.sorted.bam -samtools sort ${SUPPLEMENTAL_DIR}unique_reads.bam -o ${SUPPLEMENTAL_DIR}unique_reads.sorted.bam -rm ${SUPPLEMENTAL_DIR}unique_contigs.bam -rm ${SUPPLEMENTAL_DIR}unique_reads.bam -rm ${SUPPLEMENTAL_DIR}*generator.V2.overlap.hashcount.fastq.bam* -rm ${SUPPLEMENTAL_DIR}*generator.Mutations.fastq.bam* - -cat ${SUPPLEMENTAL_DIR}*.HashList > ${SUPPLEMENTAL_DIR}unique_kmer_counts.txt -rm ${SUPPLEMENTAL_DIR}*.HashList - -# TODO: hack for now to get rid of any lingering intermediate files -# TODO: this actually needs to be fixed with a graceful handling of no variants for certain windows -rm /mnt/${SUBJECT_FILE}*.generator* -for control in "${CONTROLS[@]}"; do - rm /mnt/${control}*.generator* -done +bgzip "$FINAL_VCF" || { echo "Error: bgzip failed on final vcf"; exit 1; } +tabix -f -p vcf "$FINAL_GZ" \ +|| { echo "Error: tabix failed"; exit 1; } +echo "-----------------------------------------" +echo "Done: $FINAL_GZ" -echo "Post-processing complete." +echo "Concatenating & sorting complete." end_time=$(date +"%s") -time_delta=$(( $end_time - $start_time )) +time_delta=$(( end_time - start_time )) hours=$(( time_delta / 3600 )) minutes=$(( (time_delta % 3600) / 60 )) seconds=$(( time_delta % 60 )) -printf "RUFUS call stage completed in: %02d:%02d:%02d\n" $hours $minutes $seconds +printf "RUFUS combine stage completed in: %02d:%02d:%02d\n" $hours $minutes $seconds \ No newline at end of file diff --git a/post_process/remove_coinheriteds.sh b/post_process/remove_coinheriteds.sh index 5b1cd20e..6fe5e60e 100644 --- a/post_process/remove_coinheriteds.sh +++ b/post_process/remove_coinheriteds.sh @@ -2,95 +2,181 @@ # a somatic variant. It accomplishes this task by performing a pileup and variant call # in the control bam for each of the rufus-identified variants, then taking the complement # of the control set in an intersection. +set -euo pipefail + +: "${WORK_DIR:?WORK_DIR must be set}" # parse command line arguments -REFERENCE_FILE=$1 # Reference file (.fa) - must be the same as RUFUS run that generated RUFUS_VCF -RUFUS_VCF=$2 # The 'FINAL' vcf generated by rufus, to be isec'd -OUT_VCF=$3 -SRC_DIR=$4 -ARG_LIST=("$@") -CONTROL_BAM_LIST=("${ARG_LIST[@]:4}") # Remaining args, all control bams +REFERENCE_FILE="" # Reference file (.fa) - must be the same as RUFUS run that generated RUFUS_VCF +RUFUS_VCF="" # The 'FINAL' vcf generated by rufus, to be isec'd +OUT_VCF="" +SRC_DIR="" +WINDOW_SIZE="1000" +FMTD_REGION="" +CONTROL_BAM_LIST=() # Remaining args, all control bams +THREADS=10 + +cleanup() { + rm -rf "$WORK_DIR"/*_temp_pileups + rm -f "$WORK_DIR"/temp_aligned.*."$FMTD_REGION".bam +} +trap cleanup EXIT + +while getopts "h:f:i:o:w:r:c:t:" option; do + case $option in + h) usage;; + f) REFERENCE_FILE=$OPTARG;; + i) RUFUS_VCF=$OPTARG;; + o) OUT_VCF=$OPTARG;; + w) WINDOW_SIZE=$OPTARG;; + r) FMTD_REGION=$OPTARG;; + t) THREADS=$OPTARG;; + c) IFS=',' read -r -a CONTROL_BAM_LIST <<< "$OPTARG";; + \?) echo "Invalid option: -$OPTARG" >&2 + usage;; + *) echo "Option -$OPTARG requires an argument" >&2 + usage;; + esac +done +shift $((OPTIND-1)) + +if [[ -z "$RUFUS_VCF" ]]; then + echo "ERROR: Missing required option -i (rufus input vcf)" >&2 + exit 1 +fi +if [[ -z "$OUT_VCF" ]]; then + echo "ERROR: Missing required option -o (output vcf name)" >&2 + exit 1 +fi +if [[ -z "$REFERENCE_FILE" ]]; then + echo "ERROR: Missing required option -f (reference fasta)" >&2 + exit 1 +fi +if [[ -z "$FMTD_REGION" ]]; then + echo "ERROR: Missing required option -r (region)" >&2 + exit 1 +fi -cd $SRC_DIR +# ENV file override +: "${RUFUS_ROOT:=/opt/RUFUS}" # static vars -CONTROL_ALIGNED="temp_aligned.bam" -CONTROL_VCF="isec_control.vcf.gz" -NORMED_VCF="normed.${RUFUS_VCF}" -BWA=/opt/RUFUS/bin/externals/bwa/src/bwa_project/bwa -PILEUP_SCRIPT="/opt/RUFUS/post_process/single_pileup.sh" +CONTROL_VCF="$WORK_DIR/isec_control.$FMTD_REGION.vcf.gz" +NORMED_VCF="$WORK_DIR/normed.$(basename "$RUFUS_VCF")" +BWA="$RUFUS_ROOT/bin/externals/bwa/src/bwa_project/bwa" +PILEUP_SCRIPT="$RUFUS_ROOT/post_process/single_pileup.sh" # make intersection directory -ISEC_OUT_DIR="temp_isecs" +ISEC_OUT_DIR="$WORK_DIR/temp_${FMTD_REGION}_isecs" mkdir -p $ISEC_OUT_DIR #format final rufus vcf for intersections -vt normalize -n $RUFUS_VCF -r $REFERENCE_FILE | vt decompose_blocksub - | bgzip > $NORMED_VCF -bcftools index -t $NORMED_VCF +vt normalize -n "$RUFUS_VCF" -r "$REFERENCE_FILE" | vt decompose_blocksub - | bgzip > "$NORMED_VCF" +bcftools index -t "$NORMED_VCF" #for loop for each control file provided by user +MERGED_PILEUP="$WORK_DIR/merged_pileup.${FMTD_REGION}.vcf.gz" +SORTED_MERGED_PILEUP="$WORK_DIR/sorted.merged_pileup.${FMTD_REGION}.vcf.gz" + +pileups=() for CONTROL in "${CONTROL_BAM_LIST[@]}"; do + echo "Piling up $CONTROL" >&2 + MADE_ALIGN_CONTROL=false - CONTROL_BAM="" + CONTROL_BAM="" + + # Make temp dir for individual pileups + CONTROL_TAG=$(basename "$CONTROL") + CONTROL_TAG="${CONTROL_TAG%.bam}" + CONTROL_TAG=${CONTROL_TAG}.${FMTD_REGION} + CURR_MERGED_PILEUP="$WORK_DIR/${CONTROL_TAG}.ctrl.merged_pileup.vcf.gz" + CURR_PILEUP_DIR="$WORK_DIR/${CONTROL_TAG}_temp_pileups" + CONTROL_ALIGNED="$WORK_DIR/temp_aligned.${CONTROL_TAG}.bam" #check to see if the provided bam file is aligned if [ "$(samtools view -H "$CONTROL" | grep -c '^@SQ')" -gt 0 ]; then CONTROL_BAM=$CONTROL else - $BWA mem -t 40 $REFERENCE_FILE $CONTROL | samtools view -S -@ 12 -b - > $CONTROL_ALIGNED - CONTROL_BAM=$CONTROL_ALIGNED + # TODO: this really needs to be aligned, otherwise we'd be doing this 3000+ times + "$BWA" mem -t 10 "$REFERENCE_FILE" "$CONTROL" | samtools view -S -@ 12 -b - > "$CONTROL_ALIGNED" + CONTROL_BAM="$CONTROL_ALIGNED" MADE_ALIGN_CONTROL=true fi - #run pileup and call variants - MERGED_PILEUP="merged_pileup.vcf" + # Run pileup and call variants echo "Starting parallel mpileup..." + export PILEUP_SCRIPT CURR_PILEUP_DIR - # Split pileup by chromosomes - bcftools query -f '%CHROM\n' $NORMED_VCF | sort | uniq | \ - awk -v bam="$CONTROL_BAM" -v ref="$REFERENCE_FILE" '{print $1 "\t" bam "\t" ref}' > arguments.txt - cat arguments.txt | parallel -j +0 --colsep '\t' bash $PILEUP_SCRIPT {1} {2} {3} - - # TODO: if we have a small amount of sites, might be more efficient to do this, bricks if too many though - # Split pileup by sites - #bcftools query -f '%CHROM\t%POS0\t%POS\n' $NORMED_VCF | sort | uniq | \ - #awk -v bam="$CONTROL_BAM" -v ref="$REFERENCE_FILE" '{print $1 "\t" $2 "\t" $3 "\t" bam "\t" ref}' > arguments.txt - # NOTE: have to do out of order now, because single pileup start and end are optional - #cat arguments.txt | parallel -j +0 --colsep '\t' bash $PILEUP_SCRIPT {1} {4} {5} {2} {3} - - # combine pileups - bcftools concat -o $MERGED_PILEUP -Ov mpileup*.vcf - bcftools sort -o "sorted.$MERGED_PILEUP" "$MERGED_PILEUP" - bgzip "sorted.$MERGED_PILEUP" - bcftools index "sorted.$MERGED_PILEUP.gz" - rm $MERGED_PILEUP - - #TODO: comment back in after testing - #rm mpileup_*.vcf - #rm arguments.txt - - # call variants from merged pileup vcf - echo "Starting pileup call..." - bcftools call -cv -Oz -o $CONTROL_VCF "sorted.$MERGED_PILEUP.gz" - bcftools index -t $CONTROL_VCF - rm "sorted.$MERGED_PILEUP.gz"* - - #intersect the control vcf with formatted rufus vcf + # Running in WG mode, split pileup by chr + if [ "$WINDOW_SIZE" -ne 0 ]; then + # Likely dealing with a small number of variants, send in a single list of sites + regions=$(bcftools view -H "$NORMED_VCF" | awk '!/^#/ {printf "%s%s:%d-%d", sep, $1, $2, $2; sep=","} END{print ""}') + bash $PILEUP_SCRIPT "$regions" "${CONTROL_BAM}" "${REFERENCE_FILE}" > "$CURR_MERGED_PILEUP" + else + # Better to do chromosome by chromosome for speed for entire genome + TEMP_ARGS_FILE="$WORK_DIR/$FMTD_REGION.arguments.txt" + mkdir -p "$CURR_PILEUP_DIR" + bcftools query -f '%CHROM\n' "$NORMED_VCF" | sort | uniq | \ + awk -v bam="$CONTROL_BAM" -v ref="$REFERENCE_FILE" '{print $1 "\t" bam "\t" ref}' > "$TEMP_ARGS_FILE" + cat "$TEMP_ARGS_FILE" | parallel -j +0 --colsep '\t' "bash \"$PILEUP_SCRIPT\" {1} {2} {3} > $CURR_PILEUP_DIR/{1}.vcf.gz" + for vcf in "$CURR_PILEUP_DIR"/*vcf.gz; do + bcftools index "$vcf" + done + # TODO: this needs to be tested - whole genome + bcftools concat -Oz -o "$CURR_MERGED_PILEUP" "$CURR_PILEUP_DIR"/*.vcf.gz + rm "$TEMP_ARGS_FILE" + rm -r "$CURR_PILEUP_DIR" + fi + + bcftools index "$CURR_MERGED_PILEUP" + pileups+=("$CURR_MERGED_PILEUP") +done + +# Combine control specific pileups if there are multiple +if [ "${#pileups[@]}" -gt 1 ]; then + echo "about to merge ${pileups[@]}" + total_records=$(for p in "${pileups[@]}"; do bcftools view -H "$p"; done | wc -l) + if [ "$total_records" -eq 0 ]; then + cp "${pileups[0]}" "$MERGED_PILEUP" + bcftools index "$MERGED_PILEUP" + else + bcftools merge -Oz -o "$MERGED_PILEUP" "${pileups[@]}" + fi +else + cp "${pileups[0]}" "$MERGED_PILEUP" +fi +rm -f $WORK_DIR/*."$FMTD_REGION".ctrl.merged_pileup.vcf.gz* + +# Sort combined pileups +bcftools sort -Oz -o "$SORTED_MERGED_PILEUP" "$MERGED_PILEUP" +bcftools index "$SORTED_MERGED_PILEUP" +rm -f $MERGED_PILEUP + +# Call variants from merged pileup vcf +echo "Starting pileup call..." +bcftools view -e 'ALT="<*>" && N_ALT=1' "$SORTED_MERGED_PILEUP" | bcftools call -mv -Oz -o "$CONTROL_VCF" +bcftools index "$CONTROL_VCF" +rm "$SORTED_MERGED_PILEUP"* + +# Intersect the control vcf with formatted rufus vcf +CONTROL_RECORD_COUNT=$(bcftools view -H "$CONTROL_VCF" | wc -l) +if [ "$CONTROL_RECORD_COUNT" -eq 0 ]; then + echo "Control VCF has zero variant records — skipping intersection, copying subject VCF directly." + cp "$NORMED_VCF" "${OUT_VCF}" + bcftools index -t "$OUT_VCF" +else echo "Starting intersection..." - bcftools isec -Oz -w1 -n=1 -p $ISEC_OUT_DIR $NORMED_VCF $CONTROL_VCF - - # save the new vcf as rufus final vcf - OUTFILE="$ISEC_OUT_DIR/0000.vcf.gz" - OUT_INDEX="$ISEC_OUT_DIR/0000.vcf.gz.tbi" + bcftools isec -Oz -w1 -n=1 -p "$ISEC_OUT_DIR" "$NORMED_VCF" "$CONTROL_VCF" - cp "$OUTFILE" "${OUT_VCF}" - cp "$OUT_INDEX" "${OUT_VCF}.tbi" - rm "$CONTROL_VCF"* + # save the new vcf as rufus final vcf + OUTFILE="$ISEC_OUT_DIR/0000.vcf.gz" + OUT_INDEX="$ISEC_OUT_DIR/0000.vcf.gz.tbi" - # clean up aligned control file, if it exists - if [ "$MADE_ALIGN_CONTROL" = "true" ]; then - rm $CONTROL_ALIGNED - fi + cp "$OUTFILE" "${OUT_VCF}" + cp "$OUT_INDEX" "${OUT_VCF}.tbi" +fi +rm "$CONTROL_VCF"* - rm -r $ISEC_OUT_DIR -done +# Clean up aligned control file, if it exists +rm -f $WORK_DIR/temp_aligned.*.${FMTD_REGION}.bam +rm -rf "$ISEC_OUT_DIR" \ No newline at end of file diff --git a/post_process/remove_no_genotype.sh b/post_process/remove_no_genotype.sh index 9d43793d..0649fc1b 100644 --- a/post_process/remove_no_genotype.sh +++ b/post_process/remove_no_genotype.sh @@ -1,27 +1,31 @@ #!/bin/bash - -# NOTE: THIS ONLY WORKS FOR A RUFUS RUN WITH TWO SAMPLE COLUMNS IN VCF - i.e. ONE NORMAL ONE TUMOR +# Works for any number of sample columns in VCF +: "${WORK_DIR:?WORK_DIR must be set}" input_file=$1 -output_file=$2 -# Process the gzipped VCF file -zcat "$input_file" | awk -F'\t' ' +cat "$input_file" | awk -F'\t' ' BEGIN { - skipped_lines = 0; + expected_cols = 0 } -{ - if ($0 ~ /^#/) { - print $0 > output_file; - } else if (NF == 11) { - print $0 > output_file; - } else { - skipped_lines++; - } + +# Always print header lines +/^##/ { + print + next } -END { - print skipped_lines " lines were not printed because they did not have the genotype columns."; + +# Column header: record expected column count and print +/^#CHROM/ { + expected_cols = NF + print + next } -' output_file="$output_file" -bgzip $output_file +# Data lines: only print if column count matches +{ + if (expected_cols > 0 && NF == expected_cols) { + print + } +} +' diff --git a/post_process/single_pileup.sh b/post_process/single_pileup.sh index b7b4232a..2bfd12f5 100644 --- a/post_process/single_pileup.sh +++ b/post_process/single_pileup.sh @@ -1,15 +1,12 @@ #!/bin/bash +set -euo pipefail -chr=$1 +: "${WORK_DIR:?WORK_DIR must be set}" + +# Takes in a list of regions to perform a pileup on in bam, returns a single bgzipped pileup vcf +regions=$1 bam=$2 ref=$3 -start_coord=$4 -end_coord=$5 - -DEPTH=500 -if [ ! -z "$start_coord" ] && [ ! -z "$end_coord" ]; then - bcftools mpileup -Ov -d $DEPTH -f $ref -r "${chr}:${start_coord}-${end_coord}" -o mpileup_${chr}_${start_coord}_${end_coord}.vcf $bam -else - bcftools mpileup -Ov -d $DEPTH -f $ref -r "${chr}" -o mpileup_${chr}.vcf $bam -fi \ No newline at end of file +DEPTH=${DEPTH:-100} +bcftools mpileup -Oz -d $DEPTH -f "$ref" -r "${regions}" "$bam" \ No newline at end of file diff --git a/post_process/trim_and_combine.sh b/post_process/trim_and_combine.sh index 9265e46a..ab5cbb8e 100644 --- a/post_process/trim_and_combine.sh +++ b/post_process/trim_and_combine.sh @@ -8,35 +8,42 @@ # must be equal to those run for the piecemeal run. # Compresses and indexes the final file. -# this is running inside of container so these dependencies should be available -#module load bcftools -#module load htslib - -cd /mnt +# ENV override +: "${RUFUS_ROOT:=/opt/RUFUS}" SUBJECT_FILE=$1 -CONTROL_STRING=$2 -WINDOW_SIZE=$3 +WINDOW_SIZE=$2 +shift +shift +CONTROLS=("$@") + +BCFTOOLS="/opt/bcftools/bcftools" COMBINED_VCF="temp.RUFUS.Final.${SUBJECT_FILE}.combined.vcf" -COMBINED_PRE_VCF="temp.RUFUS.Prefiltered.${SUBJECT_FILE}.combined.vcf" -COMBINED_SAMPLE_STRING="${SUBJECT_FILE}\t${CONTROL_STRING}" +#COMBINED_PRE_VCF="temp.RUFUS.Prefiltered.${SUBJECT_FILE}.combined.vcf" + +COMBINED_SAMPLE_STRING="" +if [ "$CONTROL_STRING" == "internal" ]; then + COMBINED_SAMPLE_STRING="${SUBJECT_FILE}" +else + COMBINED_SAMPLE_STRING=$(printf '%s' "$SUBJECT_FILE"; printf '\t%s' "${CONTROLS[@]}") +fi -SUPP_DIR="rufus_supplementals/" +#SUPP_DIR="rufus_supplementals/" # Headers that get written to vcf COMBINED_HEADER="combined.header" COMBINED_PRE_HEADER="combined.preheader" # Start of headers -HEADER_START="/opt/RUFUS/post_process/file_stubs/combined.header.start" -PRE_HEADER_START="/opt/RUFUS/post_process/file_stubs/combined.preheader.start" +HEADER_STUB="$RUFUS_ROOT/resources/vcf_header.txt" # Records that get written to vcf (non-header) COMBINED_RECORDS="combined.records" COMBINED_PRE_RECORDS="combined.prerecords" -NUM_CHRS=24 +contig_temp="contig_temp.txt" + CHRS=( "1" "2" @@ -94,7 +101,7 @@ CHR_LENGTHS=( # Initialize combined headers cat "$HEADER_START" > $COMBINED_HEADER -cat "$PRE_HEADER_START" > $COMBINED_PRE_HEADER +#cat "$PRE_HEADER_START" > $COMBINED_PRE_HEADER TEMP_TRIMMED="temp.trimmed" # Adjust chunk size to bp @@ -116,23 +123,24 @@ do end_coord=$curr_len fi - CURR_VCF="temp.RUFUS.Final.${SUBJECT_FILE}.chr${curr_chr}_${start_coord}_${end_coord}.vcf.gz" - CURR_PRE_VCF="${SUPP_DIR}temp.RUFUS.Prefiltered.${SUBJECT_FILE}.chr${curr_chr}_${start_coord}_${end_coord}.vcf.gz" + CURR_VCF="temp.RUFUS.Final.${SUBJECT_FILE}.chr${curr_chr}_${start_coord}_${end_coord}.vcf.gz" + #CURR_PRE_VCF="temp.RUFUS.Prefiltered.${SUBJECT_FILE}.chr${curr_chr}_${start_coord}_${end_coord}.vcf.gz" if [[ -f "${CURR_VCF}" ]]; then - + # Write out trimmed region to final vcf bcftools view -r "chr${curr_chr}:${start_coord}-${end_coord}" "${CURR_VCF}" > $TEMP_TRIMMED bcftools view -H $TEMP_TRIMMED >> $COMBINED_RECORDS - bcftools view -h $TEMP_TRIMMED | grep "##contig" >> $COMBINED_HEADER - + bcftools view -h $TEMP_TRIMMED | grep "##contig" >> $contig_temp + # Write out trimmed region to prefiltered vcf - bcftools view -r "chr${curr_chr}:${start_coord}-${end_coord}" "${CURR_PRE_VCF}" > $TEMP_TRIMMED - bcftools view -H $TEMP_TRIMMED >> $COMBINED_PRE_RECORDS - bcftools view -h $TEMP_TRIMMED | grep "##contig" >> $COMBINED_PRE_HEADER + #bcftools view -r "chr${curr_chr}:${start_coord}-${end_coord}" "${CURR_PRE_VCF}" > $TEMP_TRIMMED + #bcftools view -H $TEMP_TRIMMED >> $COMBINED_PRE_RECORDS + #bcftools view -h $TEMP_TRIMMED | grep "##contig" >> $contig_temp + #sort -V $contig_temp | uniq >> $COMBINED_PRE_HEADER # Remove vcf and indexes - rm $CURR_VCF* - rm $CURR_PRE_VCF* + rm "$CURR_VCF"* + #rm $CURR_PRE_VCF* fi # Advance start coordinate @@ -141,23 +149,27 @@ do echo "Done combining chr${curr_chr}" done -cat $COMBINED_HEADER | uniq > $COMBINED_VCF -echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t$COMBINED_SAMPLE_STRING" >> $COMBINED_VCF -cat $COMBINED_RECORDS >> $COMBINED_VCF +sort -hu $contig_temp >> "$COMBINED_HEADER" +cat $COMBINED_HEADER | uniq > "$COMBINED_VCF" +echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t$COMBINED_SAMPLE_STRING" >> "$COMBINED_VCF" +cat $COMBINED_RECORDS >> "$COMBINED_VCF" -cat $COMBINED_PRE_HEADER | uniq > $COMBINED_PRE_VCF -echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t$COMBINED_SAMPLE_STRING" >> $COMBINED_PRE_VCF -cat $COMBINED_PRE_RECORDS >> $COMBINED_PRE_VCF +# cat $COMBINED_PRE_HEADER | uniq > $COMBINED_PRE_VCF +# echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t$COMBINED_SAMPLE_STRING" >> $COMBINED_PRE_VCF +# cat $COMBINED_PRE_RECORDS >> $COMBINED_PRE_VCF +# todo: left off here - unsure why the combined vcf here is out of order and cannot be indexed... +# maybe try to do a full redo of individual vcfs and try again? bgzip $COMBINED_VCF bcftools index -t "${COMBINED_VCF}.gz" -bgzip $COMBINED_PRE_VCF -bcftools index -t "${COMBINED_PRE_VCF}.gz" +# bgzip $COMBINED_PRE_VCF +# bcftools index -t "${COMBINED_PRE_VCF}.gz" # Clean up temp files +rm $contig_temp rm $TEMP_TRIMMED rm $COMBINED_HEADER -rm $COMBINED_PRE_HEADER +# rm $COMBINED_PRE_HEADER rm $COMBINED_RECORDS -rm $COMBINED_PRE_RECORDS +#rm $COMBINED_PRE_RECORDS \ No newline at end of file diff --git a/resource_helpers/build_bwa_indexes.sh b/resource_helpers/build_bwa_indexes.sh new file mode 100644 index 00000000..5435e31a --- /dev/null +++ b/resource_helpers/build_bwa_indexes.sh @@ -0,0 +1,36 @@ +#!/bin/bash +host_ref_file="$1" + +# ENV override +: "${RUFUS_ROOT:=/opt/RUFUS}" + +bwa="$RUFUS_ROOT/bin/externals/bwa/src/bwa_project/bwa" + +if [ -z "$host_ref_file" ]; then + echo "ERROR: usage: build_bwa_indexes.sh " >&2 + exit 1 +fi + +# Handle .gz extension +if [[ "$host_ref_file" == *.gz ]]; then + host_ref_file_no_gz="${host_ref_file%.gz}" +else + host_ref_file_no_gz="$host_ref_file" +fi + +fasta_idx="${host_ref_file_no_gz}" + +if [ ! -f "$fasta_idx" ]; then + echo "ERROR: reference $fasta_idx does not exist or cannot be read." >&2 + if [ "$host_ref_file" != "$fasta_idx" ]; then + echo " BWA cannot index a compressed reference; decompress $host_ref_file first." >&2 + fi + exit 1 +fi + +# Index the file +$bwa index -a bwtsw "$fasta_idx" || { echo "ERROR: bwa index failed on $fasta_idx" >&2; exit 1; } +samtools faidx "$fasta_idx" || { echo "ERROR: samtools faidx failed on $fasta_idx" >&2; exit 1; } + +echo "These indexes were created by RUFUS for an intermediate BWA step." > README.md +echo "If you wish to reuse them for the next run to save some time, copy them into the same directory as your REFERENCE_FASTA." >> README.md \ No newline at end of file diff --git a/resource_helpers/download_hash.sh b/resource_helpers/download_hash.sh new file mode 100644 index 00000000..291f123a --- /dev/null +++ b/resource_helpers/download_hash.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Downloaded hashes get put in ${WORKING_DIR}/rufus_temp/downloaded_{hash_type}_hashes +# File name depends only upon matching *wg* or *fmtd_region* in the correct type/version directory + +HASH_TYPE="$1" +HASH_VERSION="$2" +FMTD_REGION="$3" # Must be "wg" if not a region + +s3_path="s3://rufus.marth.lab/public_access_data/rufus_resources/${HASH_TYPE}_hashes/${HASH_VERSION}/" + +# Check that we only have one file to download first +matches=$(aws s3 ls --no-sign-request $s3_path | grep "$FMTD_REGION" | awk '{print $NF}') +count=$(echo "$matches" | grep -c "^") + +if [ -z "$matches" ]; then + count=0 +else + count=$(echo "$matches" | wc -l) +fi + +if [ $count -eq 0 ]; then + echo "Error: No files found matching pattern '$FMTD_REGION'" >&2 + exit 1 +elif [ $count -gt 1 ]; then + echo "Error: Multiple files found matching pattern '$FMTD_REGION':" >&2 + echo "$matches" >&2 + exit 1 +else + aws s3 cp --no-sign-request "${s3_path}${matches}" "${FMTD_REGION}_${HASH_TYPE}_${HASH_VERSION}.Jhash" +fi \ No newline at end of file diff --git a/resource_helpers/resolve_hashes.sh b/resource_helpers/resolve_hashes.sh new file mode 100644 index 00000000..98aeb37e --- /dev/null +++ b/resource_helpers/resolve_hashes.sh @@ -0,0 +1,160 @@ +#!/bin/bash +# Shared hash resolution library for RUFUS. +# Container-runtime agnostic — works inside both Docker and Singularity containers. +# The calling workflow is responsible for getting into the container first. +# +# Dependencies (must be sourced/available before this script): +# - chunk_utilities.sh (get_chunk_region, get_num_chunks) +# - resource_helpers/download_hash.sh (for S3 downloads) + +: "${RUFUS_ROOT:=/opt/RUFUS}" + +# Source chunk utilities if not already loaded +if ! declare -f get_chunk_region &>/dev/null; then + . "${RUFUS_ROOT}/singularity/launch_utilities/chunk_utilities.sh" +fi + +# Resolve a single hash file for a given region from a directory. +# Uses glob matching: *{fmtd_region}*.Jhash +# +# Args: +# $1 - hash_dir: directory containing Jhash files +# $2 - fmtd_region: formatted region string (e.g., chr1_1_1000000) or "wg" for whole-genome +# +# Returns: prints the resolved file path to stdout +# Exits 1 on error (0 matches or >1 matches) +resolve_hash_for_region() { + local hash_dir="$1" + local fmtd_region="$2" + + local -a matches + mapfile -t matches < <(find "$hash_dir" -maxdepth 1 -name "*${fmtd_region}*.Jhash" \( -type f -o -type l \) 2>/dev/null) + + if [ ${#matches[@]} -eq 0 ]; then + echo "ERROR: No hash file found matching '*${fmtd_region}*.Jhash' in ${hash_dir}" >&2 + return 1 + elif [ ${#matches[@]} -gt 1 ]; then + echo "ERROR: Multiple hash files found matching '*${fmtd_region}*.Jhash' in ${hash_dir}:" >&2 + printf ' %s\n' "${matches[@]}" >&2 + echo "Please ensure only one matching .Jhash file exists per region." >&2 + return 1 + fi + + echo "${matches[0]}" +} + +# Download all region hashes from S3 for a given hash type and version. +# +# Args: +# $1 - hash_type: e.g., "kg1", "control" +# $2 - hash_version: e.g., "v3.0", "v1.0" +# $3 - window_size: window size in KB (0 for whole-genome) +# $4 - genome_build: e.g., "GRCh38" +# $5 - dest_dir: directory to save downloaded hashes +download_hashes() { + local hash_type="$1" + local hash_version="$2" + local window_size="$3" + local genome_build="$4" + local dest_dir="$5" + + mkdir -p "$dest_dir" + + local original_dir + original_dir="$(pwd)" + + cd "$dest_dir" || { echo "ERROR: cannot cd to $dest_dir" >&2; return 1; } + + if [ "$window_size" -eq 0 ]; then + echo "INFO: Downloading whole-genome ${hash_type} hash (version ${hash_version}) from S3..." + bash "${RUFUS_ROOT}/resource_helpers/download_hash.sh" "$hash_type" "$hash_version" "wg" \ + || { echo "ERROR: Failed to download whole-genome ${hash_type} hash from S3" >&2; cd "$original_dir"; return 1; } + else + local num_chunks + num_chunks=$(get_num_chunks "$window_size" "$genome_build") + echo "INFO: Downloading ${num_chunks} ${hash_type} region hashes (version ${hash_version}) from S3..." + + local i fmtd_region region + for ((i = 0; i < num_chunks; i++)); do + region=$(get_chunk_region "$i" "$window_size" "$genome_build") + fmtd_region=$(echo "$region" | tr ':-' '_') + + bash "${RUFUS_ROOT}/resource_helpers/download_hash.sh" "$hash_type" "$hash_version" "$fmtd_region" \ + || { echo "ERROR: Failed to download ${hash_type} hash for region ${region} from S3" >&2; cd "$original_dir"; return 1; } + + # Progress indicator every 100 regions + if (( (i + 1) % 100 == 0 )); then + echo "INFO: Downloaded ${hash_type} hashes for $((i + 1))/${num_chunks} regions" + fi + done + echo "INFO: Finished downloading all ${num_chunks} ${hash_type} region hashes" + fi + + cd "$original_dir" +} + +# Validate that hash files exist for all regions in a directory. +# +# Args: +# $1 - hash_dir: directory containing Jhash files +# $2 - window_size: window size in KB (0 for whole-genome) +# $3 - genome_build: e.g., "GRCh38" +# +# Returns 0 if all regions have exactly one matching hash, 1 otherwise. +validate_all_region_hashes() { + local hash_dir="$1" + local window_size="$2" + local genome_build="$3" + + if [ ! -d "$hash_dir" ]; then + echo "ERROR: Hash directory does not exist: ${hash_dir}" >&2 + return 1 + fi + + if [ "$window_size" -eq 0 ]; then + # Whole-genome mode: look for *wg*.Jhash + resolve_hash_for_region "$hash_dir" "wg" > /dev/null \ + || { echo "ERROR: Whole-genome hash validation failed in ${hash_dir}" >&2; return 1; } + echo "INFO: Validated whole-genome hash in ${hash_dir}" + return 0 + fi + + local num_chunks + num_chunks=$(get_num_chunks "$window_size" "$genome_build") + + # Sample first 10 and last 10 indices (deduped) rather than checking all chunks. + local sample_size=10 + local -a indices=() + for ((i = 0; i < sample_size && i < num_chunks; i++)); do + indices+=("$i") + done + for ((i = num_chunks - sample_size; i < num_chunks; i++)); do + if (( i >= sample_size )); then # avoid duplicates with the first window + indices+=("$i") + fi + done + + echo "INFO: Spot-checking ${#indices[@]} of ${num_chunks} region hashes in ${hash_dir}..." + + local i region fmtd_region errors=0 + for i in "${indices[@]}"; do + region=$(get_chunk_region "$i" "$window_size" "$genome_build") + fmtd_region=$(echo "$region" | tr ':-' '_') + + if ! resolve_hash_for_region "$hash_dir" "$fmtd_region" > /dev/null; then + errors=$((errors + 1)) + if [ $errors -ge 5 ]; then + echo "ERROR: Too many missing hashes (showed first 5). Aborting validation." >&2 + return 1 + fi + fi + done + + if [ $errors -gt 0 ]; then + echo "ERROR: ${errors} region hash(es) missing or ambiguous in ${hash_dir}" >&2 + return 1 + fi + + echo "INFO: Spot-check passed (${#indices[@]}/${num_chunks} regions) in ${hash_dir}" + return 0 +} diff --git a/resource_helpers/write_command_args.sh b/resource_helpers/write_command_args.sh new file mode 100644 index 00000000..2dbba9b6 --- /dev/null +++ b/resource_helpers/write_command_args.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# This is run within container + +# ENV override +: "${RUFUS_ROOT:=/opt/RUFUS}" + +# Constants +CMD_OUT="./rufus_temp/rufus.cmd" +GLOBALS_FILE="$RUFUS_ROOT/resources/globals.txt" +USER_SPEC="$(id -u):$(id -g)" + +# Required args +CONTAINER_ID="$1" +CONT_ENV_FILE="./rufus_temp/temp_rufus.env" + +# Make env variables available +if [ -f "$CONT_ENV_FILE" ]; then + set -a + source <(grep -v '^#' $CONT_ENV_FILE | grep -v '^[[:space:]]*$' | sed 's/\r$//') + set +a +else + echo "Error: $CONT_ENV_FILE file not found - please provide valid path to rufus.env file" + exit 1 +fi + +# Make globals available +if [ -f "$GLOBALS_FILE" ]; then + set -a + source <(grep -v '^#' $GLOBALS_FILE | grep -v '^[[:space:]]*$' | sed 's/\r$//') + set +a +else + echo "Error: $GLOBALS_FILE file not found - please provide valid path to rufus.env file" + exit 1 +fi + +# get control argument or internal version +ctrl_arg="" +if [ "${#CONTROL_FILE_ARRAY[@]}" -eq 0 ]; then + ctrl_arg="-e internal_$CONTROL_HASH_VERSION" +else + # Concatenate controls into a single -c delimited string + for control in "${CONTROL_FILE_ARRAY[@]}"; do + ctrl_arg+="-c $control" + done +fi + +run_cmd="docker -u ${USER_SPEC} exec ${CONTAINER_ID} bash $RUFUS_ROOT/runRufus.sh -s $SUBJECT_FILE $ctrl_arg -r $REFERENCE_FASTA -k $KMER_LENGTH -m $KMER_DEPTH_CUTOFF -t $THREAD_LIMIT $OTHER_FLAGS -e kg1_$KG1_HASH_VERSION" +post_cmd="docker exec -u ${USER_SPEC} ${CONTAINER_ID} bash $RUFUS_ROOT/post_process/post_process.sh -s $SUBJECT_FILE -r $REFERENCE_FASTA -w $WINDOW_SIZE -d . $ctrl_arg" + +mkdir -p ./rufus_supplementals + +echo "##RUFUSCommandLine=" > "$CMD_OUT" +echo "##RUFUSCommandLine=" >> "$CMD_OUT" \ No newline at end of file diff --git a/resources/globals.txt b/resources/globals.txt new file mode 100644 index 00000000..54900f87 --- /dev/null +++ b/resources/globals.txt @@ -0,0 +1,5 @@ +RUFUS_BRANCH="main" +RUFUS_VERSION="v1.2.0" + +# todo: put RDIR in here +# todo: put post process version here diff --git a/resources/vcf_header.txt b/resources/vcf_header.txt new file mode 100644 index 00000000..f40b045f --- /dev/null +++ b/resources/vcf_header.txt @@ -0,0 +1,40 @@ +##FORMAT= +##FORMAT= +##FORMAT= +##FORMAT= +##FORMAT= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##FILTER= +##FILTER= +##FILTER= +##FILTER= +##FILTER= +##ALT= +##ALT= +##ALT= \ No newline at end of file diff --git a/runRufus.sh b/runRufus.sh index 61e3dbea..55b80f7a 100755 --- a/runRufus.sh +++ b/runRufus.sh @@ -1,49 +1,51 @@ #!/bin/bash -set -e +# Set root directory to env path if exists +: "${RUFUS_ROOT:=/opt/RUFUS}" +echo "RUFUS_ROOT is $RUFUS_ROOT" + +WORK_ROOT="${PWD}" +cd "$WORK_ROOT" + +# Import globals +GLOBALS_FILE="$RUFUS_ROOT/resources/globals.txt" # Path to globals file inside container +set -a +source <(grep -v '^#' $GLOBALS_FILE | grep -v '^[[:space:]]*$' | sed 's/\r$//') +set +a +echo -n "You are running the $RUFUS_BRANCH" +echo " version of RUFUS: $RUFUS_VERSION" +echo " root dir is $WORK_ROOT" -# This is a rather minimal example Argbash potential -# Example taken from http://argbash.readthedocs.io/en/stable/example.html -# ARG_OPTIONAL_SINGLE([subject],[s],[generator file containing the subject of interest]) -# ARG_OPTIONAL_SINGLE([ref],[r],[file path to the desired reference file]) -# ARG_OPTIONAL_SINGLE([threads],[t],[number of threads to use]) -# ARG_OPTIONAL_SINGLE([kmersize],[k],[size of Khmer to use]) -# ARG_OPTIONAL_SINGLE([min],[m],[overwrites the minimum k-mer count to call variant]) -# ARG_POSITIONAL_INF([controls],[generator files containing the control subjects],[0]) -# ARG_HELP([The general script's help msg]) -# ARGBASH_GO() -# needed because of Argbash --> m4_ignore([ -### START OF CODE GENERATED BY Argbash v2.5.1 one line above ### -# Argbash is a bash code generator used to get arguments parsing right. -# Argbash is FREE SOFTWARE, see https://argbash.io for more info -# Generated online by https://argbash.io/generate +set -e start_time=$(date +"%s") -echo "RUFUS version V1.0.0-gamma-ip" echo -e "RUFUS command was: $0 $@" date MaxHashDepth=1200; #need to make this a passed option -RDIR=/opt/RUFUS +RDIR="$RUFUS_ROOT" ##########################__SET_EXECUTABLE_PATHS__############################## -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RufAlu=$RDIR/bin/externals/rufalu/src/rufalu_project/src/aluDetect -RUFUSOverlap=$RDIR/scripts/Overlap.shorter.sh +# Internal scripts RunJelly=$RDIR/scripts/RunJellyForRUFUS.sh PullSampleHashes=$RDIR/scripts/CheckJellyHashList.sh +RUFUSOverlap=$RDIR/scripts/Overlap.shorter.sh RemoveCoInheritedVars=$RDIR/scripts/remove_coinherited.sh + +# RUFUS Specific Modules +RufAlu=$RDIR/bin/externals/rufalu/src/rufalu_project/src/aluDetect modifiedJelly=$RDIR/bin/externals/modified_jellyfish/src/modified_jellyfish_project/bin/jellyfish -bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa + +# TODO: already in PATH, shouldn't have to rename here, should be directly accessible +RUFUSmodel=$RDIR/bin/ModelDist RUFUSfilterFASTQ=$RDIR/bin/RUFUS.Filter RUFUSfilterFASTQse=$RDIR/bin/RUFUS.Filter.single + +# Standard tools - TODO: move to image install fastp=$RDIR/bin/externals/fastp/src/fastp_project/fastp samblaster=$RDIR/bin/externals/samblaster/src/samblaster_project/samblaster +bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa ############################################################################################ -BOUND_DATA_DIR=/mnt -cd $BOUND_DATA_DIR - die() { local _ret=$2 @@ -67,10 +69,16 @@ _positionals=() _arg_exclude=() # THE DEFAULTS INITIALIZATION - OPTIONALS _arg_controls=() -_arg_subject= +_arg_subjects=() +_arg_subject_fastqs=() +_arg_control_fastqs=() _arg_ref= _arg_threads=3 _arg_kmersize=25 +# NOTE: this default is load-bearing beyond its face value. The model phase (see MODEL PHASE +# below) only runs when _arg_min is EMPTY, so initialising it here means that branch is never +# taken and ModelDist never runs. Clearing this default would silently enable the model and +# change genotyping behaviour across the board -- do not "tidy" it without reading that block. _arg_min=5 _arg_refhash= _arg_saliva="FALSE" @@ -81,8 +89,11 @@ _assemblySpeed="full" _parallel_jelly="no" _pairedEnd="true" _arg_region= +_use_region_hash="FALSE" _arg_filterK=1 _arg_ParLowK=2 +_arg_ParLowCovThreshold=7 +_arg_hash_size= _filterMinQ=15 _arg_stop="nope" _arg_dev_reporting="FALSE" @@ -92,16 +103,17 @@ _arg_abs_coord_index=0 print_help () { printf "%s\n" "The general script's help msg" - printf 'Usage: %s [-s|--subject ] [-r|--ref ] [-t|--threads ] [-k|--kmersize ] [-m|--min ] [-h|--help] [] ... [] ...\n' "$0" - printf "\t%s\n" "-s,--subject: bam/cram/fastq(or pair of fastq files)/generator file containing the subject of interest (no default, only one subject per run for now)" + printf 'Usage: %s [-s|--subject ] ... [-r|--ref ] [-t|--threads ] [-k|--kmersize ] [-m|--min ] [-h|--help] [] ... [] ...\n' "$0" + printf "\t%s\n" "-s,--subject: bam/cram/fastq(or pair of fastq files)/generator file containing the subject of interest (can be used multiple times for split files from the same sample)" printf "\t%s\n" "-c, --controls: bam/cram/fastq(or pair of fastq files)/generator file for the sequence data of the control sample (can be used multipe times)" printf "\t%s\n" "-e,--exclude: Jhash file of kmers to exclude from mutation list, k must be (no default, can be used multiple times)" + printf "\t%s\n" "-eR, --exclude-region-hash: Region-specific Jhash file of kmers to exclude from mutation list; only support 1mb region sizes" printf "\t%s\n" "-se, --single_end_reads: subject bam file is single end reads, not paired (default is to assume paired end data)" printf "\t%s\n" "-r,--ref: file path to the desired reference file (no default)" printf "\t%s\n" "-cr,--cramref: file path to the desired reference file to decompress input cram files (no default)" printf "\t%s\n" "-t,--threads: number of threads to use (no default) (min 3)" printf "\t%s\n" "-k,--kersize: size of k-mer to use (no default)" - printf "\t%s\n" "-m,--min: overwrites the minimum k-mer count to call variant (no default)" + printf "\t%s\n" "-m,--min: minimum k-mer count to call a variant (default 5 -- see NOTE below)" printf "\t%s\n" "-i, --saliva: flag to indicate that the subject sample is a buccal swab and likely contains a significant fraction of contaminant DNA" printf "\t%s\n" "-mx, --MaxAllele: Max size for insert/deletion events to put the entire alt sequence in. (default 1000)" printf "\t%s\n" "-L, --Report_Low_Freq: Reprot Mosaic/Low Frequency/Somatic variants (default FALSE)" @@ -109,26 +121,31 @@ print_help () printf "\t%s\n" "-o, --devOutput: Prints very verbose run information to stdout" printf "\t%s\n" "-h,--help: Print help" printf "\t%s\n" "-d: Print dev help" + printf "\n" + printf "\t%s\n" "NOTE on -m/--min and the coverage model: -m always carries a value (default 5), and the" + printf "\t%s\n" "coverage-model phase only runs when -m is unset, so in practice the model is never built." + printf "\t%s\n" "RUFUS uses -m directly as the minimum k-mer count. A consequence is that the GT and" + printf "\t%s\n" "FILTER columns of the VCF are not model-derived; see MODEL PHASE in runRufus.sh." } print_devhelp () { printf "%s\n" "The general script's help msg" - printf 'Usage: %s [-s|--subject ] [-r|--ref ] [-t|--threads ] [-k|--kmersize ] [-m|--min ] [-h|--help] [] ... [] ... [-r|--ref ] [-t|--threads ] [-k|--kmersize ] [-m|--min ] [-h|--help] [] ... [] ...\n' "$0" - printf "\t%s\n" "-s,--subject: bam/cram/fastq(or pair of fastq files)/generator file containing the subject of interest (no default, only one subject per run for now)" + printf "\t%s\n" "-s,--subject: bam/cram/fastq(or pair of fastq files)/generator file containing the subject of interest (can be used multiple times for split files from the same sample)" printf "\t%s\n" "-c, --controls: bam/cram/fastq(or pair of fastq files)/generator file for the sequence data of the control sample (can be used multiple times)" - printf "\t%s\n" "-e,--exclude: Jhash file of kmers to exclude from mutation list, k must be (no default, can be used multiple times)" - printf "\t%s\n" "-se, --single_end_reads: subject bam file is single end reads, not paired (default is to assume paired end data)" - printf "\t%s\n" "-r,--ref: file path to the desired reference file (no default)" - printf "\t%s\n" "-cr,--cramref: file path to the desired reference file to decompress input cram files (no default)" - printf "\t%s\n" "-t,--threads: number of threads to use (no default) (min 3)" - printf "\t%s\n" "-k,--kmersize: size of k-mer to use (no default)" - printf "\t%s\n" "-m,--min: overwrites the minimum k-mer count to call variant (no default)" - printf "\t%s\n" "-i, --saliva: flag to indicate that the subject sample is a buccal swab and likely contains a significant fraction of contaminant DNA" - printf "\t%s\n" "-mx, --MaxAllele: Max size for insert/deletion events to put the entire alt sequence in. (default 1000)" - printf "\t%s\n" "-L, --Report_Low_Freq: Report Mosaic/Low Frequency/Somatic variants (default FALSE)" - printf "\t%s\n" "-z, --Dev output: Keep all intermediate files produced by RUFUS (default FALSE)" + printf "\t%s\n" "-e,--exclude: Jhash file of kmers to exclude from mutation list, k must be (no default, can be used multiple times)" + printf "\t%s\n" "-se, --single_end_reads: subject bam file is single end reads, not paired (default is to assume paired end data)" + printf "\t%s\n" "-r,--ref: file path to the desired reference file (no default)" + printf "\t%s\n" "-cr,--cramref: file path to the desired reference file to decompress input cram files (no default)" + printf "\t%s\n" "-t,--threads: number of threads to use (no default) (min 3)" + printf "\t%s\n" "-k,--kmersize: size of k-mer to use (no default)" + printf "\t%s\n" "-m,--min: minimum k-mer count to call a variant (default 5 -- see NOTE below)" + printf "\t%s\n" "-i, --saliva: flag to indicate that the subject sample is a buccal swab and likely contains a significant fraction of contaminant DNA" + printf "\t%s\n" "-mx, --MaxAllele: Max size for insert/deletion events to put the entire alt sequence in. (default 1000)" + printf "\t%s\n" "-L, --Report_Low_Freq: Report Mosaic/Low Frequency/Somatic variants (default FALSE)" + printf "\t%s\n" "-z, --Dev output: Keep all intermediate files produced by RUFUS (default FALSE)" printf "\t%s\n" "-CLEAN: Does not do a rufus run but cleans up intermediate files created by RUFUS" printf "\t%s\n" "################################################################################################" @@ -137,7 +154,7 @@ s-n>] ...\n' "$0" printf "\t%s\n" "-f,--refhash: Jhash file containing reference hashList (no default)" printf "\t%s\n" "-mx, --MaxAllele: Max size for insert/deletion events to put the entire alt sequence in. (default 1000)" - printf "\t%s\n" "-ex, --exome: flag to set if your input data is exome sequencing. Distribution model is not used, -m = 20, saliva fix is set, max kmer depth set to 1 million (EXPERIMENTAL values used here have not been exhaustivly tested)" + printf "\t%s\n" "-ex, --exome: flag to set if your input data is exome sequencing. Sets saliva fix and max kmer depth of 1 million (EXPERIMENTAL values used here have not been exhaustivly tested). The distribution model is not used -- though see the NOTE below, it is not used in any mode. The intended -m = 20 override is also inactive: -m already has a default, so an exome run uses -m 5 unless you pass -m explicitly." printf "\t%s\n" "-q1,--fastq1: If starting from fastq files, a list of the mate1 fastq files to improve RUFUS.filter" printf "\t%s\n" "-q2,--fastq2: If starting from fastq files, a list of the mate2 fastq files to improve RUFUS.filter" printf "\t%s\n" "-vs, --Very_Short_Assembly: use very short assembly methods, recommended when you are expecting over 10,000 variants " @@ -146,6 +163,8 @@ s-n>] ...\n' "$0" printf "\t%s\n" "-fk, --filterK: kmer threshold for number of kmers required to keep a read during filtering (default = 1)" printf "\t%s\n" "-fq, --filterMinQ: Minimum base quality for filter step, any kmer with any bases lower than this quality will be ignored (default = 15)" printf "\t%s\n" "-pl, --ParLowK: Lowest kmer count to be kept when counting parent jellyfish tables (default = 2, using 1 will SIGNIFICANTLY increase run time and is not advised)" + printf "\t%s\n" "-plct, --ParLowCovThreshold: k-mer count ceiling in controls below which a variant is flagged as low-coverage-parent/inherited (default = 7, set to 0 to disable, e.g. when using an assembly as the control)" + printf "\t%s\n" "-hs, --hash_size: jellyfish initial hash size (-s) for the subject/control count step, e.g. 32G (default: 1G in region mode, 8G in whole-genome mode). Must match the -s used to build any pre-made control/DSA hash being merged against." printf "\t%s\n" "-StJ: Stop run after jellyfish steps" #TODO: dont require reference and other non needed options if this is set printf "\t%s\n" "-StH: Stop run after hash compare steps" #TODO: dont require reference and other non needed options if this is set printf "\t%s\n" "-StF: Stop run after filter steps" @@ -154,6 +173,19 @@ s-n>] ...\n' "$0" printf "\t%s\n" "-d,--devhelp: HELP!!! for developers" printf "\t%s\n" "-pa,--passArray: pass the slurm array index to the script for debugging purposes" printf "\t%s\n" "-cn,--currAbsNum: pass the calculated absolute coordinate value to the script for debugging purposes" + printf "\n" + printf "\t%s\n" "################################################################################################" + printf "\t%s\n" "NOTE: the coverage-distribution model (ModelDist) is never built, in any run mode." + printf "\t%s\n" "################################################################################################" + printf "\t%s\n" "The model phase is gated on '[ -z \$_arg_min ] && [ \$_arg_exome == FALSE ]', but _arg_min is" + printf "\t%s\n" "initialised to 5 in the defaults block and never cleared, so the first test is never true and" + printf "\t%s\n" "the else branch always runs. That branch writes a 4-line placeholder .7.7.model and never" + printf "\t%s\n" "produces the .7.7.dist that RUFUS.interpret is passed via -mod, so ProcessDist fails to open" + printf "\t%s\n" "it (non-fatally) and the Bayesian genotyper is inert. Observable effects: GT is '.' and FILTER" + printf "\t%s\n" "is '.' on essentially every SNV/indel record, FILTER=PASS is unreachable on that path, and" + printf "\t%s\n" "Dist1XCutoff falls back to 100000 which disables the repeat filter in PickDepthSomatic." + printf "\t%s\n" "This is documented, not fixed: enabling the model activates several latent defects in" + printf "\t%s\n" "RUFUS.interpret at the same time. See docs/RUFUS.interpret.audit.md section 2.1." } re='^[0-9]+$'; @@ -165,30 +197,17 @@ parse_commandline () case "$_key" in -s|--subject) test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 - FileName=$(basename "$2") - Extension="${FileName##*.}" - genName=$FileName - if [[ $Extension == 'fastq' ]] || [[ $Extension == 'fq' ]] || [[ $Extension == 'gz' ]] ; then - echo "" > "$FileName".generator - _arg_subject=("$FileName".generator) - fi - while [[ $2 != -* ]]; do - FileName=$(basename "$2") - Extension="${FileName##*.}" - if [ $Extension = "fastq" ] || [ $Extension = "fq" ] || [ $Extension = "gz" ] - then - echo "Warning: fastq files not currently recommended" - if [[ $Extension == 'gz' ]] - then - echo "perl $RDIR/scripts/FastqToSam.pl <(zcat $2)" >> "$genName".generator - else - echo "perl $RDIR/scripts/FastqToSam.pl <(cat $2)" >> "$genName".generator - fi - else - _arg_subject=("$2") - fi - shift - done + # Consume values up to the next -flag. FASTQ (unaligned) -> separate list, assembled into a + # whole-genome generator below; bam/cram/generator -> _arg_subjects directly. + while [[ $# -gt 1 && $2 != -* ]]; do + _ext="${2##*.}" + if [[ "$_ext" == "fastq" || "$_ext" == "fq" || "$_ext" == "gz" ]]; then + _arg_subject_fastqs+=("$2") + else + _arg_subjects+=("$2") + fi + shift + done ;; -r|--ref) test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 @@ -234,26 +253,10 @@ parse_commandline () ;; -c|--controls) test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 - #echo "checking parent count $#" - FileName=$(basename "$2") - Extension="${FileName##*.}" - genName=$FileName - if [[ $Extension == 'fastq' ]] || [[ $Extension == 'fq' ]] || [[ $Extension == 'gz' ]] ; then - echo "" > "$FileName".generator - _arg_controls+=("$FileName".generator) - fi - while [[ $2 != -* ]]; do - FileName=$(basename "$2") - Extension="${FileName##*.}" - if [ $Extension = "fastq" ] || [ $Extension = "fq" ] || [ $Extension = "gz" ] - then - echo "fastq file identified" - if [[ $Extension == 'gz' ]] - then - echo "perl $RDIR/scripts/FastqToSam.pl <(zcat $2)" >> "$genName".generator - else - echo "perl $RDIR/scripts/FastqToSam.pl <(cat $2)" >> "$genName".generator - fi + while [[ $# -gt 1 && $2 != -* ]]; do + _ext="${2##*.}" + if [[ "$_ext" == "fastq" || "$_ext" == "fq" || "$_ext" == "gz" ]]; then + _arg_control_fastqs+=("$2") else _arg_controls+=("$2") fi @@ -301,33 +304,51 @@ parse_commandline () fi shift ;; - -R|--region) + -plct|--ParLowCovThreshold) test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 - _arg_region="$2" - if [[ -z $_arg_region ]] ; then - echo "arg region must not be empyty" + _arg_ParLowCovThreshold=$2 + if ! [[ $_arg_ParLowCovThreshold =~ $re ]] ; then + echo "arg -plct or --ParLowCovThreshold must be a number " exit 100 fi shift ;; + -hs|--hash_size) + test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 + _arg_hash_size=$2 + if ! [[ $_arg_hash_size =~ ^[0-9]+[GMKgmk]?$ ]] ; then + echo "arg -hs or --hash_size must be a jellyfish hash size, e.g. 32G, 500M, or a plain integer" + exit 100 + fi + shift + ;; + -R|--region) + test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 + _arg_region="$2" + if [[ -z $_arg_region ]] ; then + echo "arg region must not be empyty" + exit 100 + fi + shift + ;; -pa|--passArray) - test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 - _arg_slurm_array_index=$2 - if ! [[ $_arg_slurm_array_index =~ $re ]] ; then - echo "arg -pa or --passArray must be a number " - exit 100 - fi - shift + test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 + _arg_slurm_array_index=$2 + if ! [[ $_arg_slurm_array_index =~ $re ]] ; then + echo "arg -pa or --passArray must be a number " + exit 100 + fi + shift + ;; + -cn|--currAbsNum) + test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 + _arg_abs_coord_index=$2 + if ! [[ $_arg_abs_coord_index =~ $re ]] ; then + echo "arg -cn or --currAbsNum must be a number " + exit 100 + fi + shift ;; - -cn|--currAbsNum) - test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 - _arg_abs_coord_index=$2 - if ! [[ $_arg_abs_coord_index =~ $re ]] ; then - echo "arg -cn or --currAbsNum must be a number " - exit 100 - fi - shift - ;; -i|--saliva) _arg_saliva="TRUE" echo "INFO: Saliva subject sample provided" @@ -335,7 +356,7 @@ parse_commandline () -vs|--Very_Short_Assembly|--vs) _assemblySpeed="veryfast" echo "INFO: Very fast assembly being used" - ;; + ;; -se|--single_end_reads|--se) _pairedEnd="false" echo "INFO: Sample Bam file is single end data" @@ -427,14 +448,182 @@ assign_positional_args () done } -parse_commandline "$@" +# Combined EXIT trap: logs region status, then cleans up intermediary files +# NOTE: the actual trap is set later, after region logging variables are initialized + +# This function wraps the Jellyfish hash table creation script in order to keep track of exit statuses. +# It writes all exit statuses for controls to a single file, jelly_exit_code_controls.log and the exit status for the subject to jelly_exit_code_subject.log +# Reports whether a hash table is empty if looking in a specific region to stdout. +make_jelly_hash () +{ + local generator="$1" + local k="$2" + local threads="$3" + local lowK="$4" # The minimum number of kmers to keep in count step + local formRegionArg="$5" + local isControl="$6" + local exit_file="$7" + + # If we're in windowed mode, make hash smaller to make intersections with 1kg possible + hash_size="16G" + if [ "$formRegionArg" != "wg" ]; then + echo "We're in windowed mode, use a smaller hash size to allow for 1kg comparison" + hash_size="1G" + fi + + # Allow the region-based default to be overridden by the -hs/--hash_size argument. + # NOTE: this must match the -s used to build any pre-made control/DSA hash being merged against. + if [ -n "$_arg_hash_size" ]; then + echo "Overriding default hash size ($hash_size) with provided -hs/--hash_size value: $_arg_hash_size" + hash_size="$_arg_hash_size" + fi + + set +e + bash $RunJelly "$generator" "$k" "$threads" "$lowK" "$hash_size" + local exitCode=$? + set -e + + echo "$exitCode" > "$exit_file" + + if [[ $exitCode -ne 0 && -n "$formRegionArg" ]]; then + echo "RUFUS could not find any kmers in the provided region $formRegionArg in the file $generator; this usually means there is no coverage" + fi +} + +check_empty_hashes () +{ + local region_arg="$1" + shift + local subject_file="${@: -1}" + local control_files=("${@:1:$#-1}") + + # RunJellyForRUFUS.sh exit-code contract: 0 = counted OK, 1 = ran but the region + # genuinely has no k-mers, 2 = the counting tool itself failed (OOM, disk, crash). + # A tool failure must never be reported as an empty region -- in a sharded run that + # records a lost shard as legitimately variant-free, which is a silent wrong answer + # rather than a visible one. Treat anything that is not a clean 0 or 1 as failure, + # so an unexpected code (e.g. a signal-derived 137) also fails loudly. + local ef ef_rc + for ef in "${control_files[@]}" "$subject_file"; do + [ -f "$ef" ] || continue + ef_rc="$(cat "$ef" 2>/dev/null)" + case "$ef_rc" in + 0|1) ;; + *) + echo "ERROR: k-mer counting failed (exit '${ef_rc:-}', from $ef) in region $region_arg;" \ + "this is a tool failure, NOT an absence of coverage" >&2 + _region_exit_reason="jellyfish_failed" + exit 1 + ;; + esac + done + + # Check that at least one control has hashes (i.e. has a zero exit code) + found_zero=false + + # Controls + if [ "${#control_files[@]}" -gt 0 ]; then + found_zero=false + for f in "${control_files[@]}"; do + if [ -f "$f" ] && [ "$(cat "$f")" -eq 0 ]; then + found_zero=true + break + fi + done + + if [ "$found_zero" = false ]; then + echo "No control kmers found in region $region_arg" >&2 + _region_exit_reason="no_control_kmers" + exit 0 + fi + fi + + # Subject + if [ ! -f "$subject_file" ] || [ "$(cat "$subject_file")" -ne 0 ]; then + echo "No subject kmers found in region $region_arg" >&2 + _region_exit_reason="no_subject_kmers" + exit 0 + fi + + # Cleanup + rm -f "$subject_file" + for f in "${control_files[@]}"; do + rm -f "$f" + done +} + + +parse_commandline "$@" region_postfix="" if [ ! -z "${_arg_region}" ]; then formatted_region=$(echo "${_arg_region}" | tr : _ | tr - _) region_postfix=".${formatted_region}" +else + formatted_region="wg" + region_postfix=".${formatted_region}" fi +# Region status logging: each invocation appends a line to a shared log in WORK_ROOT. +# The EXIT trap handles all logging so we only need to set _region_exit_reason before exiting. +REGION_LOG="${WORK_ROOT}/region_status.log" +_region_exit_reason="" + +on_exit() { + local exit_code=$? + + # --- Region status logging (only in region mode) --- + if [ "$formatted_region" != "wg" ] && [ -n "$formatted_region" ]; then + local status reason + if [ "$exit_code" -eq 0 ]; then + if [ "$_region_exit_reason" = "success" ]; then + status="VARIANTS_CALLED" + else + status="NO_VARIANTS" + fi + reason="${_region_exit_reason:-unknown}" + else + status="ERROR" + reason="exit_code=${exit_code};${_region_exit_reason:-unknown}" + fi + printf '%s\t%s\t%s\n' "$formatted_region" "$status" "$reason" >> "$REGION_LOG" + fi + + # --- File cleanup --- + echo "Cleaning up..." >&2 + if [ "$exit_code" -ne 0 ]; then + echo "Script exited with error (exit code $exit_code). Preserving WORK_DIR for debugging: $WORK_DIR" >&2 + return + fi + if [ "$_arg_dev_file_output" == "FALSE" ]; then + # Must cd out of WORK_DIR before removing it (rm -rf silently fails on CWD in some filesystems/containers) + cd "$WORK_ROOT" + if [[ "$WORK_DIR" == "$WORK_ROOT"/rufus_* ]]; then + rm -rf "$WORK_DIR" + else + echo "Refusing to remove unsafe WORK_DIR: $WORK_DIR" >&2 + fi + fi +} +trap 'on_exit' EXIT + +# Make region specific directory so no file overlaps +WORK_DIR="${WORK_ROOT}/rufus_${formatted_region}" +export WORK_DIR="$WORK_DIR" + +# Make all sub-dirs w/ abs path +mkdir -p "$WORK_DIR" +RUFUS_TMP="$WORK_DIR/rufus_temp" +mkdir -p "$RUFUS_TMP" +mkdir -p "$WORK_DIR/Intermediates" +mkdir -p "$WORK_DIR/TempOverlap" + +cd "$WORK_DIR" + +rufus_invoc_file="$RUFUS_TMP/rufus_command_$formatted_region.txt" +echo "$RUFUS_BRANCH" > $rufus_invoc_file +echo "$RUFUS_VERSION" >> $rufus_invoc_file +printf "%q " "$@" >> "$rufus_invoc_file" # [ <-- needed because of Argbash @@ -455,7 +644,7 @@ fi if [ "$_arg_dev_reporting" = "TRUE" ]; then echo "Verbose developer reporting on..." - echo " _arg_subject=$_arg_subject" + echo " _arg_subjects=${_arg_subjects[*]}" echo " _arg_ref=$_arg_ref" echo " _arg_threads=$_arg_threads" echo " _arg_kmersize=$_arg_kmersize" @@ -470,7 +659,8 @@ if [ "$_arg_dev_reporting" = "TRUE" ]; then echo " _pairedEnd=$_pairedEnd" echo " _arg_region=$_arg_region" echo " _arg_filterK=$_arg_filterK" - echo " _arg_ParLowK=$_arg_ParLowK" + echo " _arg_ParLowK=$_arg_ParLowK" + echo " _arg_hash_size=$_arg_hash_size" echo " _filterMinQ=$_filterMinQ" echo " _arg_dev_file_output=$_arg_dev_file_output" fi @@ -491,13 +681,13 @@ then _arg_threads=$(nproc); fi -if [ -z $_arg_subject ] -then - echo "ERROR: you must provide a subject sample (sample you want to call variants in)" +if [ ${#_arg_subjects[@]} -eq 0 ] && [ ${#_arg_subject_fastqs[@]} -eq 0 ] +then + echo "ERROR: you must provide at least one subject sample (sample you want to call variants in)" kill -9 $$ -fi +fi -if [ ${#_arg_exclude[@]} -eq "0" ] && [ ${#_arg_controls[@]} -eq "0" ] +if [ ${#_arg_exclude[@]} -eq "0" ] && [ ${#_arg_controls[@]} -eq "0" ] && [ ${#_arg_control_fastqs[@]} -eq "0" ] then echo "You must provide RUFUS with at least one control or exclude sample" echo "Killing run with non-zero exit status" @@ -520,19 +710,24 @@ do [[ $value != -e ]] && new_array+=($value) done _arg_exclude=("${new_array[@]}") -unset new_arary +unset new_array unset ExcludeTemp ########################Setting up Exome Run EXPERIMENTAL ################################## -if [ "$_arg_exome" = "TRUE" ]; then +if [ "$_arg_exome" == "TRUE" ]; then echo "Exome run set. Setting max kmer to 1M and saliva = true and making sure a lower cutoff was set " MaxHashDepth=100000000 _arg_saliva="TRUE" - if [ -z $_arg_min ]; then - echo "Minimum not provided, picking a min of 20 for the alt count" + # NOTE: this block is dead for the same reason the model phase is (see MODEL PHASE below): + # _arg_min is initialised to 5 in the defaults block and never cleared, so it is never + # empty and the 20 is never applied. An exome run therefore uses -m 5 like everything + # else unless the user passes -m explicitly. Documented, not changed -- raising the + # effective exome minimum from 5 to 20 is a real behaviour change, not a cleanup. + if [ -z $_arg_min ]; then + echo "Minimum not provided, picking a min of 20 for the alt count" _arg_min="20" - fi + fi fi @@ -552,42 +747,174 @@ fi ############################################################# Parents=("${_arg_controls[@]}") -_arg_ref_cat="${_arg_ref%.*}" -###############__CHECK_IF_ALL_REFERENCE_FILES_EXIST__##################### -BUILD_REFS="FALSE" -if [[ ! -e "$_arg_ref".sa ]] && [[ ! -e "$_arg_ref_cat".sa ]] -then - BUILD_REFS="TRUE" +#########__CREATE_ALL_GENERATOR_FILES_AND_VARIABLES__############# +# Use first subject file for naming conventions +if [ ${#_arg_subjects[@]} -gt 0 ]; then + ProbandFileName=$(basename "${_arg_subjects[0]}") +else + ProbandFileName=$(basename "${_arg_subject_fastqs[0]}") fi +ProbandExtension="${ProbandFileName##*.}" +ProbandGenerator="${ProbandFileName}${region_postfix}.generator" -if [[ ! -e "$_arg_ref".bwt ]] && [[ ! -e "$_arg_ref_cat".bwt ]] -then - BUILD_REFS="TRUE" -fi +# Build concatenated generator from all subject files +> "$ProbandGenerator" +for subject in "${_arg_subjects[@]}" +do + subjectFileName=$(basename "$subject") + subjectExtension="${subjectFileName##*.}" -if [[ ! -e "$_arg_ref".pac ]] && [[ ! -e "$_arg_ref_cat".pac ]] -then - BUILD_REFS="TRUE" -fi + if [[ "$subjectExtension" != "cram" ]] && [[ "$subjectExtension" != "bam" ]] && [[ "$subjectExtension" != "generator" ]] || [[ ! -e "$subject" ]] + then + echo "The proband bam/cram/generator file $subject was not provided or does not exist; killing run with non-zero exit status" + kill -9 $$ + elif [[ "$subjectExtension" == "bam" ]] + then + if [[ ! -e "$subject".bai ]] + then + echo "Index file for subject bam file $subject not found. Please place in data directory and rerun." + _region_exit_reason="missing_subject_bam_index" + exit 1 + fi + echo "samtools view -h -@ 8 -F 3328 $subject $_arg_region" >> "$ProbandGenerator" + elif [[ "$subjectExtension" == "cram" ]] + then + if [[ ! -e "$subject".crai ]] + then + echo "Index file for subject cram file $subject not found. Please place in data directory and rerun." + _region_exit_reason="missing_subject_cram_index" + exit 1 + fi + if [ "$_arg_cramref" == "" ] + then + echo "ERROR cram reference not provided for cram input" + kill -9 $$ + fi + echo "samtools view -h -@ 8 -F 3328 -T $_arg_cramref $subject $_arg_region" >> "$ProbandGenerator" + _arg_ref="$_arg_cramref" + elif [[ "$subjectExtension" == "generator" ]] + then + cat "$subject" >> "$ProbandGenerator" + else + echo "unknown error during generator generation, killing run with non-zero exit status" + kill -9 $$ + fi +done -if [[ ! -e "$_arg_ref".amb ]] && [[ ! -e "$_arg_ref_cat".amb ]] -then - BUILD_REFS="TRUE" +# FASTQ subject(s): whole-genome only -- unaligned reads cannot be region-scoped. The loop above +# skipped them; build the generator here as one @HD header (on the first file) + unmapped SAM records. +if [ ${#_arg_subject_fastqs[@]} -gt 0 ]; then + if [ -n "$_arg_region" ]; then + echo "ERROR: FASTQ input is whole-genome only and cannot be region-scoped; remove -R/--region (or supply an aligned bam/cram)." + _region_exit_reason="fastq_with_region" + exit 1 + fi + if [ -z "$_arg_ref" ]; then + echo "ERROR: FASTQ subject input requires a reference via -r/--ref." + exit 1 + fi + _fq_first=1 + for fq in "${_arg_subject_fastqs[@]}"; do + [ -e "$fq" ] || { echo "FASTQ subject file $fq does not exist; killing run"; kill -9 $$; } + _hdr=""; [ "$_fq_first" -eq 1 ] && _hdr=" header"; _fq_first=0 + if [[ "$fq" == *.gz ]]; then + echo "perl $RDIR/scripts/FastqToSam.pl <(zcat $fq)$_hdr" >> "$ProbandGenerator" + else + echo "perl $RDIR/scripts/FastqToSam.pl <(cat $fq)$_hdr" >> "$ProbandGenerator" + fi + done + # Paired FASTQ: filter directly from the raw mate files via the -q1/-q2 path (avoids the + # collate/mate-split, which needs pairing flags the counting generator does not carry). Single-end + # (-se) skips this and uses the RUFUS.Filter.single path on the generator. An explicit -q1/-q2 wins. + if [ "$_pairedEnd" = "true" ] && [ -z "${_arg_fastqA:-}" ]; then + if [ ${#_arg_subject_fastqs[@]} -lt 2 ]; then + echo "ERROR: paired FASTQ subject needs mate1 and mate2 files (-s R1 R2); for single-end reads add -se." + exit 1 + fi + _arg_fastqA="${_arg_subject_fastqs[0]}" + _arg_fastqB="${_arg_subject_fastqs[1]}" + fi fi -if [[ ! -e "$_arg_ref".ann ]] && [[ ! -e "$_arg_ref_cat".ann ]] -then - BUILD_REFS="TRUE" -fi +# Have to do this after proband check in case cram reference is used +_arg_ref_cat="${_arg_ref%.*}" + +ParentGenerators=() +ParentJhash=() +ParentFileNames="" +space=" " + +for parent in "${Parents[@]}" +do + parentFileName=$(basename "$parent") + ParentFileNames=$ParentFileNames$space$parent + parentExtension="${parentFileName##*.}" + + if [[ "$parentExtension" != "cram" ]] && [[ "$parentExtension" != "bam" ]] && [[ "$parentExtension" != "generator" ]] + then + echo "The control bam/generator file" "$parent" " was not provided, or does not exist; killing run with non-zero exit status" + kill -9 $$ + elif [[ "$parentExtension" == "bam" ]] + then + # check for index file (needed for mpileup in post processing) + if [[ ! -e "$parent".bai ]] + then + echo "Index file for control bam file $parentFileName not found. Please place in data directory and rerun." + _region_exit_reason="missing_control_bam_index" + exit 1 + fi + parentGenerator="${parentFileName}${region_postfix}.generator" + ParentGenerators+=("$parentGenerator") + echo "samtools view -h -@ 8 -F 3328 $parent $_arg_region" > "$parentGenerator" + elif [[ "$parentExtension" == "cram" ]] + then + # check for index file (needed for mpileup in post processing) + if [[ ! -e "$parent".crai ]] + then + echo "Index file for control cram file $parentFileName not found. Please place in data directory and rerun." + _region_exit_reason="missing_control_cram_index" + exit 1 + fi + parentGenerator="${parentFileName}${region_postfix}.generator" + ParentGenerators+=("$parentGenerator") + if [ "$_arg_cramref" == "" ] + then + echo "ERROR cram reference not provided for cram input"; + kill -9 $$ + fi + echo "samtools view -h -@ 8 -F 3328 -T $_arg_cramref $parent $_arg_region" > "$parentGenerator" + _arg_ref="$_arg_cramref" + elif [[ "$parentExtension" = "generator" ]] + then + parentGenerator="${parent}${region_postfix}" + ParentGenerators+=("$parentGenerator") + fi +done +################################################################# -if [ "$BUILD_REFS" = "TRUE" ]; then - echo "Missing reference file indexes needed for BWA... Generating... " - fasta_idx=$(basename ${_arg_ref}) - $bwa index -a bwtsw $fasta_idx - samtools faidx $fasta_idx +# FASTQ control: whole-genome only; a single control built from its mate fastq(s). +if [ ${#_arg_control_fastqs[@]} -gt 0 ]; then + if [ -n "$_arg_region" ]; then + echo "ERROR: FASTQ control input is whole-genome only; remove -R/--region." + exit 1 + fi + ctrlFqGen="$(basename "${_arg_control_fastqs[0]}")${region_postfix}.generator" + ParentGenerators+=("$ctrlFqGen") + > "$ctrlFqGen" + _fq_first=1 + for fq in "${_arg_control_fastqs[@]}"; do + [ -e "$fq" ] || { echo "FASTQ control file $fq does not exist; killing run"; kill -9 $$; } + _hdr=""; [ "$_fq_first" -eq 1 ] && _hdr=" header"; _fq_first=0 + if [[ "$fq" == *.gz ]]; then + echo "perl $RDIR/scripts/FastqToSam.pl <(zcat $fq)$_hdr" >> "$ctrlFqGen" + else + echo "perl $RDIR/scripts/FastqToSam.pl <(cat $fq)$_hdr" >> "$ctrlFqGen" + fi + done fi +# Note: BWA index presence is validated below, once _arg_ref_bwa is resolved. ###### when we add PB need to check its reference stuff here ########################################################################### @@ -614,97 +941,52 @@ then kill -9 $$ fi if [[ -e "$_arg_ref_cat".sa ]] -then +then _arg_ref_bwa=$_arg_ref_cat else _arg_ref_bwa=$_arg_ref fi -#echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -#echo "Reference supplied: " "$_arg_ref" -#echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" - -echo -e "slurm array index is: $_arg_slurm_array_index" -echo -e "absolute coordinate index is: $_arg_abs_coord_index" -echo -e "slurm array index is: $_arg_slurm_array_index" >&2 -echo -e "absolute coordinate index is: $_arg_abs_coord_index" >&2 - - -#########__CREATE_ALL_GENERATOR_FILES_AND_VARIABLES__############# -ProbandFileName=$(basename "$_arg_subject") -ProbandExtension="${ProbandFileName##*.}" -#echo "proband extension is $ProbandExtension" - - -######## checking proband extension, FASTQ is not handled, need to add that, for the meantime generator dumping to SAM needs to be used ############# -if [[ "$ProbandExtension" != "cram" ]] && [[ "$ProbandExtension" != "bam" ]] || [[ ! -e "$_arg_subject" ]] && [[ "$ProbandExtension" != "generator" ]] -then - echo "The proband bam/generator file" "$_arg_subject" " was not provided or does not exist; killing run with non-zero exit status" - kill -9 $$ -elif [[ "$ProbandExtension" == "bam" ]] -then -# echo "you provided the proband cram file" "$_arg_subject" - ProbandGenerator="${ProbandFileName}${region_postfix}.generator" - echo "samtools view -F 3328 $_arg_subject $_arg_region" > "$ProbandGenerator" -elif [[ "$ProbandExtension" == "cram" ]] -then -# echo "you provided the proband cram file" "$_arg_subject" - ProbandGenerator="${ProbandFileName}${region_postfix}.generator" - if [ "$_arg_cramref" == "" ] +# Validate BWA/samtools indexes before any expensive stage. The launch scripts +# check this too, but runRufus.sh can be invoked directly, and without this the +# missing index only surfaces at the bwa mem step -- far into the run, after the +# jellyfish, model, hashlist and filter stages. _arg_ref_bwa above resolved the +# exact prefix bwa will load; the .fai hangs off the reference samtools reads. +missing_bwa_indexes=() +for bwa_suffix in amb ann bwt pac sa +do + if [[ ! -e "$_arg_ref_bwa".$bwa_suffix ]] then - echo "ERROR cram reference not provided for cram input"; - kill -9 $$ - fi - echo "samtools view -F 3328 -T $_arg_cramref $_arg_subject $_arg_region" > "$ProbandGenerator" -elif [[ "$ProbandExtension" = "generator" ]] + missing_bwa_indexes+=("$_arg_ref_bwa.$bwa_suffix") + fi +done +if [[ ! -e "$_arg_ref".fai ]] then -# echo "you provided the proband bam file" "$_arg_subject" - ProbandGenerator="${ProbandFileName}${region_postfix}" -else - echo "unknown error during generator generation, killing run with non-zero exit status" + missing_bwa_indexes+=("$_arg_ref.fai") +fi +if [[ ${#missing_bwa_indexes[@]} -ne 0 ]] +then + echo "ERROR: reference $_arg_ref is missing required index files:" + for missing in "${missing_bwa_indexes[@]}" + do + echo " $missing" + done + echo "RUFUS aligns candidate reads with BWA and cannot run without these." + echo "Build them with:" + echo " bash $RDIR/resource_helpers/build_bwa_indexes.sh $_arg_ref" + _region_exit_reason="missing_bwa_indexes" + exit 1 fi -ParentGenerators=() -ParentJhash=() -ParentFileNames="" -space=" " - -for parent in "${Parents[@]}" -do - parentFileName=$(basename "$parent") - ParentFileNames=$ParentFileNames$space$parent - parentExtension="${parentFileName##*.}" - if [[ "$parentExtension" != "cram" ]] && [[ "$parentExtension" != "bam" ]] && [[ "$parentExtension" != "generator" ]] - then - echo "The control bam/generator file" "$parent" " was not provided, or does not exist; killing run with non-zero exit status" - kill -9 $$ - elif [[ "$parentExtension" == "bam" ]] - then - parentGenerator="${parentFileName}${region_postfix}.generator" - ParentGenerators+=("$parentGenerator") - echo "samtools view -F 3328 $parent $_arg_region" > "$parentGenerator" -# echo "You provided the control bam file" "$parent" - elif [[ "$parentExtension" == "cram" ]] - then - parentGenerator="${parentFileName}${region_postfix}.generator" - ParentGenerators+=("$parentGenerator") - if [ "$_arg_cramref" == "" ] - then - echo "ERROR cram reference not provided for cram input"; - kill -9 $$ - fi - echo "samtools view -F 3328 -T $_arg_cramref $parent $_arg_region" > "$parentGenerator" - # echo "You provided the control cram file" "$parent" - elif [[ "$parentExtension" = "generator" ]] - then - parentGenerator="${parentFileName}${region_postfix}" - ParentGenerators+=("$parentGenerator") -# echo "You provided the control bam file" "$parent" - fi -done -################################################################# +#echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" +#echo "Reference supplied: " "$_arg_ref" +#echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" +# echo -e "slurm array index is: $_arg_slurm_array_index" +# echo -e "absolute coordinate index is: $_arg_abs_coord_index" +# echo -e "slurm array index is: $_arg_slurm_array_index" >&2 +# echo -e "absolute coordinate index is: $_arg_abs_coord_index" >&2 ################__COPY_ARG_BASH_VARIABLES_TO_SCRIPT_VARIABLES__################## @@ -749,7 +1031,6 @@ fi # echo " $parent" #done #echo "Value of K is: $K" -#echo "Value of Threads is: $Threads" #echo "value of ref is: $ref" #echo "value of min is: $_arg_min" #echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" @@ -788,38 +1069,51 @@ done ####################__GENERATE_JHASH_FILES_FROM_JELLYFISH__##################### +_region_exit_reason="jellyfish_stage" +CONTROL_EXIT_FILES=() +SUBJECT_EXIT_FILE="$RUFUS_TMP/jelly_exit_subject.${formatted_region}.txt" + if [ $_parallel_jelly == "yes" ] then ######## TODO instead of assuming 3 samples JThreads=$(( Threads / 3 )) if [ "$JThreads" -lt 3 ] then - JThreads=3 + JThreads=3 fi - #JThreads=$Threads - + for parent in "${ParentGenerators[@]}" do - bash $RunJelly $parent $K $(echo $JThreads -2 | bc) $_arg_ParLowK & + ef="$RUFUS_TMP/jelly_exit_control.${formatted_region}.$(basename "$parent").txt" + CONTROL_EXIT_FILES+=("$ef") + make_jelly_hash $parent $K $(echo $JThreads -2 | bc) $_arg_ParLowK $formatted_region true "$ef" & done - - bash $RunJelly $ProbandGenerator $K $(echo $JThreads -2 | bc) 2 & + + make_jelly_hash $ProbandGenerator $K $(echo $JThreads -2 | bc) 2 $formatted_region false "$SUBJECT_EXIT_FILE" & + + # wait here for all hashes to finish being made wait + + check_empty_hashes "$_arg_region" "${CONTROL_EXIT_FILES[@]}" "$SUBJECT_EXIT_FILE" + else - JThreads=$Threads - if [ "$JThreads" -lt 3 ] - then - JThreads=3 - fi + JThreads=$Threads + if [ "$JThreads" -lt 3 ] + then + JThreads=3 + fi - for parent in "${ParentGenerators[@]}" - do - bash $RunJelly $parent $K $(echo $JThreads -2 | bc) $_arg_ParLowK - done + for parent in "${ParentGenerators[@]}" + do + ef="$RUFUS_TMP/jelly_exit_control.${formatted_region}.$(basename "$parent").txt" + CONTROL_EXIT_FILES+=("$ef") + make_jelly_hash $parent $K $(echo $JThreads -2 | bc) $_arg_ParLowK $formatted_region true "$ef" + done + + make_jelly_hash $ProbandGenerator $K $(echo $JThreads -2 | bc) 2 $formatted_region false "$SUBJECT_EXIT_FILE" - # bash $RunJelly $ProbandGenerator $K $Threads 2 - bash $RunJelly $ProbandGenerator $K $(echo $JThreads -2 | bc) 2 -fi + check_empty_hashes "$_arg_region" "${CONTROL_EXIT_FILES[@]}" "$SUBJECT_EXIT_FILE" +fi ############################################################################## @@ -830,11 +1124,16 @@ do ## Check Jhash files are not empty if [ ! -s "$parent".Jhash ] then - echo "@@@@@@@@@@@__WARNING__@@@@@@@@@@@@@" - echo "$parent.Jhash is empty" - echo "Killing run with exit status 1" - echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" - kill -9 $$ + if [ -z $_arg_region ] + then + echo "ERROR: No hashes identified for $parent. This is very unlikely for a whole genome run and quality of input files should be examined. Exiting with non-zero status..." + _region_exit_reason="no_hashes_for_parent" + exit 100 + else + echo "WARNING:$parent.Jhash is empty - this can happen if $parent has zero coverage for the region provided to RUFUS. Stopping run." + _region_exit_reason="parent_empty_hash" + exit 0 + fi fi done @@ -852,6 +1151,7 @@ fi ##################__GENERATE_JHASH_HISTOGRAMS__################################# ######TODO I can probably get rid of this if I just make model read either tab or space +# .Jhash.histo files are created in RunJellyForRUFUS.sh call perl -ni -e 's/ /\t/;print' "$ProbandGenerator".Jhash.histo for parent in "${ParentGenerators[@]}" do @@ -861,7 +1161,33 @@ done +_region_exit_reason="model_stage" #######################__RUFUS_Model__############################################ +# MODEL PHASE -- READ THIS BEFORE CHANGING THE CONDITION BELOW. +# +# As written, the `then` branch is UNREACHABLE and ModelDist never runs, in any mode. +# `_arg_min` is initialised to 5 in the defaults block near the top of this file and is +# never cleared, so `[ -z "$_arg_min" ]` is never true and the `else` branch always runs. +# The commented-out line directly below is the previous condition: originally every +# non-exome run built the model, and adding the `-z "$_arg_min"` conjunct silently +# disabled it for everyone, because of that default. +# +# Confirmed empirically across every run in resources/reg_test_files/runs/: zero +# *.7.7.dist files, fifteen *.7.7.model placeholders (written by the else branch), zero +# logs containing "Starting model phase", six containing "min was provided". +# +# Downstream effect: the else branch writes a 4-line placeholder .7.7.model and never +# produces the .7.7.dist that Overlap.shorter.sh passes to RUFUS.interpret via -mod. +# ProcessDist treats the failed open as non-fatal, so DistGlobal stays empty and the +# Bayesian genotyper is inert -- GT and FILTER come out '.' on essentially every +# SNV/indel record, FILTER=PASS is unreachable on that path, and Dist1XCutoff falls back +# to 100000, which disables the repeat filter in PickDepthSomatic. +# +# This is DOCUMENTED, NOT FIXED, and deliberately so: restoring the condition would +# enable the model for the first time and simultaneously activate several latent defects +# in RUFUS.interpret (uninitialised read in BayseanGenotyper, out-of-bounds depth-clamp +# reads, unconstrained GT ploidy in ParseGenotype). Those have to be fixed in the same +# change or output gets worse, not better. See docs/RUFUS.interpret.audit.md section 2.1. #if [ $_arg_exome == "FALSE" ] #[ -z "$_arg_min" ] if [ -z "$_arg_min" ] && [ $_arg_exome == "FALSE" ] then @@ -883,25 +1209,25 @@ then then if [ -e "$ProbandGenerator".Jhash.histo.7.7.model ] then - if [ "$_arg_dev_reporting" = "TRUE" ]; then + if [ "$_arg_dev_reporting" == "TRUE" ]; then echo "$(grep Best\ Model "$ProbandGenerator".Jhash.histo.7.7.out)" fi MutantMinCov=$(head -2 "$ProbandGenerator".Jhash.histo.7.7.model | tail -1 ) - if [ "$_arg_dev_reporting" = "TRUE" ]; then + if [ "$_arg_dev_reporting" == "TRUE" ]; then echo "INFO: mutant min coverage from generated model is $MutantMinCov" fi MutantSC=$(head -4 "$ProbandGenerator".Jhash.histo.7.7.model | tail -1 ) - if [ "$_arg_dev_reporting" = "TRUE" ]; then + if [ "$_arg_dev_reporting" == "TRUE" ]; then echo "INFO: mutant SC coverage from generated model is $MutantSC" fi MaxHashDepth=$(echo "$MutantSC * 5" | bc) - if [ "$_arg_dev_reporting" = "TRUE" ]; then + if [ "$_arg_dev_reporting" == "TRUE" ]; then echo "INFO: MaxHashDepth = $MaxHashDepth" fi else @@ -919,7 +1245,8 @@ else echo "min coverage must be provided with an exome run" return -1; else -####TODO: check what im done here +# NOTE: this is a placeholder because filter step needs the arg_min value in a certain order +# The actual other values here are not(?) important or used echo "3" > "$ProbandGenerator".Jhash.histo.7.7.model; echo "$_arg_min" >> "$ProbandGenerator".Jhash.histo.7.7.model; echo "3.1392e+09" >> "$ProbandGenerator".Jhash.histo.7.7.model; @@ -934,54 +1261,80 @@ fi if [ "$_arg_stop" = "jelly" ]; then echo "-StJ used, stopping run"; + _region_exit_reason="user_stop_after_jelly" exit 1; fi ####################################################################################### -if [ -z $MutantMinCov ]; then +if [ -z $MutantMinCov ]; then echo "ERROR: No min coverage set, possible error in Model" + _region_exit_reason="no_min_coverage_from_model" exit 100 fi if [ "$MutantMinCov" -lt "2" ] then echo "ERROR, model couldn't pick a sensible lower cutoff, check your subject bam file" - exit + _region_exit_reason="model_bad_cutoff" + exit 1 fi #################################__HASH_LIST_FILTER__##################################### +_region_exit_reason="hash_list_stage" echo "Identifying unique subject kMers..." +FIFO_PREFIX="$WORK_DIR/${ProbandGenerator}.$$" +FIFO_MAIN="${FIFO_PREFIX}.temp" +FIFO_M1="${FIFO_PREFIX}.temp.mate1.fastq" +FIFO_M2="${FIFO_PREFIX}.temp.mate2.fastq" if [ -s "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList ] then echo "$ProbandGenerator.HashList exists, skipping creation..." else - if [ -e "$ProbandGenerator".temp ] + if [ -e "${FIFO_MAIN}" ] then - rm "$ProbandGenerator".temp + rm "${FIFO_MAIN}" fi - mkfifo "$ProbandGenerator".temp - $modifiedJelly merge -o "${ProbandGenerator}.mer_counts_merged.jf" "$ProbandGenerator".Jhash $(echo $parentsString) $(echo $parentsExcludeString) > "$ProbandGenerator".temp & - bash $PullSampleHashes $ProbandGenerator.Jhash "$ProbandGenerator".temp $MutantMinCov $MaxHashDepth > "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList + + # echo "About to make MAIN fifo" + mkfifo "${FIFO_MAIN}" + + # NOTE: the modifiedJelly merge is actually the opposite of a merge + # It intersects all of the provided Jhash files, and keeps only complements, or unique kmers + # These unique kmers are then queried from the subject Jhash and kept only if they are from the subject (and pass min/max thresholds) + # This was done because any attempt to simply filter the subject Jhash was prohibitively slow + $modifiedJelly merge -o "${ProbandGenerator}.mer_counts_merged.jf" "$ProbandGenerator".Jhash $(echo $parentsString) $(echo $parentsExcludeString) > "${FIFO_MAIN}" & + bash $PullSampleHashes $ProbandGenerator.Jhash "${FIFO_MAIN}" $MutantMinCov $MaxHashDepth > "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList & + exec 5>&- wait - fi ######################################################################################## if [ $(head "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR: No mutant hashes identified, either the files are exactly the same of something went wrong in previous step" - exit 100 + if [ -z $_arg_region ] + then + echo "ERROR: No mutant hashes pulled from fastqs. This is very unlikely for a whole genome run and quality of input files should be examined. Exiting with non-zero status..." + _region_exit_reason="no_mutant_hashes_wg" + exit 100 + else + # debug: where amy run exited + echo "WARNING: No unique hashes identified in region $_arg_region. Stopping run." + _region_exit_reason="no_unique_hashes" + exit 0 + fi fi ######################################################################################## if [ "$_arg_stop" = "hash" ]; then echo "-StH used, stopping run"; + _region_exit_reason="user_stop_after_hash" exit 1; fi ######################__RUFUS_FILTER__################################################## -echo "Filtering unique kMers..." +_region_exit_reason="filter_stage" +echo "Filtering unique reads containing unique kMers..." -if [ $_pairedEnd == "true" ] +if [ "$_pairedEnd" = "true" ] then if [ -e "$ProbandGenerator".Mutations.Mate1.fastq ] then @@ -989,22 +1342,21 @@ then else if [ -z $_arg_fastqA ] then - if [ -e "$ProbandGenerator".temp.mate1.fastq ]; then - rm "$ProbandGenerator".temp.mate1.fastq + # NOTE: this is the one usually run when starting with a bam file - extracts reads from PassThroughSamCheck.stranded and puts them into mate1 and 2 respectively, which go into filter + if [ -e "${FIFO_M1}" ]; then + rm "${FIFO_M1}" fi - if [ -e "$ProbandGenerator".temp.mate2.fastq ]; then - rm "$ProbandGenerator".temp.mate2.fastq - fi - if [ -e "$ProbandGenerator".temp ]; then - rm "$ProbandGenerator".temp - fi - #echo "running this one " - mkfifo "$ProbandGenerator".temp.mate1.fastq "$ProbandGenerator".temp.mate2.fastq - sleep 1 - bash "$ProbandGenerator" | "$RDIR"/bin/PassThroughSamCheck.stranded "$ProbandGenerator".filter.chr "$ProbandGenerator".temp > "$ProbandGenerator".temp & - $RUFUSfilterFASTQ "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList "$ProbandGenerator".temp.mate1.fastq "$ProbandGenerator".temp.mate2.fastq "$ProbandGenerator" "$K" $_filterMinQ $_arg_filterK "$(echo $Threads -2 | bc)" & - + if [ -e "${FIFO_M2}" ]; then + rm "${FIFO_M2}" + fi + + mkfifo "${FIFO_M1}" "${FIFO_M2}" + # bash "$ProbandGenerator" | "$RDIR"/bin/PassThroughSamCheck.stranded "$WORK_DIR/$ProbandGenerator".filter.chr "${FIFO_M1}" "${FIFO_M2}" & + # NOTE: collate|fastq validated == PassThroughSamCheck.stranded (pairs+RC orientation, job 16684004). collate temp prefix is on WORK_DIR (lustre) — large at genome scale; redirect to node-local if needed. + bash "$ProbandGenerator" | samtools collate -@ "$Threads" -u -O - "$WORK_DIR/$ProbandGenerator".collate.tmp | samtools fastq -@ "$Threads" -n -1 "${FIFO_M1}" -2 "${FIFO_M2}" -s /dev/null -0 /dev/null - & + $RUFUSfilterFASTQ "$WORK_DIR/$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList "${FIFO_M1}" "${FIFO_M2}" "$ProbandGenerator" "$K" $_filterMinQ $_arg_filterK "$(echo $Threads -2 | bc)" & wait + rm -f "$FIFO_M1" "$FIFO_M2" else echo "Running RUFUS.filter from paired FASTQ files" FileName=$(basename $_arg_fastqA) @@ -1012,39 +1364,55 @@ then if [[ $Extension == 'gz' ]] then echo "Compressed fastq files found" - $RUFUSfilterFASTQ "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList <(zcat $_arg_fastqA) <(zcat $_arg_fastqB) "$ProbandGenerator" $K $_filterMinQ $_arg_filterK "$(echo $Threads -2 | bc)" + $RUFUSfilterFASTQ "$WORK_DIR/$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList <(zcat $_arg_fastqA) <(zcat $_arg_fastqB) "$ProbandGenerator" $K $_filterMinQ $_arg_filterK "$(echo $Threads -2 | bc)" else echo "Uncompressed fastq files found" - $RUFUSfilterFASTQ "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList $_arg_fastqA $_arg_fastqB "$ProbandGenerator" $K $_filterMinQ $_arg_filterK "$(echo $Threads -2 | bc)" + $RUFUSfilterFASTQ "$WORK_DIR/$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList $_arg_fastqA $_arg_fastqB "$ProbandGenerator" $K $_filterMinQ $_arg_filterK "$(echo $Threads -2 | bc)" fi wait fi fi - #if [ $(wc -l "$ProbandGenerator".Mutations.Mate1.fastq | awk '{print $1}') -eq "0" ]; then if [ $(head "$ProbandGenerator".Mutations.Mate1.fastq | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR: No mutant fastq reads idenfied. Either the files are exactly the same of something went wrong in previous step" - exit 100 + if [ -z $_arg_region ] + then + echo "ERROR: No reads passed the filtering step in the entire genome. This is extremely unlikely and input files should be examined." + _region_exit_reason="no_reads_passed_filter_wg" + exit 100 + else + echo "No reads passed the filtering step in region $_arg_region. Stopping run." + _region_exit_reason="no_reads_passed_filter" + exit 0 + fi fi - + shortinsert="false" if [ -e "$ProbandGenerator".Mutations.fastq.bam ] then echo "skipping mapping mates" else + # Sort fastq mates + sortedMate1Fastq="$ProbandGenerator".sorted.Mutations.Mate1.fastq + sortedMate2Fastq="$ProbandGenerator".sorted.Mutations.Mate2.fastq + + cat "$ProbandGenerator".Mutations.Mate1.fastq | paste - - - - | sort -k1 -S 8G | tr "\t" "\n" > $sortedMate1Fastq + cat "$ProbandGenerator".Mutations.Mate2.fastq | paste - - - - | sort -k1 -S 8G | tr "\t" "\n" > $sortedMate2Fastq if [ $shortinsert = "false" ] then echo "skipping fastp fix" - $bwa mem -t $Threads $_arg_ref_bwa "$ProbandGenerator".Mutations.Mate1.fastq "$ProbandGenerator".Mutations.Mate2.fastq | $samblaster | samtools sort -T "$ProbandGenerator".Mutations.fastq -O bam - > "$ProbandGenerator".Mutations.fastq.bam + # NOTE: this is the one run because shortinsert is hard coded - why? + $bwa mem -t $Threads $_arg_ref_bwa $sortedMate1Fastq $sortedMate2Fastq | $samblaster | samtools sort -T "$ProbandGenerator".Mutations.fastq -O bam - > "$ProbandGenerator".Mutations.fastq.bam samtools index "$ProbandGenerator".Mutations.fastq.bam else - echo "using fastp fix" + echo "using fastp fix" #cat "$ProbandGenerator".Mutations.Mate1.fastq "$ProbandGenerator".Mutations.Mate2.fastq > "$ProbandGenerator".Mutations.fastq - #$bwa mem -t $Threads $_arg_ref_bwa <( cat "$ProbandGenerator".Mutations.Mate1.fastq "$ProbandGenerator".Mutations.Mate2.fastq) | samtools sort -T "$ProbandGenerator".Mutations.fastq -O bam - > "$ProbandGenerator".Mutations.fastq.bam - $fastp -i "$ProbandGenerator".Mutations.Mate1.fastq -I "$ProbandGenerator".Mutations.Mate2.fastq -m -o "$ProbandGenerator".Mutations.Mate1.fastq.fastp.fastq -O "$ProbandGenerator".Mutations.Mate2.fastq.fastp.fastq --merged_out "$ProbandGenerator".Mutations.Mate1.fastq.merged.fastq + #$bwa mem -t $Threads $_arg_ref_bwa <( cat "$ProbandGenerator".Mutations.Mate1.fastq "$ProbandGenerator".Mutations.Mate2.fastq) | samtools sort -T "$ProbandGenerator".Mutations.fastq -O bam - > "$ProbandGenerator".Mutations.fastq.bam + + $fastp -i $sortedMate1Fastq -I $sortedMate2Fastq -m -o "$ProbandGenerator".Mutations.Mate1.fastq.fastp.fastq -O "$ProbandGenerator".Mutations.Mate2.fastq.fastp.fastq --merged_out "$ProbandGenerator".Mutations.Mate1.fastq.merged.fastq $bwa mem -t $Threads $_arg_ref_bwa "$ProbandGenerator".Mutations.Mate1.fastq.fastp.fastq "$ProbandGenerator".Mutations.Mate2.fastq.fastp.fastq | $samblaster | samtools sort -T "$ProbandGenerator".Mutations.fastq -O bam - > "$ProbandGenerator".Mutations.fastq.pared.bam $bwa mem -t $Threads $_arg_ref_bwa "$ProbandGenerator".Mutations.Mate1.fastq.merged.fastq | samtools sort -T "$ProbandGenerator".Mutations.fastq -O bam - > "$ProbandGenerator".Mutations.fastq.merged.bam samtools merge "$ProbandGenerator".Mutations.fastq.bam "$ProbandGenerator".Mutations.fastq.merged.bam "$ProbandGenerator".Mutations.fastq.pared.bam + #$bwa mem -t $Threads $_arg_ref_bwa "$ProbandGenerator".Mutations.Mate1.fastq "$ProbandGenerator".Mutations.Mate2.fastq | $samblaster | samtools sort -T "$ProbandGenerator".Mutations.fastq -O bam - > "$ProbandGenerator".Mutations.fastq.bam samtools index "$ProbandGenerator".Mutations.fastq.merged.bam samtools index "$ProbandGenerator".Mutations.fastq.pared.bam @@ -1061,27 +1429,41 @@ else then #echo "running this one filer SE" - sleep 1 - if [ -e "$ProbandGenerator".temp ]; then - rm "$ProbandGenerator".temp + if [ -e "${FIFO_MAIN}" ]; then + rm "${FIFO_MAIN}" fi - mkfifo "$ProbandGenerator".temp - bash "$ProbandGenerator" | "$RDIR"/bin/PassThroughSamCheck.stranded.se "$ProbandGenerator".filter.chr "$ProbandGenerator".temp > "$ProbandGenerator".temp & - $RUFUSfilterFASTQse "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList "$ProbandGenerator".temp "$ProbandGenerator" "$K" $_filterMinQ $_arg_filterK "$(echo $Threads -2 | bc)" & + mkfifo "${FIFO_MAIN}" + # NB: do NOT `exec 6<>"$FIFO_MAIN"` here. Holding a read+write fd on the FIFO keeps a + # writer open, so RUFUS.Filter.single never sees EOF after samtools fastq finishes and + # hangs forever (the `wait` below then never returns). The backgrounded writer and reader + # rendezvous on the FIFO on their own. + # bash "$ProbandGenerator" | "$RDIR"/bin/PassThroughSamCheck.stranded.se "$WORK_DIR/$ProbandGenerator".filter.chr > "${FIFO_MAIN}" & + # NOTE: single-end analogue (UNTESTED for equivalence — validate before relying on it) + bash "$ProbandGenerator" | samtools fastq -@ "$Threads" - > "${FIFO_MAIN}" & + $RUFUSfilterFASTQse "$WORK_DIR/$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList "${FIFO_MAIN}" "$ProbandGenerator" "$K" $_filterMinQ $_arg_filterK "$(echo $Threads -2 | bc)" & wait + rm -f "$FIFO_MAIN" else echo "Running RUFUS.filter from single FASTQ files" echo "havent written this yet EXITing" - exit + _region_exit_reason="se_fastq_not_implemented" + exit 1 #########WRITE THIS########## wait fi fi - #if [ $(wc -l "$ProbandGenerator".Mutations.fastq | awk '{print $1}') -eq "0" ]; then if [ $(head "$ProbandGenerator".Mutations.fastq | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR: No mutant fastq reads idenfied. Either the files are exactly the same of something went wrong in previous step" - exit 100 + if [ -z $_arg_region ] + then + echo "ERROR: No mutant hashes pulled from fastqs. This is extremely unlikely for a whole genome run and quality of input files should be examined." + _region_exit_reason="no_mutant_fastq_reads_wg" + exit 100 + else + echo "WARNING: No mutant fastq reads identified in region $_arg_region. This usually means unique kmers came from reads that did not pass the sam check. Stopping RUFUS run." + _region_exit_reason="no_mutant_fastq_reads" + exit 0 + fi fi shortinsert="false" @@ -1089,8 +1471,8 @@ else then echo "skipping mapping mates" else - $bwa mem -t $Threads $_arg_ref_bwa "$ProbandGenerator".Mutations.fastq | $samblaster | samtools sort -T "$ProbandGenerator".Mutations.fastq -O bam - > "$ProbandGenerator".Mutations.fastq.bam - samtools index "$ProbandGenerator".Mutations.fastq.bam + $bwa mem -t $Threads $_arg_ref_bwa "$ProbandGenerator".Mutations.fastq | $samblaster | samtools sort -T "$ProbandGenerator".Mutations.fastq -O bam - > "$ProbandGenerator".Mutations.fastq.bam + samtools index "$ProbandGenerator".Mutations.fastq.bam fi @@ -1115,13 +1497,22 @@ fi if [ $( samtools view "${ProbandGenerator}".Mutations.fastq.bam | head | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR: BWA failed on "$ProbandGenerator".Mutations.fastq. Either the files are exactly the same of something went wrong in previous step" - exit 100 + if [ -z $_arg_region ] + then + echo "ERROR: All reads failed to align to the reference genome. This is extremely unlikely for a whole genome run and something likely went wrong." + _region_exit_reason="no_reads_aligned_wg" + exit 100 + else + echo "WARNING: No reads aligned to the reference for ${ProbandGenerator}.Mutations.fastq for the region $_arg_region. Stopping RUFUS run." + _region_exit_reason="no_reads_aligned" + exit 0 + fi fi ################################################################################# if [ "$_arg_stop" = "filter" ]; then echo "-StF used, stopping run"; + _region_exit_reason="user_stop_after_filter" exit 1; fi ###################__RUFUS_OVERLAP__############################################# @@ -1129,9 +1520,16 @@ if [ -e ${ProbandGenerator}.V2.overlap.hashcount.fastq.bam.FINAL.vcf.gz ] then echo "########### Skipping overlap step ###########" else + _region_exit_reason="overlap_stage" echo "########### Starting RUFUS overlap ###########" - echo " bash $RUFUSOverlap "$_arg_ref" "${ProbandGenerator}".Mutations.fastq 5 $ProbandGenerator "${ProbandGenerator}".k"$K"_c"$MutantMinCov".HashList "$K" "$Threads" "$_MaxAlleleSize" "${ProbandGenerator}".Jhash "$parentsString" "$_arg_ref_bwa" "$_arg_refhash"" - bash $RUFUSOverlap "$_arg_ref" "$ProbandGenerator".Mutations.fastq 5 $ProbandGenerator "${ProbandGenerator}".k"$K"_c"$MutantMinCov".HashList "$K" "$Threads" "$_MaxAlleleSize" "$_assemblySpeed" "${ProbandGenerator}".Jhash "$parentsString" "$_arg_ref_bwa" "$_arg_refhash" + + # Have to assign something here to maintain argument order + if [ -z "$_arg_refhash" ]; then + _arg_refhash="empty" + fi + + echo " bash $RUFUSOverlap $_arg_ref ${ProbandGenerator}.Mutations.fastq 5 $ProbandGenerator ${ProbandGenerator}.k${K}_c${MutantMinCov}.HashList $K $Threads $_MaxAlleleSize $_assemblySpeed $_arg_ref_bwa $rufus_invoc_file $_arg_refhash ${ProbandGenerator}.Jhash $parentsString $_arg_ParLowCovThreshold" + bash $RUFUSOverlap "$_arg_ref" "$ProbandGenerator".Mutations.fastq 5 $ProbandGenerator "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList "$K" "$Threads" "$_MaxAlleleSize" "$_assemblySpeed" "$_arg_ref_bwa" "$rufus_invoc_file" "$_arg_refhash" "$ProbandGenerator".Jhash "$parentsString" "$_arg_ParLowCovThreshold" #bash $RUFUSOverlap "$_arg_ref" "$ProbandGenerator".Mutations.fastq 3 $ProbandGenerator "$ProbandGenerator".k"$K"_c"$MutantMinCov".HashList "$K" "$Threads" "$_MaxAlleleSize" "$_assemblySpeed" "$ProbandGenerator".Jhash "$parentsString" "$_arg_ref_bwa" "$_arg_refhash" echo "Done with RUFUS overlap" fi @@ -1146,113 +1544,182 @@ fi #$RufAlu $_arg_subject $_arg_subject.generator.V2.overlap.hashcount.fastq $aluList $_arg_ref $fastaHackPath $jellyfishPath $(echo $ParentFileNames) ######################################################################## +_region_exit_reason="vcf_processing_stage" +intermed_vcf="${WORK_DIR}/${ProbandGenerator}.V2.overlap.hashcount.fastq.bam.vcf" + +if [[ -s "$intermed_vcf" ]]; then + count=$(bcftools view -H "$intermed_vcf" | wc -l) + if [ "$count" -eq 0 ]; then + echo "Intermediate vcf contains no variants, indicating no variants found for this region." >&2 + _region_exit_reason="no_interpret_passing_vars_e" + exit 0 + fi + # safe to proceed (file exists, non-empty, has variants) +else + echo "Intermediate vcf not present, indicating no variants found for this region." >&2 + _region_exit_reason="no_interpret_passing_vars_dne" + exit 0 +fi + +# Sanitize intermediate VCF: remove malformed records from RUFUS.Interpret output +# Keeps header lines as-is. For data lines, requires: +# - at least 8 tab-delimited fields (CHROM POS ID REF ALT QUAL FILTER INFO) +# - POS (col 2) is a positive integer +# - REF (col 4) is non-empty and contains only valid bases (ACGTN) +# - ALT (col 5) is non-empty, not just ".", and contains only valid VCF ALT characters +# - If INFO (col 8) contains END=, then END >= POS (prevents tabix "end < begin" error) +sanitized_vcf="${intermed_vcf}.sanitized.vcf" +awk -F'\t' ' +/^#/ { print; next } +{ + if (NF < 8) next + if ($2 !~ /^[0-9]+$/ || $2+0 < 1) next + if ($4 == "" || $4 == "." || $4 !~ /^[ACGTNacgtn]+$/) next + if ($5 == "" || $5 == ".") next + if ($5 !~ /^[ACGTNacgtn.,*<>\[\]0-9:]+$/) next + # Check END >= POS if END tag is present in INFO field + info = $8 + if (match(info, /END=[0-9]+/)) { + end_val = substr(info, RSTART+4, RLENGTH-4) + 0 + if (end_val < $2+0) next + } + print +} +' "$intermed_vcf" > "$sanitized_vcf" + +sanitized_count=$(grep -vc "^#" "$sanitized_vcf" || true) +original_count=$(grep -vc "^#" "$intermed_vcf" || true) +removed_count=$((original_count - sanitized_count)) +if [ "$removed_count" -gt 0 ]; then + echo "WARNING: Removed $removed_count malformed VCF record(s) from RUFUS.Interpret output ($sanitized_count of $original_count records kept)." >&2 +fi +if [ "$sanitized_count" -eq 0 ]; then + echo "No valid VCF records remain after sanitization for this region." >&2 + _region_exit_reason="no_records_after_sanitization" + exit 0 +fi +mv "$sanitized_vcf" "$intermed_vcf" -echo "cleaning up VCF" +# Trim off generator postfix +DEDUPED_VCF="$WORK_DIR/deduped.${formatted_region}.vcf" -PREFINAL_VCF="${ProbandGenerator}.V2.overlap.hashcount.fastq.bam.coinherited.vcf" +# TODO: do I really need this? can I just sort? +grep "^#" "$intermed_vcf" > $WORK_DIR/Intermediates/$ProbandGenerator.V2.overlap.hashcount.fastq.bam.sorted.vcf +grep -v "^#" "$intermed_vcf" | sort -k1,1V -k2,2n >> $WORK_DIR/Intermediates/$ProbandGenerator.V2.overlap.hashcount.fastq.bam.sorted.vcf -grep ^# ${ProbandGenerator}.V2.overlap.hashcount.fastq.bam.vcf> ./Intermediates/${ProbandGenerator}.V2.overlap.hashcount.fastq.bam.sorted.vcf -grep -v ^# $ProbandGenerator.V2.overlap.hashcount.fastq.bam.vcf | sort -k1,1V -k2,2n >> ./Intermediates/${ProbandGenerator}.V2.overlap.hashcount.fastq.bam.sorted.vcf echo "arg_mosaic = $_arg_mosaic" -if [ "$_arg_mosaic" = "TRUE" ] +if [ "$_arg_mosaic" == "TRUE" ] then - echo "including mosaic"; - bash $RDIR/scripts/VilterAutosomeOnly ./Intermediates/${ProbandGenerator}.V2.overlap.hashcount.fastq.bam.sorted.vcf | perl $RDIR/scripts/ColapsDuplicateCalls.stream.pl > ./$PREFINAL_VCF + echo "including mosaic" + bash $RDIR/scripts/VilterAutosomeOnly $WORK_DIR/Intermediates/$ProbandGenerator.V2.overlap.hashcount.fastq.bam.sorted.vcf | perl $RDIR/scripts/ColapsDuplicateCalls.stream.pl > $DEDUPED_VCF else - echo "excluding mosaic"; - bash $RDIR/scripts/VilterAutosomeOnly.withoutMosaic ./Intermediates/${ProbandGenerator}.V2.overlap.hashcount.fastq.bam.sorted.vcf | perl $RDIR/scripts/ColapsDuplicateCalls.stream.pl > ./$PREFINAL_VCF + echo "excluding mosaic" + bash $RDIR/scripts/VilterAutosomeOnly.withoutMosaic $WORK_DIR/Intermediates/$ProbandGenerator.V2.overlap.hashcount.fastq.bam.sorted.vcf | perl $RDIR/scripts/ColapsDuplicateCalls.stream.pl > $DEDUPED_VCF fi -# Rename final vcf and zip/index -FINAL_VCF="temp.RUFUS.Final.${ProbandFileName}${region_postfix}.vcf" -mv $PREFINAL_VCF $FINAL_VCF -bgzip -f ./$FINAL_VCF -tabix ./$FINAL_VCF.gz - -#echo "Removing inherited variant calls that co-occur on the same reads as a somatic..." -#bash $RemoveCoInheritedVars $_arg_ref ./$PREFINAL_VCF $ProbandGenerator $arg_control_string -echo "Cleaning up intermediary files..." -if [ "$_arg_dev_file_output" = "FALSE" ]; then - SUPP_DIR="rufus_supplementals" - mkdir -p $SUPP_DIR - - mv "Intermediates/${ProbandGenerator}.V2.overlap.hashcount.fastq.bam.sorted.vcf" "$SUPP_DIR/temp.RUFUS.Prefiltered.${ProbandFileName}${region_postfix}.vcf" - bgzip "$SUPP_DIR/temp.RUFUS.Prefiltered.${ProbandFileName}${region_postfix}.vcf" - bcftools index "$SUPP_DIR/temp.RUFUS.Prefiltered.${ProbandFileName}${region_postfix}.vcf.gz" - - rm Intermediates/*${region_postfix}* - rm TempOverlap/*${region_postfix}* - rm "${ProbandGenerator}.mer_counts_merged.jf" - control_files=( - "generator" - "generator.Jelly.chr" - "generator.Jhash" - "generator.Jhash.histo" - "generator.Jhash.histo.7.7.dist" - "generator.Jhash.histo.7.7.model" - "generator.Jhash.histo.7.7.out" - "generator.Jhash.histo.7.7.prob" - ) - - # remove control files - for control in "${_arg_controls[@]}"; - do - ctrl_prefix=$(basename "$control") - for postfix in "${control_files[@]}" - do - if [ -e "${ctrl_prefix}${region_postfix}.${postfix}" ]; then - rm ${ctrl_prefix}${region_postfix}.${postfix} - fi - done - done - - # remove subject files - subject_files=( - "generator" - "generator.V2.overlap.fastqd" - "generator.Jelly.chr" - "generator.V2.overlap.hashcount.fastq" - "generator.Jhash" - "generator.Jhash.histo" - "generator.Jhash.histo.7.7.dist" - "generator.Jhash.histo.7.7.model" - "generator.Jhash.histo.7.7.out" - "generator.Jhash.histo.7.7.prob" - "generator.V2.overlap.hashcount.fastq.bam.vcf.bed" - "generator.Mutations.Mate1.fastq" - "generator.filter.chr" - "generator.Mutations.Mate2.fastq" - "generator.temp" - "generator.temp.mate1.fastq" - "generator.V2.overlap.fastq" - "generator.temp.mate2.fastq" - ) - for postfix in "${subject_files[@]}"; - do - if [ -e "${ProbandFileName}${region_postfix}.${postfix}" ]; then - rm ${ProbandFileName}${region_postfix}.${postfix} - fi - done +bgzip -f "$DEDUPED_VCF" +# Index with tabix, iteratively removing records that cause indexing failures +# This catches any malformed records that slip past the awk sanitizer +tabix_max_retries=50 +tabix_attempt=0 +while true; do + tabix_stderr=$(tabix -C "$DEDUPED_VCF.gz" 2>&1) && break + + tabix_attempt=$((tabix_attempt + 1)) + if [ "$tabix_attempt" -ge "$tabix_max_retries" ]; then + echo "ERROR: tabix failed after removing $tabix_attempt malformed record(s). Giving up." >&2 + echo "Last tabix error: $tabix_stderr" >&2 + _region_exit_reason="tabix_max_retries" + exit 100 + fi - supplemental_files=( - "generator.V2.overlap.hashcount.fastq.bam" - "generator.V2.overlap.hashcount.fastq.bam.bai" - "generator.V2.overlap.hashcount.fastq.bam.vcf" - "generator.k${K}_c${MutantMinCov}.HashList" - "generator.Mutations.fastq.bam" - "generator.Mutations.fastq.bam.bai" - ) - SUPP_DIR="rufus_supplementals/" - mkdir -p $SUPP_DIR - for postfix in "${supplemental_files[@]}"; - do - if [ -e "${ProbandFileName}${region_postfix}.${postfix}" ]; then - mv ${ProbandFileName}${region_postfix}.${postfix} $SUPP_DIR - fi - done + # Parse the 1-based sequence number from: "Invalid record on sequence #N" + bad_seq=$(echo "$tabix_stderr" | grep -oP 'sequence #\K[0-9]+' | head -1) + if [ -z "$bad_seq" ]; then + echo "ERROR: tabix failed with unexpected error: $tabix_stderr" >&2 + _region_exit_reason="tabix_unexpected_error" + exit 100 + fi + + echo "WARNING: tabix indexing failed on data record #${bad_seq}, removing it and retrying (attempt $tabix_attempt)." >&2 + echo " tabix error: $tabix_stderr" >&2 + + # Decompress, remove the offending data line, recompress + tmp_fix_vcf="${DEDUPED_VCF}.tabixfix.vcf" + zcat "$DEDUPED_VCF.gz" | awk -v bad="$bad_seq" ' + /^#/ { print; next } + { data_line++; if (data_line != bad) print } + ' > "$tmp_fix_vcf" + bgzip -f "$tmp_fix_vcf" + mv "$tmp_fix_vcf.gz" "$DEDUPED_VCF.gz" +done + +# Update reference alleles +REF_VCF="$WORK_DIR/ref.${formatted_region}.vcf" +bcftools +fill-from-fasta "$DEDUPED_VCF.gz" -- -c REF -f "$_arg_ref" > "$REF_VCF" + +# Get rid of break-ends +TYPE_VCF="$WORK_DIR/snv_indel.${formatted_region}.vcf" +bcftools view -e "TYPE='bnd'" "$REF_VCF" > "$TYPE_VCF" + +# Check for empty gt field +GX_VCF="$WORK_DIR/gx.${formatted_region}.vcf" +bash $RDIR/post_process/remove_no_genotype.sh "$TYPE_VCF" > "$GX_VCF" +bgzip -f "$GX_VCF" +bcftools index -f "$GX_VCF.gz" + +# Trim calls to region. In whole-genome mode _arg_region is empty; `bcftools view -r ""` segfaults, +# and there is nothing to trim to, so pass the calls through unchanged. +TRIMMED_VCF="$WORK_DIR/trimed.${formatted_region}.vcf.gz" +if [ -n "$_arg_region" ]; then + bcftools view -r "$_arg_region" "$GX_VCF.gz" -Oz -o "$TRIMMED_VCF" else - echo "not cleaning up files" + cp "$GX_VCF.gz" "$TRIMMED_VCF" fi +bcftools index "$TRIMMED_VCF" + +NO_CO_VCF="$WORK_DIR/no_coinheriteds.vcf.gz" +# remove_coinheriteds pileups each control at the variant sites, so it needs an alignable BAM/CRAM. +# A control given as a pre-built hash (a .generator stub) or fastq has no BAM to pile up (bwa would +# align an empty file -> mpileup fails on the empty bam). Collect only the BAM/CRAM controls and run +# the filter over those; skip entirely if none -- the HashList subtraction has already removed those +# controls' k-mers, so the co-inherited pileup is a secondary check with nothing to pile up. +_bamcram_controls=() +for _ctrl in "${Parents[@]}"; do + case "$_ctrl" in + *.bam|*.cram) _bamcram_controls+=("$_ctrl") ;; + esac +done +if [ ${#_bamcram_controls[@]} -ne "0" ]; then + bash ${RDIR}/post_process/remove_coinheriteds.sh -t $_arg_threads -r "$formatted_region" -f "$_arg_ref" -i "$TRIMMED_VCF" -o "$NO_CO_VCF" -w "1000" -c "$(IFS=','; echo "${_bamcram_controls[*]}")" +else + [ ${#_arg_controls[@]} -ne "0" ] && echo "Skipping remove_coinheriteds: no BAM/CRAM control to pile up (controls are hash/generator/fastq); HashList subtraction already handled them." >&2 + mv "$TRIMMED_VCF" "$NO_CO_VCF" +fi + +# Left align & atomize +ATOM_VCF="$WORK_DIR/atomed.${formatted_region}.vcf" +bcftools norm -m- -f "$_arg_ref" "$NO_CO_VCF" -Ou | bcftools norm -a -Oz -o "$ATOM_VCF" + +# Add HD_AF field +ATOM_VCF_BASENAME=$(basename "$ATOM_VCF") +HDAF_VCF="$WORK_DIR/hd_af.$ATOM_VCF_BASENAME" +SUBJECT_SAMPLE_NAME=$(bcftools view -h "$ATOM_VCF" | tail -n 1 | awk -F'\t' '{ print $10 }') +bash ${RDIR}/post_process/add_hd_med.add_hd_af.sh "$ATOM_VCF" "$SUBJECT_SAMPLE_NAME" "$formatted_region" + +# Sort +SORTED_VCF="$WORK_DIR/sorted.${formatted_region}.vcf.gz" +bcftools sort "$HDAF_VCF" -Oz -o "$SORTED_VCF" + +# Rename final vcf and zip/index +PREFINAL_VCF="$WORK_DIR/temp.RUFUS.Final.${ProbandFileName}${region_postfix}.vcf.gz" +mv "$SORTED_VCF" "$PREFINAL_VCF" +bcftools index "$PREFINAL_VCF" + +FINAL_BASENAME="$(basename "$PREFINAL_VCF")" + +cp "$PREFINAL_VCF" "$WORK_ROOT/$FINAL_BASENAME" +cp "$PREFINAL_VCF.csi" "$WORK_ROOT/$FINAL_BASENAME.csi" end_time=$(date +"%s") time_delta=$(( $end_time - $start_time )) @@ -1260,6 +1727,6 @@ hours=$(( time_delta / 3600 )) minutes=$(( (time_delta % 3600) / 60 )) seconds=$(( time_delta % 60 )) printf "RUFUS call stage completed in: %02d:%02d:%02d\n" $hours $minutes $seconds - +_region_exit_reason="success" exit 0 # ] <-- needed because of Argbash diff --git a/scripts/CheckForDuplicateCallsBed.pl b/scripts/CheckForDuplicateCallsBed.pl deleted file mode 100755 index 8ec28742..00000000 --- a/scripts/CheckForDuplicateCallsBed.pl +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/perl - -use strict; - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -open (Fastq , $ARGV[0]) || die "ERROR could not open sam file"; - -my $l1 = ""; -my $lastLine = ""; -my @temp; -my $chr = "nope"; -my $pos = "nope"; -my $ref = "nope"; -my $alt = "nope"; -my $sample = "nope"; -my $counter = 0; - -while ($l1 = ) -{ - - @temp = split(/\t/, $l1); - $counter = $counter+1; - chomp ($l1); - if ($temp[0] == $chr && $temp[1] == $pos && $temp[2] == $ref && $temp[3] == $alt) - { - if ($sample != $temp[6]) - { - print "+++$l1\n"; - } - } - else - { - print "$l1\tUNIUQE\n"; - $chr = $temp[0]; - $pos = $temp[1]; - $ref = $temp[2]; - $alt = $temp[3]; - $sample = $temp[6]; - } - $lastLine = $l1; - - -} - diff --git a/scripts/CheckJellyHashList.sh b/scripts/CheckJellyHashList.sh index c314a80c..887462c3 100755 --- a/scripts/CheckJellyHashList.sh +++ b/scripts/CheckJellyHashList.sh @@ -1,13 +1,19 @@ -#!/bin/sh +#!/bin/bash +# Must use bash for now due to substitution -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -RDIR=$CDIR/../ +# ENV override +: "${RUFUS_ROOT:=/opt/RUFUS}" -JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish -Jhash=$1 -HashList=$2 -MinCov=$3 -MaxCov=$4 +JellyFish="$RUFUS_ROOT/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish" +Jhash="$1" # File to count within +HashList="$2" # List of kmers +MinCov="$3" +MaxCov="$4" -timeout 1h $JellyFish query -s <(cat $HashList | awk '{print ">"$1"\n"$1}') $Jhash | awk -v var=$MinCov ' $2 >= var ' | awk -v var=$MaxCov ' $2 <= var ' +# This searches the HashList for specific kmers listed in the Jhash argument, and counts them +tmp=$(mktemp) +cat "$HashList" > "$tmp" +timeout 1h "$JellyFish" query -s <(awk '{print ">"$1"\n"$1}' "$tmp") "$Jhash" | awk -v var="$MinCov" ' $2 >= var ' | awk -v var="$MaxCov" ' $2 <= var ' +rm -f "$tmp" +# timeout 1h "$JellyFish" query -s <(cat "$HashList" | awk '{print ">"$1"\n"$1}') "$Jhash" | awk -v var="$MinCov" ' $2 >= var ' | awk -v var="$MaxCov" ' $2 <= var ' #cat $HashList | awk '{print $1}' | $JellyFish query -i $Jhash | awk -v var=$MinCov ' $2 >= var ' | awk -v var=$MaxCov ' $2 <= var ' diff --git a/scripts/Child.generator b/scripts/Child.generator deleted file mode 100644 index 3634e004..00000000 --- a/scripts/Child.generator +++ /dev/null @@ -1 +0,0 @@ -samtools view -F 3328 /uufs/chpc.utah.edu/common/home/u0991464/RUFUS.test.set/Family1.child.bam diff --git a/scripts/ColapsDuplicateCalls.pl b/scripts/ColapsDuplicateCalls.pl deleted file mode 100755 index 854ae4a0..00000000 --- a/scripts/ColapsDuplicateCalls.pl +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/perl - -use strict; - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -open (Fastq , $ARGV[0]) || die "ERROR could not open vcf file"; - -my $l1 = ""; -my $lastLine = ""; -my @temp; -my $chr = "nope"; -my $pos = "nope"; -my $ref = "nope"; -my $alt = "nope"; -my $sample = "nope"; -my $counter = 0; - -while ($l1 = ) -{ - my $FC = substr($l1 , 0, 1); - #print "line = $l1\n"; - if ($FC eq "#") - { - # print "header\n"; - print "$l1"; - } - else - { - - @temp = split(/\t/, $l1); - $counter = $counter+1; - chomp ($l1); - # print " if ($temp[0] == $chr && $temp[1] == $pos && $temp[3] == $ref && $temp[4] == $alt)\n"; - if ($temp[0] == $chr && $temp[1] == $pos && $temp[3] == $ref && $temp[4] == $alt) - { - # print "$l1\n+++$lastLine\n"; - } - else - { - print "$l1\n"; #\tUNIUQE\n"; - $chr = $temp[0]; - $pos = $temp[1]; - $ref = $temp[3]; - $alt = $temp[4]; - } - $lastLine = $l1; - } - -} - diff --git a/scripts/ConvertGRAPHITEVCFtoRformat.pl b/scripts/ConvertGRAPHITEVCFtoRformat.pl deleted file mode 100644 index 9a64ed70..00000000 --- a/scripts/ConvertGRAPHITEVCFtoRformat.pl +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/perl - - -use strict; - - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -my $l; -my @temp; -my @samples; -my $lines = 0; -#my @fields; -my @fields = ("FR","RR","FA","RA"); -while ($l = ) -{ - chomp($l); - @temp = split("\t", $l); - if ($temp[0] =~ /^#/) - { - if ($temp[0] eq "#CHROM") - { - for (my $i = 9; $i < @temp; $i++) - { - push @samples, $temp[$i]; - } - } - } - else - { - if ($lines ==0) - { - #@fields = split(":", $temp[8]); - print "CHROM POS ID REF ALT QUAL FILTER INFO FORMAT"; - for (my $i = 0; $i < @samples; $i++) - { - for (my $j = 0; $j < @fields; $j++) - { - print " $samples[$i]-$fields[$j]"; - } - } - print "\n"; - $lines = 1; - } - for (my $i = 0; $i <= 7; $i++) - { - print "$temp[$i] " - } - print "$temp[8]"; - for (my $i = 9; $i < @temp; $i++) - { - #@fields = split(":", $temp[$i]); - my @full=split(":", $temp[$i]); - @fields = split(",", @full[1]); - for (my $j = 0; $j < @fields; $j++) - { - print " $fields[$j]"; - } - } - print "\n"; - } -} - diff --git a/scripts/ConvertVCFtoRformat.pl b/scripts/ConvertVCFtoRformat.pl deleted file mode 100644 index 3efb2e2f..00000000 --- a/scripts/ConvertVCFtoRformat.pl +++ /dev/null @@ -1,242 +0,0 @@ -#!/usr/bin/perl - - -use strict; - - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -my $l; -my @temp; -my @samples; -my $lines = 0; -my @fields; -my %SVids; -while ($l = ) -{ - chomp($l); - @temp = split("\t", $l); - if ($temp[0] =~ /^#/) - { - if ($temp[0] eq "#CHROM") - { - for (my $i = 9; $i < @temp; $i++) - { - push @samples, $temp[$i]; - } - } - } - else - { - if ($lines ==0) - { - @fields = split(":", $temp[8]); - print "CHROM POS ID REF ALT QUAL FILTER INFO SIZE TYPE COMPLEX FORMAT"; - for (my $i = 0; $i < @samples; $i++) - { - for (my $j = 0; $j < @fields; $j++) - { - print " $samples[$i]-$fields[$j]"; - } - } - print "\n"; - $lines = 1; - } - - - for (my $i = 0; $i <= 7; $i++) - { - print "$temp[$i] " - } - #####size stuff goes here ######## - my $size = 0; - my $type = "none"; - my $complex = "no" ; - if ( index($temp[4], "") != -1) - { - my $pull1 = substr($temp[7], index($temp[7], "SVLEN=") +6 ); - $size = substr($pull1, 0, index($pull1, ";")); - $type = "del"; - if (length $temp[4] > 5) - { - $complex = "yes"; - } - - } - elsif ( index($temp[4], "") != -1) - { - my $pull1 = substr($temp[7], index($temp[7], "SVLEN=") +6 ); - $size = substr($pull1, 0, index($pull1, ";")); - $type = "INS"; - if (length $temp[4] > 5) - { - $complex = "yes"; - } - } - elsif ( index($temp[4], "") != -1) - { - my $pull1 = substr($temp[7], index($temp[7], "SVLEN=") +6 ); - $size = substr($pull1, 0, index($pull1, ";")); - $type = "dup"; - if (length $temp[4] > 5) - { - $complex = "yes"; - } - } - elsif ( index($temp[4], "") != -1) - { - my $pull1 = substr($temp[7], index($temp[7], "END=") +4 ); - $size = substr($pull1, 0, index($pull1, ";")); - $size = $size - $temp[1]; - $type = "INV"; - my $des = substr($temp[2], 0, index($temp[2], "-")); - if (length $temp[4] > 5 || index($des, "Y") != -1 || index($des, "D") != -1 || index($des, "I") != -1 || index($des, "bnd") != -1) - { - $complex = "yes"; - } - } - elsif ( index($temp[4], "") !=-1) - { - $size = 3000000001; - $type = "MOB"; - $complex = "no"; - } - elsif ( index($temp[2], "bnd_") != -1 ) - { - - my $pull1 = substr($temp[7], index($temp[7], "SVID=") +5 ); - #my $svid = substr($pull1, 0, index($pull1, ";")); - my $svid = substr($pull1, 0, 1); - ####fix cuase I forgot the ; in some bnd svid fields - - if ( exists $SVids{$svid} ) - { - $size ="dup"; - } - elsif (index($temp[2], "OrphanBND") > -1) - { - $size = "orphan-$temp[2]"; - } - else - { - $size = 3000000002; - $SVids{$svid} = 1; - } - if (index($temp[2], "_bnd)_") != -1) - { - $complex = "yes"; - } - $type = "trans"; - - } - else - { - if ( length($temp[3]) == 1 && length($temp[4]) == 1) - { - $size = 0; - $type = "snv"; - $complex = "no"; - } - elsif(length($temp[3]) == 1) - { -#ins stuff goes here - $size = length($temp[4])-1; - my $des = substr($temp[2], 0, index($temp[2], "-")); - if (index($des, "Y") != -1 ) - { - $type = "dup"; - } - elsif (index($des, "I") != -1 ) - { - $type = "ins"; - } - else - { - $type = "ERRORns"; - } - - $complex = "no"; - - } - elsif(length($temp[4]) == 1) - { - $size = length($temp[3])-1; - $size = $size *-1; - my $des = substr($temp[2], 0, index($temp[2], "-")); - if (index($des, "D") != -1) - { - $type = "del"; - } - else - { - $type = "ERRORdel"; - } - $complex = "no"; -#del stuff goes here - } - elsif(length($temp[4]) ==length($temp[3])) - { - $size = length($temp[4])-1; - my $des = substr($temp[2], 0, index($temp[2], "-")); - if (index($des, "X") != -1 && index($des, "D") == -1 && index($des, "I") == -1 && index($des, "Y") == -1) - { - $size = 0; - $type = "multisnp"; - $complex = "no"; - } - else - { - $size = length($3); - $type = "complex"; - $complex = "yes"; - } - - } - else - { - -###make this beter, should cehck for del dup ins tandem - $size = length($temp[3]); - $type = "multi"; - $complex = "yes"; - if (length($4) > $size) - { - $type = "multi"; - $size = -1*length($4); - } - } - - } - print "$size $type $complex "; - print "$temp[8]"; - for (my $i = 9; $i < @temp; $i++) - { - @fields = split(":", $temp[$i]); - for (my $j = 0; $j < @fields; $j++) - { - if ($fields[$j] eq "./.") - { - print " 0/0"; - } - elsif($fields[$j] eq ".") - { - print " 0"; - } - else - { - print " $fields[$j]"; - } - } - } - print "\n"; - } -} - diff --git a/scripts/FastqToSam.pl b/scripts/FastqToSam.pl index fd425bd4..d358c194 100755 --- a/scripts/FastqToSam.pl +++ b/scripts/FastqToSam.pl @@ -1,41 +1,33 @@ -#!/usr/bin/perl - - -use strict; - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -open (Fastq , $ARGV[0]) || die "ERROR could not open sam file"; - -my $l1 = ""; -my $l2 = ""; -my $l3 = ""; -my $l4 = ""; -my @temp; - -my $counter = 0; -while ($l1 = ) -{ - - $counter = $counter+1; - $l2 = ; - $l3 = ; - $l4 = ; - chomp $l1; - chomp $l2; - chomp $l4; - #my $name = substr($l1, 1); - my @t = split ' ', $l1; - $t[0] = substr $t[0], 1; - print "$t[0] 0 * 0 * * * 0 0 $l2 $l4 \n"; -} -#Call should be GFFfile, FastaReff, SNPFilePath - +#!/usr/bin/perl +# Convert a FASTQ stream to unmapped SAM records on stdout, for RUFUS's whole-genome FASTQ input path. +# Usage: FastqToSam.pl [header] +# +# Used ONLY to feed k-mer COUNTING: the RUFUS generator pipes this through `samtools fastq` into +# jellyfish, which just needs the sequences — read pairing is irrelevant here, so every record is +# emitted unmapped (flag 4, MAPQ 0). Paired filtering is done separately from the raw FASTQs via the +# -q1/-q2 path; single-end uses RUFUS.Filter.single. The previous MAPQ='*' + trailing tab made samtools +# reject the stream. The generator emits ONE @HD header for the whole stream (samtools rejects a header +# mid-stream), so only the first FastqToSam.pl call in a generator is passed 'header'. +use strict; +use warnings; + +my $emit_header = (defined $ARGV[1] && $ARGV[1] eq 'header'); + +open(my $Fastq, '<', $ARGV[0]) || die "ERROR could not open fastq file $ARGV[0]"; + +print "\@HD\tVN:1.6\tSO:unsorted\n" if $emit_header; + +while (my $l1 = <$Fastq>) { + my $l2 = <$Fastq>; # sequence + my $l3 = <$Fastq>; # '+' + my $l4 = <$Fastq>; # quality + last unless defined $l4; + chomp $l1; + chomp $l2; + chomp $l4; + my @t = split ' ', $l1; + my $name = substr($t[0], 1); # strip leading '@' + # QNAME FLAG RNAME POS MAPQ CIGAR RNEXT PNEXT TLEN SEQ QUAL (unmapped: flag 4, MAPQ 0) + print "$name\t4\t*\t0\t0\t*\t*\t0\t0\t$l2\t$l4\n"; +} +close($Fastq); diff --git a/scripts/Father.generator b/scripts/Father.generator deleted file mode 100644 index ad862ee7..00000000 --- a/scripts/Father.generator +++ /dev/null @@ -1,2 +0,0 @@ -samtools view -F 3328 /uufs/chpc.utah.edu/common/home/u0991464/RUFUS.test.set/Family1.father.bam - diff --git a/scripts/GenerateProbNotError b/scripts/GenerateProbNotError deleted file mode 100755 index 8b4079dc..00000000 Binary files a/scripts/GenerateProbNotError and /dev/null differ diff --git a/scripts/Genotype.sh b/scripts/Genotype.sh index 8f69da92..2b0a98e7 100755 --- a/scripts/Genotype.sh +++ b/scripts/Genotype.sh @@ -31,29 +31,26 @@ echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" mkdir ./TempOverlap/ echo "Overlaping $File" +# TODO: this needs to go away!!! RDIR=/scratch/ucgd/lustre/work/u0991464/Projects/CEPH.new/RUFUS -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -#gkno=$RDIR/bin/gkno_launcher/gkno -bwa=$RDIR/bin/bwa/bwa -samtools=$RDIR/bin/samtools-1.6/samtools -RUFUSinterpret=$RDIR/bin/RUFUS.interpret.onlytwoParents +OverlapHash=$RDIR/bin/Overlap # TODO: should be in path +OverlapRebion2=$RDIR/bin/OverlapRegion # TODO: should be in path +ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD # TODO: should be in path +ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ # TODO: should be in path +AnnotateOverlap=$RDIR/bin/AnnotateOverlap # TODO: should be in PATH +bwa=$RDIR/bin/bwa/bwa # TODO: install at container level +RUFUSinterpret=$RDIR/bin/RUFUS.interpret.onlytwoParents # TODO: should be in PATH CheckHash=$RDIR/scripts/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam +OverlapSam=$RDIR/bin/OverlapSam # TODO: should be in PATH JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish - - ############################################################################################################# if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq ] then echo "skipping pull reference sequecnes" else - ~/bin/bedtools2/bin/fastaFromBed -bed <( ~/bin/bedtools2/bin//bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam) -fi $humanRef -fo Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq + fastaFromBed -bed <( bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam) -fi $humanRef -fo Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq fi if [ -s ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab ] diff --git a/scripts/HistoBaseQualities.pl b/scripts/HistoBaseQualities.pl deleted file mode 100755 index 9a9277b4..00000000 --- a/scripts/HistoBaseQualities.pl +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/perl - -use strict; -my $line; -while ($line = <>) -{ - my @fields = split(" ", $line); - my @char = split("", $fields[10]); - my $b =0; - for ( $b = 0; $b < scalar @char; $b++) - { - my $ord = ord($char[$b])-33; - print "$ord\n"; - } -} - - diff --git a/scripts/HumanDedup.grenrator.tenplate b/scripts/HumanDedup.grenrator.tenplate deleted file mode 100644 index 8d47a058..00000000 --- a/scripts/HumanDedup.grenrator.tenplate +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -RDIR=$CDIR/.. -BAMTOOLS=$RDIR/src/externals/gkno_launcher/tools/bamtools/bin/bamtools -$BAMTOOLS filter -in $1 -isDuplicate false | $BAMTOOLS convert -format fastq diff --git a/scripts/MobToDist.pl b/scripts/MobToDist.pl deleted file mode 100755 index 5480332d..00000000 --- a/scripts/MobToDist.pl +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - -use strict; - -open (Fastq , $ARGV[0]) || die "ERROR could not open sam file"; - -my $l; -$l = ; -print "$l"; -$l = ; -print "$l"; -$l = ; -print "$l"; -$l = ; -print "$l"; -my @fa; -$l = ; -print "$l"; -chomp($l); -@fa = split(" ", $l); - - -my @counts; -my $lines = 0; -while ($l = ) -{ - $lines++; - chomp($l); - my @a = split(" ", $l); - push @counts, @a; - -} -my $total; -for (my $i = 1; $i < $lines; $i++) -{ - print " i = $i \n"; - print " adding $i $counts[3][3]"; - #$total += $counts[$i][1]; -} -print "total = $total"; diff --git a/scripts/Mother.generator b/scripts/Mother.generator deleted file mode 100644 index de0f9c41..00000000 --- a/scripts/Mother.generator +++ /dev/null @@ -1 +0,0 @@ -samtools view -F 3328 /uufs/chpc.utah.edu/common/home/u0991464/RUFUS.test.set/Family1.mother.bam diff --git a/scripts/Overlap.pacbio.sh b/scripts/Overlap.pacbio.sh deleted file mode 100755 index eb73ee1c..00000000 --- a/scripts/Overlap.pacbio.sh +++ /dev/null @@ -1,256 +0,0 @@ -#!/bin/bash - -set -e - -humanRef=$1 -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -MaxAlleleSize=$8 -speed=$9 - -SampleJhash=${10} -ParentsJhash=${11} - -humanRefBwa=${12} -refHash=${13} -MaxCov=100000 -echo " you gave -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -" - -echo "final coveage is $FinalCoverage" - - -echo "RUNNING THIS ONE" -echo "@@@@@@@@@@@@@__IN_OVERLAP__@@@@@@@@@@@@@@@" -echo "human ref in Overlap is $humanRef" -echo "bwa human ref in Overlap is $humanRefBwa" -echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -if [ ! -d "./TempOverlap/" ] -then - mkdir ./TempOverlap/ -else - echo "TempOverlap already present" -fi -if [ ! -d "./Intermediates/" ] -then - mkdir ./Intermediates/ -else - echo "Intermediates already present" -fi -echo "Overlaping $File" - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -RDIR=$CDIR/../ - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa -RUFUSinterpret=$RDIR/bin/RUFUS.interpret.pb -CheckHash=$RDIR/scripts/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish -MOBList=$RDIR/resources/primate_non-LTR_Retrotransposon.fasta - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - - -if [ -s asm.contigs.fasta ] -then - echo "skipping pac bio assembly " -else - /usr/bin/time -v canu -p asm genomeSize=3g useGrid=false batMemory=100 stopOnLowCoverage=0 minInputCoverage=0 -pacbio-hifi $File > canu.out 2>&1 -fi - -if [ -s $NameStub.overlap.hashcount.fastq ] -then - echo "skipping final overlap work" -else - - - echo "$AnnotateOverlap $HashList asm.contigs.fasta TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList <(perl $RDIR/scripts/multiLineFastaToSingleLineFastq.pl asm.contigs.fasta) TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - - -if [ $( head -n 10 ./$NameStub.overlap.hashcount.fastq | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./$NameStub.overlap.hashcount.fastq" - exit 100 -fi - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else -# $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 2,2 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - #$bwa mem -t $Threads -Y -E 0,0 -O 6,6 -L 2,2 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - minimap2 -Y -a /scratch/ucgd/lustre/work/u0991464/reference/38/GRCh38_full_analysis_set_plus_decoy_hla.fa.mmi ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - samtools index ./$NameStub.overlap.hashcount.fastq.bam -fi - -if [ $( samtools view ./$NameStub.overlap.hashcount.fastq.bam | head -n 10 | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR: BWA failed on ./$NameStub.overlap.hashcount.fastq.bam . Either the files are exactly the same of something went wrong in previous step" - exit 100 -fi - -echo "string hash lookup" -############################################################################################################# -#echo "staring MOB check" -#if [ -s ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam ] -#then -# echo "skipping MOB alignemnt check " -#else -# $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $MOBList ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O sam - > ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -#fi -# -# -#echo "starting reference pull " -#if [ -e ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq ] -#then -# echo "skipping pull reference sequecnes" -#else -# -# $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/fastaFromBed -bed <( $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam | awk '{s=$2-100; if (s<0) {print $1 "\t" 0 "\t" $3+100} else {print $1 "\t" s "\t" $3+100}}' ) -fi $humanRef -fo ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq -# -#fi -# -#echo "starting var hash generatrion" -#if [ -e ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ] -#then -# echo "skipping var hash generationr" -#else -# echo "$JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq" -# $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq -# echo "$JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab" -# $JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab -#fi -# -#echo "starting ref hash generation" -#if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ] -#then -# echo "skipping ref hash generation" -#else -# $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq -# $JellyFish dump -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab -#fi -# -# echo "pull hashes from sample" -#if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample ] -#then -# echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.sample file already exitst" -#else -# echo "starting hash lookup this one" -# bash $CheckHash $SampleJhash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -# echo "done with hash lookup" -#fi -# -#echo "pull hashes from controls" -#for parent in $ParentsJhash -# do -# if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent ] -# then -# echo "skiping Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent already exists" -# else -# echo "pulling Intermediates/$NameStub".overlap.asembly.hash.fastq."$parent" -# bash $CheckHash $parent ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub".overlap.asembly.hash.fastq."$parent -# fi -#done -# -# -# -#if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample ] -#then -# echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample" -#else -# bash $CheckHash $SampleJhash ././Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -#fi -# -#for parent in $ParentsJhash -#do -# if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent ] -# then -# echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.$parent already exitst" -# else -# -# #echo "-$parent-" -# #echo " bash $CheckHash $parent ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> $NameStub.overlap.asembly.hash.fastq.Ref.$parent" -# bash $CheckHash $parent ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent -# fi -#done -# -#parentCRString="" -#c="-c" -#cr="-cR" -#space=" " -# -# -######################### BUILDING UP parent c and cR string ############################## -#for parent in $ParentsJhash; -#do -# parentCRString="$parentCRString -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent -cR ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent " -#done -# -##echo "final parent String is $parentCRString" -########################################################################################### -#echo "here " -#if [ -s ./Intermediates/$NameStub.ref.RepRefHash ] -#then -# echo "Exclude already exists" -#else -# if [ -z $refHash ] -# then -# echo "refhash not provided, skipping" -# touch Intermediates/$NameStub.ref.RepRefHash -# else -# -# echo "this one" -# echo "bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov > Intermediates/$NameStub.ref.RepRefHash" -# bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.ref.RepRefHash -# echo "outa this" -# fi -#fi -wait - -if [ -e ./$NameStub.overlap.hashcount.fastq.bam.bai ] -then - echo "skipping index ./$NameStub.overlap.hashcount.fastq.bam" -else - - samtools index ./$NameStub.overlap.hashcount.fastq.bam -fi - -echo "$RUFUSinterpret -mob ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash " - -echo "" -echo "" -echo "" -dumbFix=$(awk '{split($1, a, ".V2"); print a[1]}' <<< $NameStub) -echo "$RUFUSinterpret -mob ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -mod $dumbFix.Jhash.histo.7.7.dist -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash" -echo "samtools view ./$NameStub.overlap.hashcount.fastq.bam | grep -v chrUn " -samtools view ./$NameStub.overlap.hashcount.fastq.bam | grep -v chrUn | \ - $RUFUSinterpret \ - -mQ 1 \ - -r $humanRef \ - -hf $HashList \ - -o ./$NameStub.overlap.hashcount.fastq.bam \ - -m $MaxAlleleSize \ - -as 1000 - - diff --git a/scripts/Overlap.rerunAWS.save.sh b/scripts/Overlap.rerunAWS.save.sh deleted file mode 100755 index c2312922..00000000 --- a/scripts/Overlap.rerunAWS.save.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -humanRef=$1 -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 - -SampleJhash=$8 -ParentsJhash=$9 - -humanRefBwa=${10} -refHash=${11} - -echo " you gave -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -" - -echo "final coveage is $FinalCoverage" - -echo "@@@@@@@@@@@@@__IN_OVERLAP__@@@@@@@@@@@@@@@" -echo "human ref in Overlap is $humanRef" -echo "bwa human ref in Overlap is $humanRefBwa" -echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -mkdir ./TempOverlap/ -mkdir ./Intermediates/ -echo "Overlaping $File" - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -RDIR=$CDIR/../ - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -#gkno=$RDIR/bin/gkno_launcher/gkno -bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -CheckHash=$RDIR/scripts/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish -MOBList=$RDIR/resources/primate_non-LTR_Retrotransposon.fasta - -$bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $MOBList ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O sam - > ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam - samtools index ./$NameStub.overlap.hashcount.fastq.bam - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - -parentCRString="" -c="-c" -cr="-cR" -space=" " - - - - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 2,2 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - samtools index ./$NameStub.overlap.hashcount.fastq.bam -fi - -######################## BUILDING UP parent c and cR string ############################## -for parent in $ParentsJhash; -do - parentCRString="$parentCRString -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent -cR ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent " -done - -#echo "final parent String is $parentCRString" -########################################################################################## - - -mkfifo check -samtools index ./$NameStub.overlap.hashcount.fastq.bam - -echo "$RUFUSinterpret -mob ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash " - -samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mob ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash - - diff --git a/scripts/Overlap.rerunAWS.sh b/scripts/Overlap.rerunAWS.sh deleted file mode 100755 index 343f17e2..00000000 --- a/scripts/Overlap.rerunAWS.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/bash -humanRef=$1 -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 - -SampleJhash=$8 -ParentsJhash=$9 - -humanRefBwa=${10} -refHash=${11} -MaxCov=100000 -echo " you gave -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -" - -echo "final coveage is $FinalCoverage" - - -echo "RUNNING THIS ONE" -echo "@@@@@@@@@@@@@__IN_OVERLAP__@@@@@@@@@@@@@@@" -echo "human ref in Overlap is $humanRef" -echo "bwa human ref in Overlap is $humanRefBwa" -echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -mkdir ./TempOverlap/ -mkdir ./Intermediates/ -echo "Overlaping $File" - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -RDIR=$CDIR/../ - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -CheckHash=$RDIR/scripts/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish -MOBList=$RDIR/resources/primate_non-LTR_Retrotransposon.fasta - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - - -if [ -s ./$File.bam ] -then - echo "skipping align" -else - $bwa mem -t $Threads $humanRefBwa "$File" | samtools sort -T $File -O bam - > $File.bam - samtools index $File.bam -fi - -if [ -s ./TempOverlap/$NameStub.sam.fastqd ] -then - echo "skipping sam assemble" -else - - $OverlapSam <( samtools view -F 3328 $File.bam | awk '$9 > 100 || $9 < -100 || $9==0' ) .95 20 1 ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads - #$OverlapSam <( samtools view -F 3328 $File.bam ) .95 20 1 ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads -fi -if [ -s ./TempOverlap/$NameStub.1.fastqd ] -then - echo "skipping first overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 50 1 FP 20 1 ./TempOverlap/$NameStub.1 0 $Threads #> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.2.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 50 2 FP 20 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.3.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.2.fastqd .98 25 2 $NameStub 20 1 ./TempOverlap/$NameStub.3 1 $Threads #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.4.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .98 25 $FinalCoverage ./TempOverlap/$NameStub.4 $NameStub 1 $Threads > /dev/null - #time $OverlapHash ./TempOverlap/$NameStub.3.fastqd .98 25 $FinalCoverage $NameStub 15 1 ./TempOverlap/$NameStub.4 1 $Threads #>> $File.overlap.out -fi -if [ -s ./$NameStub.overlap.hashcount.fastq ] -then - echo "skipping final overlap work" -else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.4.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - - echo "$AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 2,2 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - samtools index ./$NameStub.overlap.hashcount.fastq.bam -fi - -if [ -s ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam ] -then - echo "skipping MOB alignemnt check " -else - $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $MOBList ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O sam - > ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -fi - - -############################################################################################################# - -parentCRString="" -c="-c" -cr="-cR" -space=" " - - -######################## BUILDING UP parent c and cR string ############################## -for parent in $ParentsJhash; -do - parentCRString="$parentCRString -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent -cR ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent " -done - -#echo "final parent String is $parentCRString" -########################################################################################## - -mkfifo check -samtools index ./$NameStub.overlap.hashcount.fastq.bam - -echo "$RUFUSinterpret -mob ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash " - -echo "" -echo "" -echo "" -echo "$RUFUSinterpret -mob ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash" -samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mob ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash - - diff --git a/scripts/Overlap.sh b/scripts/Overlap.sh deleted file mode 100755 index b13a3aa9..00000000 --- a/scripts/Overlap.sh +++ /dev/null @@ -1,215 +0,0 @@ -#!/bin/bash -humanRef=$1 -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 - -SampleJhash=$8 -ParentsJhash=$9 - -humanRefBwa=${10} -refHash=${11} - -#echo " you gave -#File=$2 -#FinalCoverage=$3 -#NameStub=$4.V2 -#HashList=$5 -#HashSize=$6 -#Threads=$7 -#" - -#echo "final coveage is $FinalCoverage" - -echo "Starting overlap phase..." -echo "Reference provided is $humanRef" -mkdir ./TempOverlap/ -mkdir ./Intermediates/ - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -RDIR=$CDIR/../ - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -#gkno=$RDIR/bin/gkno_launcher/gkno -bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -CheckHash=$RDIR/scripts/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish - - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - -if [ -s ./$File.bam ] -then - echo "skipping align" -else - $bwa mem $humanRefBwa "$File" | samtools sort -T $File -O bam - > $File.bam - samtools index $File.bam -fi - -if [ -s ./TempOverlap/$NameStub.sam.fastqd ] -then - echo "skipping sam assemble" -else - - $OverlapSam <( samtools view -F 3328 $File.bam ) .95 25 1 ./TempOverlap/$NameStub.sam $NameStub 1 $Threads -fi - -if [ -s ./TempOverlap/$NameStub.1.fastqd ] -then - echo "skipping first overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 50 1 FP 24 1 ./TempOverlap/$NameStub.1 1 $Threads #> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.2.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 50 2 FP 15 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out -fi -$ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.2.fastqd > ./TempOverlap/$NameStub.3.fastqd -if [ -s ./TempOverlap/$NameStub.4.fastqd ] -then - echo "skipping overlap 4" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .98 50 2 ./TempOverlap/$NameStub.4 $NameStub 1 $Threads > /dev/null #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.5.fastqd ] -then - echo "skipping overlap 5" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.4.fastqd .98 35 $FinalCoverage ./TempOverlap/$NameStub.5 $NameStub 1 $Threads > /dev/null #>> $File.overlap.out -fi - -if [ -s ./$NameStub.overlap.hashcount.fastq ] -then - echo "skipping final overlap work" -else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.5.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - - echo "$AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - $bwa mem -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - samtools index ./$NameStub.overlap.hashcount.fastq.bam -fi - - -############################################################################################################# -if [ -e ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq ] -then - echo "skipping pull reference sequences" -else - $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/fastaFromBed -bed <( $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam) -fi $humanRef -fo ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq -fi - -if [ -e ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ] -then - echo "skipping var hash generationr" -else - #echo "$JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq" - $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq - #echo "$JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab" - $JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab -fi - -if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ] -then - echo "skipping ref hash generation" -else - $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq - $JellyFish dump -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab -fi - -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample ] -then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.sample file already exitst" -else - echo "starting hash lookup" - bash $CheckHash $SampleJhash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > Intermediates/$NameStub.overlap.asembly.hash.fastq.sample - echo "done with hash lookup" -fi -for parent in $ParentsJhash - do - if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent ] - then - echo "skiping Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent already exists" - else - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > Intermediates/$NameStub".overlap.asembly.hash.fastq."$parent - fi -done - - - -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample ] -then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample" -else - bash $CheckHash $SampleJhash ././Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -fi -for parent in $ParentsJhash -do - if [ -s $NameStub.overlap.asembly.hash.fastq.Ref.$parent ] - then - echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.$parent already exitst" - else - - #echo "-$parent-" - #echo " bash $CheckHash $parent ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.$parent" - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent - fi -done - -parentCRString="" -c="-c" -cr="-cR" -space=" " - - -######################## BUILDING UP parent c and cR string ############################## -for parent in $ParentsJhash; -do - parentCRString="$parentCRString -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent -cR ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent " -done - -#echo "final parent String is $parentCRString" -########################################################################################## - -if [ -s ./Intermediates/$NameStub.ref.RepRefHash ] -then - echo "Exclude already exists" -else - #echo "bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 1 > Intermediates/$NameStub.ref.RepRefHash" - bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 1 > Intermediates/$NameStub.ref.RepRefHash -fi -wait - -mkfifo check -samtools index ./$NameStub.overlap.hashcount.fastq.bam - -#echo "$RUFUSinterpret -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash " - -samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash - - diff --git a/scripts/Overlap.shorter.newGenotype.sh b/scripts/Overlap.shorter.newGenotype.sh deleted file mode 100755 index ee2f37a6..00000000 --- a/scripts/Overlap.shorter.newGenotype.sh +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/bash -humanRef=$1 -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 - -SampleJhash=$8 -ParentsJhash=$9 - -humanRefBwa=${10} -refHash=${11} -MaxCov=100000 -echo " you gave -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -" - -echo "final coveage is $FinalCoverage" - -echo "@@@@@@@@@@@@@__IN_OVERLAP__@@@@@@@@@@@@@@@" -echo "human ref in Overlap is $humanRef" -echo "bwa human ref in Overlap is $humanRefBwa" -echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -mkdir ./TempOverlap/ -mkdir ./Intermediates/ -echo "Overlaping $File" - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -RDIR=$CDIR/../ - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -#gkno=$RDIR/bin/gkno_launcher/gkno -bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -CheckHash=$RDIR/scripts/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish -MOBList=$RDIR/resources/primate_non-LTR_Retrotransposon.fasta - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - -if [ -s ./$File.bam ] -then - echo "skipping align" -else - $bwa mem -t $Threads $humanRefBwa "$File" | samtools sort -T $File -O bam - > $File.bam - samtools index $File.bam -fi - -if [ -s ./TempOverlap/$NameStub.sam.fastqd ] -then - echo "skipping sam assemble" -else - - $OverlapSam <( samtools view -F 3328 $File.bam ) .95 20 1 ./TempOverlap/$NameStub.sam $NameStub 1 $Threads -fi - -if [ -s ./TempOverlap/$NameStub.1.fastqd ] -then - echo "skipping first overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 50 1 FP 20 1 ./TempOverlap/$NameStub.1 0 $Threads #> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.2.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 50 2 FP 20 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.3.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.2.fastqd .98 25 2 $NameStub 20 1 ./TempOverlap/$NameStub.3 1 $Threads #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.4.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .98 25 $FinalCoverage ./TempOverlap/$NameStub.4 $NameStub 1 $Threads > /dev/null - #time $OverlapHash ./TempOverlap/$NameStub.3.fastqd .98 25 $FinalCoverage $NameStub 15 1 ./TempOverlap/$NameStub.4 1 $Threads #>> $File.overlap.out -fi -if [ -s ./$NameStub.overlap.hashcount.fastq ] -then - echo "skipping final overlap work" -else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.4.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - - echo "$AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - samtools index ./$NameStub.overlap.hashcount.fastq.bam -fi - -#if [ -s ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam ] -#then - $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $MOBList ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O sam - > ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -#fi - - -############################################################################################################# -if [ -e ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq ] -then - echo "skipping pull reference sequecnes" -else - - $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/fastaFromBed -bed <( $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam | awk '{s=$2-100; if (s<0) {print $1 "\t" 0 "\t" $3+100} else {print $1 "\t" s "\t" $3+100}}' ) -fi $humanRef -fo ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq - -fi - -if [ -e ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ] -then - echo "skipping var hash generationr" -else - echo "$JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq" - $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq - echo "$JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab" - $JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab -fi - -if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ] -then - echo "skipping ref hash generation" -else - $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq - $JellyFish dump -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab -fi - -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample ] -then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.sample file already exitst" -else - echo "starting hash lookup this one" - bash $CheckHash $SampleJhash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.overlap.asembly.hash.fastq.sample - echo "done with hash lookup" -fi -for parent in $ParentsJhash - do - if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent ] - then - echo "skiping Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent already exists" - else - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub".overlap.asembly.hash.fastq."$parent - fi -done - - - -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample ] -then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample" -else - bash $CheckHash $SampleJhash ././Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -fi - -for parent in $ParentsJhash -do - if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent ] - then - echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.$parent already exitst" - else - - #echo "-$parent-" - #echo " bash $CheckHash $parent ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> $NameStub.overlap.asembly.hash.fastq.Ref.$parent" - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent - fi -done - -parentCRString="" -c="-c" -cr="-cR" -space=" " - - -######################## BUILDING UP parent c and cR string ############################## -for parent in $ParentsJhash; -do - parentCRString="$parentCRString -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent -cR ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent " -done - -#echo "final parent String is $parentCRString" -########################################################################################## - -if [ -s ./Intermediates/$NameStub.ref.RepRefHash ] -then - echo "Exclude already exists" -else - echo "bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov > Intermediates/$NameStub.ref.RepRefHash" - bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.ref.RepRefHash -fi -wait - -mkfifo check -samtools index ./$NameStub.overlap.hashcount.fastq.bam - -echo "$RUFUSinterpret -mob ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash " - -samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mob ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 100000000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash - - diff --git a/scripts/Overlap.shorter.sh b/scripts/Overlap.shorter.sh index c227d3ee..44615830 100755 --- a/scripts/Overlap.shorter.sh +++ b/scripts/Overlap.shorter.sh @@ -1,22 +1,45 @@ #!/bin/bash +# NOTE: This script requires bash (process substitution is used) + +# Despite it's name, this is the only script currently utilized by RUFUS, despite any mode. When speed is true, veryfast +# mode is used. +# +# veryfast mode consists of the following criteria: +# 1. Reads going into OverlapSam are filtered by length - must be 150bp or shorter +# 2. OverlapSam is run with the following parameters: +# a. Min Percentage is 99% +# b. Min Overlap is 25bp +# c. Min Coverage is 3bp - todo: this needs to be set to command line arg +# +# normal mode consists of the following criteria: +# 1. OverlapSam is run with the following parameters: +# a. Min Percentage is 95% +# b. Min Overlap is 20bp +# c. Min Coverage is 1bp + + +set -euo pipefail + +: "${WORK_DIR:?WORK_DIR must be set}" -set -e humanRef=$1 -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 +File=$2 # e.g. WGS_IL_T_1.bwa.dedup.bam.generator.Mutations.fastq +FinalCoverage=$3 #todo: what is the difference between this and minOverlap +NameStub=$4.V2 # e.g. WGS_IL_T_1.bwa.dedup.bam.generator.Mutations.fastq +HashList=$5 # e.g. $ProbandGenerator".k"$K"_c"$MutantMinCov".HashList HashSize=$6 Threads=$7 MaxAlleleSize=$8 speed=$9 +humanRefBwa=${10} +invocFilePath=${11} +refHash=${12} # Will say "empty" if not provided +SampleJhash=${13} +ParentsJhash=${14} # this is optional +ParLowCovThreshold=${15:-7} -SampleJhash=${10} -ParentsJhash=${11} -humanRefBwa=${12} -refHash=${13} MaxCov=100000 #echo " you gave #File=$2 @@ -27,6 +50,7 @@ MaxCov=100000 #Threads=$7 #" +echo "final coverage is $FinalCoverage" #echo "final coveage is $FinalCoverage" @@ -35,24 +59,10 @@ MaxCov=100000 #echo "human ref in Overlap is $humanRef" #echo "bwa human ref in Overlap is $humanRefBwa" #echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -if [ ! -d "./TempOverlap/" ] -then - mkdir ./TempOverlap/ -else - echo "TempOverlap already present" -fi -if [ ! -d "./Intermediates/" ] -then - mkdir ./Intermediates/ -else - echo "Intermediates already present" -fi echo "Overlaping $File..." -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -RDIR=$CDIR/../ +: "${RUFUS_ROOT:=/opt/RUFUS}" +RDIR="$RUFUS_ROOT" AddSA=$RDIR/scripts/AddSAtoReadSame.pl OverlapHash=$RDIR/bin/Overlap @@ -68,233 +78,255 @@ OverlapSam=$RDIR/bin/OverlapSam JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish MOBList=$RDIR/resources/primate_non-LTR_Retrotransposon.fasta -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - - -if [ -s ./$File.bam ] +if [ -s "$WORK_DIR/$File.bam" ] then echo "skipping align" else - $bwa mem -t $Threads $humanRefBwa "$File" | samtools sort -T $File -O bam - > $File.bam - samtools index $File.bam + sortedFastq="$WORK_DIR/sorted."$File + cat "$WORK_DIR/$File" | paste - - - - | sort -k1 -S 8G | tr "\t" "\n" > $sortedFastq + + "$bwa" mem -t $Threads "$humanRefBwa" "$sortedFastq" | samtools view -h - | samtools sort -T $File -O bam - > "$File.bam" + samtools index "$File.bam" fi -if [ $( samtools view $File.bam| head | wc -l | awk '{print $1}') -eq "0" ]; then +if [ $( samtools view "$File.bam" | head | wc -l | awk '{print $1}') -eq "0" ]; then echo "ERROR: BWA failed on $File . Either the files are exactly the same of something went wrong in previous step" exit 100 fi -if [ "$speed" == "veryfast" ] +if [ "$speed" = "veryfast" ] then echo "running very fast assembly"; - if [ -s ./TempOverlap/$NameStub.sam.fastqd ] + if [ -s "$WORK_DIR/TempOverlap/$NameStub.sam.fastqd" ] then echo "skipping sam assemble" else - $OverlapSam <( samtools view -F 3328 $File.bam | awk '$9 > 150 || $9 < -150 ' ) .99 25 3 ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads - #$OverlapSam <( samtools view -F 3328 $File.bam ) .99 25 3 ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads + "$OverlapSam" <( samtools view -F 3328 "$File.bam" | awk '$9 > 150 || $9 < -150 ' ) .99 25 $FinalCoverage "$WORK_DIR/TempOverlap/$NameStub.sam" $NameStub 1 "$HashList" $Threads fi - if [ -s ./TempOverlap/$NameStub.final.fastqd ] + # todo: instead of hash here, first do overlapRegion looking at next 5 reads + if [ -s "$WORK_DIR/TempOverlap/$NameStub.final.fastqd" ] then echo "skipping second assemble" else - $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .99 75 $FinalCoverage $NameStub 15 1 ./TempOverlap/$NameStub.final 1 $Threads + # This will fix the gaps and also do trans-chromosomal alignments + "$OverlapHash" "$WORK_DIR/TempOverlap/$NameStub.sam.fastqd" .99 75 $FinalCoverage $NameStub 15 1 "$WORK_DIR/TempOverlap/$NameStub.final" 1 $Threads fi - if [ -s ./$NameStub.overlap.hashcount.fastq ] + if [ -s "$WORK_DIR/$NameStub.overlap.hashcount.fastq" ] then echo "skipping final overlap work" else + $ReplaceQwithDinFASTQD "$WORK_DIR/TempOverlap/$NameStub.final.fastqd" > "$WORK_DIR/$NameStub.overlap.fastqd" + $ConvertFASTqD "$WORK_DIR/$NameStub.overlap.fastqd" > "$WORK_DIR/$NameStub.overlap.fastq" - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.final.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - - #echo "$AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq + #echo "$AnnotateOverlap "$HashList" $WORK_DIR/$NameStub.overlap.fastq $WORK_DIR/TempOverlap/$NameStub.overlap.asembly.hash.fastq > $WORK_DIR/$NameStub.overlap.hashcount.fastq" + $AnnotateOverlap "$HashList" "$WORK_DIR/$NameStub.overlap.fastq" "$WORK_DIR/TempOverlap/$NameStub.overlap.asembly.hash.fastq" > "$WORK_DIR/$NameStub.overlap.hashcount.fastq" fi else echo "Running full assembly"; - if [ -s ./TempOverlap/$NameStub.sam.fastqd ] + if [ -s "$WORK_DIR/TempOverlap/$NameStub.sam.fastqd" ] then echo "skipping sam assemble" else - - #$OverlapSam <( samtools view -F 3328 $File.bam | awk '$9 > 100 || $9 < -100 || $9==0' ) .95 20 1 ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads - $OverlapSam <( samtools view -F 3328 $File.bam ) .95 20 1 ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads + "$OverlapSam" <( samtools view -F 3328 "$File.bam" ) .95 20 1 "$WORK_DIR/TempOverlap/$NameStub.sam" $NameStub 1 "$HashList" $Threads fi # todo: the problem here is that this is empty - #if [ $( wc -l ./TempOverlap/$NameStub.sam.fastqd | awk '{print $1}') -eq "0" ]; then - if [ $( head ./TempOverlap/$NameStub.sam.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.sam.fastqd" + #if [ $( wc -l $WORK_DIR/TempOverlap/$NameStub.sam.fastqd | awk '{print $1}') -eq "0" ]; then + if [ $( head "$WORK_DIR/TempOverlap/$NameStub.sam.fastqd" | wc -l | awk '{print $1}') -eq "0" ]; then + echo "ERROR Assembly produce output for $WORK_DIR/TempOverlap/$NameStub.sam.fastqd" exit 100 fi - if [ -s ./TempOverlap/$NameStub.1.fastqd ] + if [ -s "$WORK_DIR/TempOverlap/$NameStub.1.fastqd" ] then echo "skipping first overlap" else - echo "$OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 100 1 FP 20 1 ./TempOverlap/$NameStub.1 0 $Threads" - $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 100 1 FP 20 1 ./TempOverlap/$NameStub.1 0 $Threads #> $File.overlap.out + echo "$OverlapHash $WORK_DIR/TempOverlap/$NameStub.sam.fastqd .98 100 1 FP 20 1 $WORK_DIR/TempOverlap/$NameStub.1 0 $Threads" + $OverlapHash "$WORK_DIR/TempOverlap/$NameStub.sam.fastqd" .98 100 1 FP 20 1 "$WORK_DIR/TempOverlap/$NameStub.1" 0 $Threads #> $File.overlap.out fi - if [ $( head ./TempOverlap/$NameStub.1.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.1.fastqd" + if [ $( head "$WORK_DIR/TempOverlap/$NameStub.1.fastqd" | wc -l | awk '{print $1}') -eq "0" ]; then + echo "ERROR Assembly produce output for $WORK_DIR/TempOverlap/$NameStub.1.fastqd" exit 100 fi - if [ -s ./TempOverlap/$NameStub.2.fastqd ] + if [ -s "$WORK_DIR/TempOverlap/$NameStub.2.fastqd" ] then echo "skipping second overlap" else - $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 75 2 FP 20 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out + $OverlapHash "$WORK_DIR/TempOverlap/$NameStub.1.fastqd" .98 75 2 FP 20 1 "$WORK_DIR/TempOverlap/$NameStub.2" 1 $Threads #>> $File.overlap.out fi - if [ $( head ./TempOverlap/$NameStub.2.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.2.fastqd" + if [ $( head "$WORK_DIR/TempOverlap/$NameStub.2.fastqd" | wc -l | awk '{print $1}') -eq "0" ]; then + echo "ERROR Assembly produce output for $WORK_DIR/TempOverlap/$NameStub.2.fastqd" exit 100 fi - if [ -s ./TempOverlap/$NameStub.3.fastqd ] + if [ -s "$WORK_DIR/TempOverlap/$NameStub.3.fastqd" ] then echo "skipping third overlap" else - $OverlapHash ./TempOverlap/$NameStub.2.fastqd .98 50 2 $NameStub 20 1 ./TempOverlap/$NameStub.3 1 $Threads #>> $File.overlap.out + $OverlapHash $WORK_DIR/TempOverlap/$NameStub.2.fastqd .98 50 2 $NameStub 20 1 $WORK_DIR/TempOverlap/$NameStub.3 1 $Threads #>> $File.overlap.out fi - if [ $( head ./TempOverlap/$NameStub.3.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.3.fastqd" + if [ $( head "$WORK_DIR/TempOverlap/$NameStub.3.fastqd" | wc -l | awk '{print $1}') -eq "0" ]; then + echo "ERROR Assembly produce output for $WORK_DIR/TempOverlap/$NameStub.3.fastqd" exit 100 fi - if [ -s ./TempOverlap/$NameStub.4.fastqd ] + if [ -s "$WORK_DIR/TempOverlap/$NameStub.4.fastqd" ] then echo "skipping fourth overlap" else - $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .98 50 $FinalCoverage ./TempOverlap/$NameStub.4 $NameStub 1 $Threads - # $OverlapHash ./TempOverlap/$NameStub.3.fastqd .98 25 $FinalCoverage $NameStub 15 1 ./TempOverlap/$NameStub.4 1 $Threads #>> $File.overlap.out + # This is the original version - every read + $OverlapRebion2 $WORK_DIR/TempOverlap/$NameStub.3.fastqd .98 50 $FinalCoverage $WORK_DIR/TempOverlap/$NameStub.4 $NameStub 1 $Threads fi - if [ $( head ./TempOverlap/$NameStub.4.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.4.fastqd" + if [ $( head "$WORK_DIR/TempOverlap/$NameStub.4.fastqd" | wc -l | awk '{print $1}') -eq "0" ]; then + echo "ERROR Assembly produce output for $WORK_DIR/TempOverlap/$NameStub.4.fastqd" exit 100 fi - if [ -s ./$NameStub.overlap.hashcount.fastq ] + if [ -s "$WORK_DIR/$NameStub.overlap.hashcount.fastq" ] then echo "skipping final overlap work" else - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.4.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq + $ReplaceQwithDinFASTQD "$WORK_DIR/TempOverlap/$NameStub.4.fastqd" > "$WORK_DIR/$NameStub.overlap.fastqd" + $ConvertFASTqD $WORK_DIR/$NameStub.overlap.fastqd > $WORK_DIR/$NameStub.overlap.fastq - echo "$AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq + echo "$AnnotateOverlap "$HashList" $WORK_DIR/$NameStub.overlap.fastq $WORK_DIR/TempOverlap/$NameStub.overlap.asembly.hash.fastq > $WORK_DIR/$NameStub.overlap.hashcount.fastq" + $AnnotateOverlap "$HashList" $WORK_DIR/$NameStub.overlap.fastq $WORK_DIR/TempOverlap/$NameStub.overlap.asembly.hash.fastq > $WORK_DIR/$NameStub.overlap.hashcount.fastq fi fi -if [ $( head ./$NameStub.overlap.hashcount.fastq | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./$NameStub.overlap.hashcount.fastq" - exit 100 +if [ $( head "$WORK_DIR/$NameStub.overlap.hashcount.fastq" | wc -l | awk '{print $1}') -eq "0" ]; then + echo "RUFUS could not assemble any contigs from unique reads for the given region. Exiting..." + exit 0 +fi + +# Sort fastq file used in subsequence bwa calls for reproducibility +sortedFastq=$WORK_DIR/$NameStub".overlap.hashcount.sorted.fastq" +if [ -s "$WORK_DIR/$NameStub.overlap.hashcount.fastq" ] +then + echo "Sorting hashcount fastq file" + cat "$WORK_DIR/$NameStub.overlap.hashcount.fastq" | paste - - - - | sort -k1 -S 8G | tr "\t" "\n" > $sortedFastq +else + echo "$NameStub.overlap.hashcount.fastq does not exist, cannot sort" + echo "Exiting with failure" + exit 100 fi -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] +if [ -s "$WORK_DIR/$NameStub.overlap.hashcount.fastq.bam" ] then echo "skipping contig alignment" else -# $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 2,2 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam -# $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 2,2 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - $bwa mem -t $Threads -Y $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - samtools index ./$NameStub.overlap.hashcount.fastq.bam + "$bwa" mem -t $Threads -Y "$humanRefBwa" "$sortedFastq" | samtools view -h - | samtools sort -T $File -O bam - > $WORK_DIR/$NameStub.overlap.hashcount.fastq.bam + samtools index "$WORK_DIR/$NameStub.overlap.hashcount.fastq.bam" fi -if [ $( samtools view ./$NameStub.overlap.hashcount.fastq.bam | head | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR: BWA failed on ./$NameStub.overlap.hashcount.fastq.bam . Either the files are exactly the same of something went wrong in previous step" +if [ $( samtools view "$WORK_DIR/$NameStub.overlap.hashcount.fastq.bam" | head | wc -l | awk '{print $1}') -eq "0" ]; then + echo "ERROR: BWA failed on $WORK_DIR/$NameStub.overlap.hashcount.fastq.bam . Either the files are exactly the same of something went wrong in previous step" exit 100 fi echo "string hash lookup" ############################################################################################################# -echo "staring MOB check" -if [ -s ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam ] +echo "staring MOB check on sorted fastq" +if [ -s "$WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam" ] then echo "skipping MOB alignemnt check " -else - $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $MOBList ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O sam - > ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam +else + echo "$bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $MOBList "$sortedFastq" | samtools view -h - | samtools sort -T $File -O sam - > "$WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam"" + "$bwa" mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $MOBList "$sortedFastq" | samtools view -h - | samtools sort -T $File -O sam - > "$WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam" fi - -if [ -e ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq ] +if [ -e "$WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq" ] then echo "skipping pull reference sequecnes" else - bedtools getfasta -bed <( bedtools bamtobed -i ./$NameStub.overlap.hashcount.fastq.bam | awk '{s=$2-100; if (s<0) {print $1 "\t" 0 "\t" $3+100} else {print $1 "\t" s "\t" $3+100}}' ) -fi $humanRef -fo ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq + bedtools getfasta -bed <( bedtools bamtobed -i "$WORK_DIR/$NameStub.overlap.hashcount.fastq.bam" | awk '{s=$2-100; if (s<0) {print $1 "\t" 0 "\t" $3+100} else {print $1 "\t" s "\t" $3+100}}' ) -fi "$humanRef" -fo "$WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq" fi -if [ -e ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ] +if [ -e "$WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash" ] then - echo "skipping var hash generationr" + echo "skipping var hash generation" else - #echo "$JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq" - $JellyFish count -m $HashSize -s 1G -t 1 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq - #echo "$JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab" - $JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab + #echo "$JellyFish count -m $HashSize -s 1G -t 20 -o $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash $WORK_DIR/$NameStub.overlap.hashcount.fastq" + $JellyFish count -m $HashSize -s 1G -t 1 -o $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash $WORK_DIR/$NameStub.overlap.hashcount.fastq + #echo "$JellyFish dump -c $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab" + $JellyFish dump -c $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab fi echo "Creating reference kMer hash..." -if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ] +if [ -s "$WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash" ] then echo "skipping ref hash generation" else - $JellyFish count -m $HashSize -s 1G -t 1 -o ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq - $JellyFish dump -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab + $JellyFish count -m $HashSize -s 1G -t 1 -o $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq + $JellyFish dump -c $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab fi echo "Retrieving kMer hashes from sample..." -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample ] +if [ -s "$WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.sample" ] then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.sample file already exitst" + echo "skipping $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.sample file already exitst" else echo "starting hash lookup this one" - bash $CheckHash $SampleJhash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.overlap.asembly.hash.fastq.sample & + bash $CheckHash $SampleJhash $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.sample & + pid=$! echo "done with hash lookup" + wait "$pid" || { echo "ERROR: hash lookup failed"; exit 100; } fi echo "Retrieving kMer hashes from control(s)..." -for parent in $ParentsJhash +IFS=' ' read -r -a parents <<< "$ParentsJhash" + +# Per-control hash intermediates below concatenate the SUBJECT stub ($NameStub) and the CONTROL name +# ($parent). With long input filenames that basename can exceed the 255-byte NAME_MAX and fail to +# create ("File name too long" -> exit 100 in the overlap stage; hit by ~96-char SMaHT CRAM names). +# RUFUS.interpret derives each control's VCF sample name from the text AFTER the marker +# "overlap.asembly.hash.fastq." (i.e. the $parent portion) and ignores the prefix, so we use a SHORT +# constant prefix here instead of $NameStub. The control name is preserved intact -> output VCF is +# byte-identical; only the on-disk intermediate filename gets shorter. (One subject per WORK_DIR, so a +# constant prefix cannot collide.) +CtrlStub="ctrlhash" +for parent in "${parents[@]}" do - if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent ] + parent_path="$parent"; parent=$(basename "$parent") # keep full path for the hash query; basename is for on-disk filenames only + if [ -s "$WORK_DIR/Intermediates/$CtrlStub.overlap.asembly.hash.fastq.$parent" ] then - echo "skiping Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent already exists" + echo "skiping $WORK_DIR/Intermediates/$CtrlStub.overlap.asembly.hash.fastq.$parent already exists" else - echo "pulling Intermediates/$NameStub".overlap.asembly.hash.fastq."$parent" - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub".overlap.asembly.hash.fastq."$parent & + echo "pulling $WORK_DIR/Intermediates/$CtrlStub".overlap.asembly.hash.fastq."$parent" + bash $CheckHash "$parent_path" $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> $WORK_DIR/Intermediates/$CtrlStub".overlap.asembly.hash.fastq."$parent & + pid=$! + wait "$pid" || { echo "ERROR: hash lookup failed"; exit 100; } fi done wait -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample ] +if [ -s "$WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample" ] then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample" + echo "skipping $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample" else - bash $CheckHash $SampleJhash ././Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample& + bash $CheckHash $SampleJhash $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample& fi -for parent in $ParentsJhash +for parent in "${parents[@]}" do - if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent ] + parent_path="$parent"; parent=$(basename "$parent") # keep full path for the hash query; basename is for on-disk filenames only + if [ -s "$WORK_DIR/Intermediates/$CtrlStub.overlap.asembly.hash.fastq.Ref.$parent" ] then - echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.$parent already exitst" + echo "skipping $CtrlStub.overlap.asembly.hash.fastq.Ref.$parent already exitst" else #echo "-$parent-" - #echo " bash $CheckHash $parent ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent" - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent & + #echo " bash $CheckHash $parent $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> $WORK_DIR/Intermediates/$CtrlStub.overlap.asembly.hash.fastq.Ref.$parent" + bash $CheckHash "$parent_path" $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> $WORK_DIR/Intermediates/$CtrlStub.overlap.asembly.hash.fastq.Ref.$parent & echo "uncomment this" fi done @@ -306,39 +338,36 @@ space=" " ######################## BUILDING UP parent c and cR string ############################## -for parent in $ParentsJhash; +for parent in "${parents[@]}"; do - parentCRString="$parentCRString -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent -cR ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent " + parent_path="$parent"; parent=$(basename "$parent") # keep full path for the hash query; basename is for on-disk filenames only + parentCRString="$parentCRString -c $WORK_DIR/Intermediates/$CtrlStub.overlap.asembly.hash.fastq.$parent -cR $WORK_DIR/Intermediates/$CtrlStub.overlap.asembly.hash.fastq.Ref.$parent " done -#echo "final parent String is $parentCRString" ########################################################################################## -#echo "here " -if [ -s ./Intermediates/$NameStub.ref.RepRefHash ] +if [ -s "$WORK_DIR/Intermediates/$NameStub.ref.RepRefHash" ] then echo "Exclude already exists" else - if [ -z $refHash ] + if [ "$refHash" = "empty" ] then echo "refhash not provided, skipping" - touch Intermediates/$NameStub.ref.RepRefHash + touch $WORK_DIR/Intermediates/$NameStub.ref.RepRefHash else #echo "this one" - #echo "bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov > Intermediates/$NameStub.ref.RepRefHash" - bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.ref.RepRefHash + #echo "bash $CheckHash $refHash $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov > $WORK_DIR/Intermediates/$NameStub.ref.RepRefHash" + bash $CheckHash $refHash $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> $WORK_DIR/Intermediates/$NameStub.ref.RepRefHash #echo "outa this" fi fi wait -samtools index ./$NameStub.overlap.hashcount.fastq.bam +samtools index $WORK_DIR/$NameStub.overlap.hashcount.fastq.bam echo "" echo "" echo "" dumbFix=$(awk '{split($1, a, ".V2"); print a[1]}' <<< $NameStub) -#echo "$RUFUSinterpret -mob ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -mod $dumbFix.Jhash.histo.7.7.dist -mQ 20 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash" - -samtools view ./$NameStub.overlap.hashcount.fastq.bam | perl $AddSA | grep -v chrUn | $RUFUSinterpret -mob ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -mod $dumbFix.Jhash.histo.7.7.dist -mQ 10 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash - +#echo "$RUFUSinterpret -mob $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -mod $dumbFix.Jhash.histo.7.7.dist -mQ 20 -r $humanRef -hf "$HashList" -o $WORK_DIR/$NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $(echo $parentCRString) -sR $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e $WORK_DIR/Intermediates/$NameStub.ref.RepRefHash" +samtools view -h $WORK_DIR/$NameStub.overlap.hashcount.fastq.bam | perl $AddSA | grep -v chrUn | $RUFUSinterpret -mob $WORK_DIR/Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -mod $dumbFix.Jhash.histo.7.7.dist -mQ 10 -r "$humanRef" -hf "$HashList" -o $NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $parentCRString -sR $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s $WORK_DIR/Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e $WORK_DIR/Intermediates/$NameStub.ref.RepRefHash -rp "$RUFUS_ROOT" -ip "$invocFilePath" -plct "$ParLowCovThreshold" \ No newline at end of file diff --git a/scripts/Overlap.shorter.simons.sh b/scripts/Overlap.shorter.simons.sh deleted file mode 100755 index 1d22008b..00000000 --- a/scripts/Overlap.shorter.simons.sh +++ /dev/null @@ -1,230 +0,0 @@ -#!/bin/bash - -set -e - -humanRef=$1 -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -MaxAlleleSize=$8 -speed=$9 - -SampleJhash=${10} -ParentsJhash=${11} - -humanRefBwa=${12} -refHash=${13} -MaxCov=100000 -echo " you gave -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -" - -echo "final coveage is $FinalCoverage" - - -echo "RUNNING THIS ONE" -echo "@@@@@@@@@@@@@__IN_OVERLAP__@@@@@@@@@@@@@@@" -echo "human ref in Overlap is $humanRef" -echo "bwa human ref in Overlap is $humanRefBwa" -echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -echo "Overlaping $File" - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -RDIR=$CDIR/../ - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -OverlapRegionSmall=$RDIR/bin/OverlapRegion.small -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -CheckHash=$RDIR/scripts/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish -MOBList=$RDIR/resources/primate_non-LTR_Retrotransposon.fasta - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - - -if [ -s ./$File.bam ] -then - echo "skipping align" -else - $bwa mem -t $Threads $humanRefBwa "$File" | samtools sort -T $File -O bam - > $File.bam - samtools index $File.bam -fi - -if [ $( samtools view $File.bam| head | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR: BWA failed on $File . Either the files are exactly the same of something went wrong in previous step" - exit 100 -fi - -if [ "$speed" == "veryfast" ] -then - echo "running very fast assembly"; - if [ -s ./TempOverlap/$NameStub.sam.fastqd ] - then - echo "skipping sam assemble" - else - - $OverlapSam <( samtools view -F 3328 $File.bam ) .95 20 3 ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads - fi - if [ -s ./TempOverlap/$NameStub.final.fastqd ] - then - echo "skipping second assemble" - else - $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .99 75 $FinalCoverage $NameStub 15 1 ./TempOverlap/$NameStub.final 1 $Threads - fi - - if [ -s ./$NameStub.overlap.hashcount.fastq ] - then - echo "skipping final overlap work" - else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.final.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - - echo "$AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq - fi -else - echo "Running full assembly"; - - if [ -s ./TempOverlap/$NameStub.sam.fastqd ] - then - echo "skipping sam assemble" - else - - #$OverlapSam <( samtools view -F 3328 $File.bam | awk '$9 > 100 || $9 < -100 || $9==0' ) .95 20 1 ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads - $OverlapSam <( samtools view -F 3328 $File.bam ) .95 20 1 ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads - fi - - #if [ $( wc -l ./TempOverlap/$NameStub.sam.fastqd | awk '{print $1}') -eq "0" ]; then - if [ $( head ./TempOverlap/$NameStub.sam.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.sam.fastqd" - exit 100 - fi - - if [ -s ./TempOverlap/$NameStub.1.fastqd ] - then - echo "skipping first overlap" - else - $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 100 1 FP 20 1 ./TempOverlap/$NameStub.1 0 $Threads #> $File.overlap.out - fi - - if [ $( head ./TempOverlap/$NameStub.1.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.1.fastqd" - exit 100 - fi - - if [ -s ./TempOverlap/$NameStub.2.fastqd ] - then - echo "skipping second overlap" - else - $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 75 2 FP 20 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out - fi - - if [ $( head ./TempOverlap/$NameStub.2.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.2.fastqd" - exit 100 - fi - - if [ -s ./TempOverlap/$NameStub.3.fastqd ] - then - echo "skipping third overlap" - else - $OverlapHash ./TempOverlap/$NameStub.2.fastqd .98 50 2 $NameStub 20 1 ./TempOverlap/$NameStub.3 1 $Threads #>> $File.overlap.out - fi - if [ $( head ./TempOverlap/$NameStub.3.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.3.fastqd" - exit 100 - fi - - if [ -s ./TempOverlap/$NameStub.4.fastqd ] - then - echo "skipping fourth overlap" - else - $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .98 50 $FinalCoverage ./TempOverlap/$NameStub.4 $NameStub 1 $Threads - # $OverlapHash ./TempOverlap/$NameStub.3.fastqd .98 25 $FinalCoverage $NameStub 15 1 ./TempOverlap/$NameStub.4 1 $Threads #>> $File.overlap.out - fi - if [ $( head ./TempOverlap/$NameStub.4.fastqd | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./TempOverlap/$NameStub.4.fastqd" - exit 100 - fi - - - if [ -s ./$NameStub.overlap.hashcount.fastq ] - then - echo "skipping final overlap work" - else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.4.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - - echo "$AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq - fi -fi - -if [ $( head ./$NameStub.overlap.hashcount.fastq | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR Assembly produce output for ./$NameStub.overlap.hashcount.fastq" - exit 100 -fi - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else -# $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 2,2 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam -# $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -L 2,2 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - $bwa mem -t $Threads -Y $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - samtools index ./$NameStub.overlap.hashcount.fastq.bam -fi - -if [ $( samtools view ./$NameStub.overlap.hashcount.fastq.bam | head | wc -l | awk '{print $1}') -eq "0" ]; then - echo "ERROR: BWA failed on ./$NameStub.overlap.hashcount.fastq.bam . Either the files are exactly the same of something went wrong in previous step" - exit 100 -fi - -echo "string hash lookup" -############################################################################################################# - - - -parentCRString="" - - -######################## BUILDING UP parent c and cR string ############################## -for parent in $ParentsJhash; -do - parentCRString="$parentCRString -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent -cR ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent " -done - -#echo "final parent String is $parentCRString" -########################################################################################## -echo "starting overlap index" -samtools index ./$NameStub.overlap.hashcount.fastq.bam -echo "done with overlap index" -echo "" -echo "" -echo "" -dumbFix=$(awk '{split($1, a, ".V2"); print a[1]}' <<< $NameStub) -echo "samtools view ./$NameStub.overlap.hashcount.fastq.bam | grep -v chrUn | $RUFUSinterpret -mob ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -mod $dumbFix.Jhash.histo.7.7.dist -mQ 1 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash" -samtools view ./$NameStub.overlap.hashcount.fastq.bam | grep -v chrUn | $RUFUSinterpret -mob ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -mod $dumbFix.Jhash.histo.7.7.dist -mQ 1 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash - - diff --git a/scripts/Overlap.veryshort.save b/scripts/Overlap.veryshort.save deleted file mode 100755 index 9d565ad3..00000000 --- a/scripts/Overlap.veryshort.save +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/bash -humanRef=$1 -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 - -SampleJhash=$8 -ParentsJhash=$9 - -humanRefBwa=${10} -refHash=${11} - -echo " you gave -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -" - -echo "final coveage is $FinalCoverage" - -echo "@@@@@@@@@@@@@__IN_OVERLAP__@@@@@@@@@@@@@@@" -echo "human ref in Overlap is $humanRef" -echo "bwa human ref in Overlap is $humanRefBwa" -echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -mkdir ./TempOverlap/ -mkdir ./Intermediates/ -echo "Overlaping $File" - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -RDIR=$CDIR/../ - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -#gkno=$RDIR/bin/gkno_launcher/gkno -bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -CheckHash=$RDIR/scripts/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish - - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - -if [ -s ./$File.bam ] -then - echo "skipping align" -else - $bwa mem -t $Threads $humanRefBwa "$File" | samtools sort -T $File -O bam - > $File.bam - samtools index $File.bam -fi - -if [ -s ./TempOverlap/$NameStub.sam.fastqd ] -then - echo "skipping sam assemble" -else - - $OverlapSam <( samtools view -F 3328 $File.bam ) .95 20 $FinalCoverage ./TempOverlap/$NameStub.sam $NameStub 1 $Threads -fi - -if [ -s ./$NameStub.overlap.hashcount.fastq ] -then - echo "skipping final overlap work" -else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.sam.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - - echo "$AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - samtools index ./$NameStub.overlap.hashcount.fastq.bam -fi - - -############################################################################################################# -if [ -e ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq ] -then - echo "skipping pull reference sequecnes" -else - $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/fastaFromBed -bed <( $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam) -fi $humanRef -fo ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq -fi - -if [ -e ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ] -then - echo "skipping var hash generationr" -else - echo "$JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq" - $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq - echo "$JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab" - $JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab -fi - -if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ] -then - echo "skipping ref hash generation" -else - $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq - $JellyFish dump -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab -fi - -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample ] -then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.sample file already exitst" -else - echo "starting hash lookup" - bash $CheckHash $SampleJhash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > Intermediates/$NameStub.overlap.asembly.hash.fastq.sample - echo "done with hash lookup" -fi -for parent in $ParentsJhash - do - if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent ] - then - echo "skiping Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent already exists" - else - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > Intermediates/$NameStub".overlap.asembly.hash.fastq."$parent - fi -done - - - -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample ] -then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample" -else - bash $CheckHash $SampleJhash ././Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -fi -for parent in $ParentsJhash -do - if [ -s $NameStub.overlap.asembly.hash.fastq.Ref.$parent ] - then - echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.$parent already exitst" - else - - #echo "-$parent-" - #echo " bash $CheckHash $parent ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.$parent" - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent - fi -done - -parentCRString="" -c="-c" -cr="-cR" -space=" " - - -######################## BUILDING UP parent c and cR string ############################## -for parent in $ParentsJhash; -do - parentCRString="$parentCRString -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent -cR ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent " -done - -#echo "final parent String is $parentCRString" -########################################################################################## - -if [ -s ./Intermediates/$NameStub.ref.RepRefHash ] -then - echo "Exclude already exists" -else - echo "bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 1 > Intermediates/$NameStub.ref.RepRefHash" - bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 1 > Intermediates/$NameStub.ref.RepRefHash -fi -wait - -mkfifo check -samtools index ./$NameStub.overlap.hashcount.fastq.bam - -echo "$RUFUSinterpret -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash " - -samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 100000000 $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash - - diff --git a/scripts/Overlap.veryshort.sh b/scripts/Overlap.veryshort.sh deleted file mode 100755 index 8e79fb38..00000000 --- a/scripts/Overlap.veryshort.sh +++ /dev/null @@ -1,207 +0,0 @@ -#!/bin/bash -humanRef=$1 -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -MaxAlleleSize=$8 - -SampleJhash=$9 -ParentsJhash=${10} - -humanRefBwa=${11} -refHash=${12} -MaxCov=100000 -echo " you gave -File=$2 -FinalCoverage=$3 -NameStub=$4.V2 -HashList=$5 -HashSize=$6 -Threads=$7 -" - -echo "final coveage is $FinalCoverage" - - -echo "RUNNING THIS ONE" -echo "@@@@@@@@@@@@@__IN_OVERLAP__@@@@@@@@@@@@@@@" -echo "human ref in Overlap is $humanRef" -echo "bwa human ref in Overlap is $humanRefBwa" -echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -mkdir ./TempOverlap/ -mkdir ./Intermediates/ -echo "Overlaping $File" - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -RDIR=$CDIR/../ - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -bwa=$RDIR/bin/externals/bwa/src/bwa_project/bwa -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -CheckHash=$RDIR/scripts/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JellyFish=$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish -MOBList=$RDIR/resources/primate_non-LTR_Retrotransposon.fasta - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - - -#if [ -s ./$File.bam ] -#then - echo "skipping align" -#else -# $bwa mem -t $Threads $humanRefBwa "$File" | samtools sort -T $File -O bam - > $File.bam -# samtools index $File.bam -#fi - -if [ -s ./TempOverlap/$NameStub.sam.fastqd ] -then - echo "skipping sam assemble" -else - - $OverlapSam <( samtools view -F 3328 $File.bam | awk '$9 > 100 || $9 < -100 || $9==0' ) .99 20 $FinalCoverage ./TempOverlap/$NameStub.sam $NameStub 1 $HashList $Threads -fi -if [ -s ./$NameStub.overlap.hashcount.fastq ] -then - echo "skipping final overlap work" -else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.sam.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - - echo "$AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq" - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq TempOverlap/$NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $humanRefBwa ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - samtools index ./$NameStub.overlap.hashcount.fastq.bam -fi - -if [ -s ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam ] -then - echo "skipping MOB alignemnt check " -else - $bwa mem -t $Threads -Y -E 0,0 -O 6,6 -d 500 -w 500 -L 0,0 $MOBList ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O sam - > ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -fi - - -############################################################################################################# -if [ -e ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq ] -then - echo "skipping pull reference sequecnes" -else - - $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/fastaFromBed -bed <( $RDIR/bin/externals/bedtools2/src/bedtools2_project/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam | awk '{s=$2-100; if (s<0) {print $1 "\t" 0 "\t" $3+100} else {print $1 "\t" s "\t" $3+100}}' ) -fi $humanRef -fo ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq - -fi - -if [ -e ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ] -then - echo "skipping var hash generationr" -else - echo "$JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq" - $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq - echo "$JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab" - $JellyFish dump -c ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash > ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab -fi - -if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ] -then - echo "skipping ref hash generation" -else - $JellyFish count -m $HashSize -s 1G -t 20 -o ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq - $JellyFish dump -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab -fi - -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample ] -then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.sample file already exitst" -else - echo "starting hash lookup this one" - bash $CheckHash $SampleJhash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.overlap.asembly.hash.fastq.sample - echo "done with hash lookup" -fi -for parent in $ParentsJhash - do - if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent ] - then - echo "skiping Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent already exists" - else - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub".overlap.asembly.hash.fastq."$parent - fi -done - - - -if [ -s Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample ] -then - echo "skipping Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample" -else - bash $CheckHash $SampleJhash ././Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -fi - -for parent in $ParentsJhash -do - if [ -s ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent ] - then - echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.$parent already exitst" - else - - #echo "-$parent-" - #echo " bash $CheckHash $parent ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> $NameStub.overlap.asembly.hash.fastq.Ref.$parent" - bash $CheckHash $parent ./Intermediates/$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 $MaxCov> ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent - fi -done - -parentCRString="" -c="-c" -cr="-cR" -space=" " - - -######################## BUILDING UP parent c and cR string ############################## -for parent in $ParentsJhash; -do - parentCRString="$parentCRString -c ./Intermediates/$NameStub.overlap.asembly.hash.fastq.$parent -cR ./Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.$parent " -done - -#echo "final parent String is $parentCRString" -########################################################################################## - -if [ -s ./Intermediates/$NameStub.ref.RepRefHash ] -then - echo "Exclude already exists" -else - echo "bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov > Intermediates/$NameStub.ref.RepRefHash" - bash $CheckHash $refHash ./Intermediates/$NameStub.overlap.hashcount.fastq.Jhash.tab 0 $MaxCov> Intermediates/$NameStub.ref.RepRefHash -fi -wait - -mkfifo check -samtools index ./$NameStub.overlap.hashcount.fastq.bam - -echo "$RUFUSinterpret -mob ./TempOverlap/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash " - - - - - -samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mob ./Intermediates/$NameStub.overlap.hashcount.fastq.MOB.sam -mod Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -mQ 1 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m $MaxAlleleSize $(echo $parentCRString) -sR Intermediates/$NameStub.overlap.asembly.hash.fastq.Ref.sample -s Intermediates/$NameStub.overlap.asembly.hash.fastq.sample -e ./Intermediates/$NameStub.ref.RepRefHash - - diff --git a/scripts/OverlapBashMultiThread.individual.sh b/scripts/OverlapBashMultiThread.individual.sh deleted file mode 100755 index 982c5118..00000000 --- a/scripts/OverlapBashMultiThread.individual.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -File=$1 -FinalCoverage=$2 -NameStub=$3.V2 -HashList=$4 -Threads=$5 - -SampleJhash=$6 - -echo " you gave -File=$File -FinalCoverage=$FinalCoverage -NameStub=$NameStub -HashList=$HashList -Threads=$Threads -" - -mkdir ./TempOverlap/ -echo "Overlaping $File" - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -gkno=$RDIR/bin/gkno_launcher/gkno -samtools=$RDIR/bin/gkno_launcher/tools/samtools/samtools -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -humanRef=$RDIR/bin/gkno_launcher/resources/homo_sapiens/build_37_version_3/human_reference_v37_decoys.fa -CheckHash=$RDIR/cloud/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JELLYFISH="$RDIR/bin/jellyfish/bin/jellyfish" - - -if [ -s ./TempOverlap/$NameStub.sam.fastqd ] -then - echo "skipping sam assemble" -else - $gkno bwa-se -ps human -q $File -id $File -s $File -o $File.bam -p ILLUMINA - $OverlapSam <($samtools view -F 3328 $File.bam ) .95 50 5 ./TempOverlap/$NameStub.sam $NameStub 1 $Threads -fi -if [ -s ./TempOverlap/$NameStub.1.fastqd ] -then - echo "skipping first overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 50 2 FP 24 1 ./TempOverlap/$NameStub.1 1 $Threads #> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.2.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 50 2 FP 15 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.3.fastqd ] -then - echo "skippig replace" -else - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.2.fastqd > ./TempOverlap/$NameStub.3.fastqd -fi - -if [ -s ./TempOverlap/$NameStub.4.fastqd ] -then - echo "skipping overlap 4" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .98 30 0 ./TempOverlap/$NameStub.4 $NameStub 1 $Threads #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.5.fastqd ] -then - echo "skipping ovelrap 5" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.4.fastqd .98 30 $FinalCoverage ./TempOverlap/$NameStub.5 $NameStub 1 $Threads #>> $File.overlap.out -fi - -if [ -s ./$NameStub.overlap.hashcount.fastq ] -then - echo "skipping last overlap steps" -else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.5.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq $NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - - -#Done with Ooverlap -#get reference sequences -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - - $gkno bwa-se -ps human -q ./$NameStub.overlap.hashcount.fastq -id ./$NameStub.overlap.hashcount.fastq -s ./$NameStub.overlap.hashcount.fastq -o ./$NameStub.overlap.hashcount.fastq.bam -p ILLUMINA -fi - -~/bin/bedtools2/bin/fastaFromBed -bed <( ~/bin/bedtools2/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam ) -fi ~/d1/home/farrelac/RUFUS/bin/gkno_launcher/resources/homo_sapiens/current/human_reference_v37.fa > $NameStub.overlap.asembly.hash.fastq.ref.fastq - - - - -~/bin/bedtools2/bin/fastaFromBed -bed <( ~/bin/bedtools2/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam ) -fi ~/d1/home/farrelac/RUFUS/bin/gkno_launcher/resources/homo_sapiens/current/human_reference_v37.fa > $NameStub.overlap.asembly.hash.fastq.ref.fastq -$RDIR/bin/jellyfish/bin/jellyfish count -C -m 25 -s 1G -t 20 -o ./$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq -$RDIR/bin/jellyfish/bin/jellyfish count -C -m 25 -s 1G -t 20 -o ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq -$RDIR/bin/jellyfish/bin/jellyfish dump -c ./$NameStub.overlap.hashcount.fastq.Jhash > ./$NameStub.overlap.hashcount.fastq.Jhash.tab -$RDIR/bin/jellyfish/bin/jellyfish dump -c ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab - - -if [ -s $NameStub.overlap.asembly.hash.fastq.sample ] -then - echo "skipping $NameStub.overlap.asembly.hash.fastq.sample" -else - echo "doing that stuffnik" - bash $CheckHash $SampleJhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.sample -fi - -if [ -s $NameStub.overlap.asembly.hash.fastq.Ref.sample ] -then - echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.sample" -else - bash $CheckHash $SampleJhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.sample -fi - - - -mkfifo check -$samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000000 -sR $NameStub.overlap.asembly.hash.fastq.Ref.sample -s $NameStub.overlap.asembly.hash.fastq.sample - -grep ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -grep -v ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf | sort -k1,1 -k2,2n >> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/gkno_launcher/tools/tabix/bgzip -f ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/gkno_launcher/tools/tabix/tabix ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf.gz diff --git a/scripts/OverlapBashMultiThread.quad.sh b/scripts/OverlapBashMultiThread.quad.sh deleted file mode 100755 index ff5e7768..00000000 --- a/scripts/OverlapBashMultiThread.quad.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -File=$1 -FinalCoverage=$2 -NameStub=$3.V2 -HashList=$4 -HashSize=$5 -Threads=$6 - -SampleJhash=$7 -Parent1Jhash=$8 -Parent2Jhash=$9 -Parent3Jhash=$10 -Parent3Jhash=$11 - -echo " you gave -File=$1 -FinalCoverage=$2 -NameStub=$3.V2 -HashList=$4 -HashSize=$5 -Threads=$6 - -SampleJhash=$7 -Parent1Jhash=$8 -Parent2Jhash=$9 -Parent3Jhash=$10 -Parent3Jhash=$11 -" - -mkdir ./TempOverlap/ -echo "Overlaping $File" - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -gkno=$RDIR/bin/gkno_launcher/gkno -samtools=$RDIR/bin/gkno_launcher/tools/samtools/samtools -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -humanRef=$RDIR/bin/gkno_launcher/resources/homo_sapiens/build_37_version_3/human_reference_v37_decoys.fa -CheckHash=$RDIR/cloud/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam - - - - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - -if [ -s ./TempOverlap/$NameStub.sam.fastqd ] -then - echo "skipping sam assemble" -else - $gkno bwa-se -ps human -q $File -id $File -s $File -o $File.bam -p ILLUMINA - $OverlapSam <($samtools view $File.bam ) .95 50 5 ./TempOverlap/$NameStub.sam $NameStub 1 $Threads -fi -if [ -s ./TempOverlap/$NameStub.1.fastqd ] -then - echo "skipping first overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 50 2 FP 24 1 ./TempOverlap/$NameStub.1 1 $Threads #> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.2.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 50 2 FP 15 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out -fi -$ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.2.fastqd > ./TempOverlap/$NameStub.3.fastqd -if [ -s ./TempOverlap/$NameStub.4.fastqd ] -then - echo "skipping overlap 4" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .95 30 0 ./TempOverlap/$NameStub.4 $NameStub 1 $Threads #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.5.fastqd ] -then - echo "skipping ovelrap 5" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.4.fastqd .95 30 $FinalCoverage ./TempOverlap/$NameStub.5 $NameStub 1 $Threads #>> $File.overlap.out -fi - -if [ -s ./$NameStub.overlap.hashcount.fastq ] -then - echo "skipping final overlap work" -else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.5.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq $NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - - $gkno bwa-se -ps human -q ./$NameStub.overlap.hashcount.fastq -id ./$NameStub.overlap.hashcount.fastq -s ./$NameStub.overlap.hashcount.fastq -o ./$NameStub.overlap.hashcount.fastq.bam -p ILLUMINA -fi - - -$RDIR/bin/bedtools2/bin/fastaFromBed -bed <( $RDIR/bin/bedtools2/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam) -fi $RDIR/bin/gkno_launcher/resources/homo_sapiens/current/human_reference_v37.fa -fo $NameStub.overlap.asembly.hash.fastq.ref.fastq -$RDIR/bin/jellyfish/bin/jellyfish count -C -m $HashSize -s 1G -t 20 -o ./$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq -$RDIR/bin/jellyfish/bin/jellyfish count -C -m $HashSize -s 1G -t 20 -o ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq -$RDIR/bin/jellyfish/bin/jellyfish dump -c ./$NameStub.overlap.hashcount.fastq.Jhash > ./$NameStub.overlap.hashcount.fastq.Jhash.tab -$RDIR/bin/jellyfish/bin/jellyfish dump -c ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab - -if [ -s $NameStub.overlap.asembly.hash.fastq.p1 ] -then - echo "skipping hash lookup" -else - echo "stargin hash lookup" - bash $CheckHash $SampleJhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.sample - bash $CheckHash $Parent1Jhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.p1 - bash $CheckHash $Parent2Jhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.p2 - bash $CheckHash $Parent3Jhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.p3 - echo "done with hash lookup" -fi - - -if [ -s $NameStub.overlap.asembly.hash.fastq.Ref.sample ] -then - echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.sample" -else - bash $CheckHash $SampleJhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.sample - bash $CheckHash $Parent1Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.p1 - bash $CheckHash $Parent2Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.p2 - bash $CheckHash $Parent3Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.p3 - -fi - -wait - -mkfifo check -$samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000000 -c $NameStub.overlap.asembly.hash.fastq.p1 -c $NameStub.overlap.asembly.hash.fastq.p2 -cR $NameStub.overlap.asembly.hash.fastq.Ref.p1 -cR $NameStub.overlap.asembly.hash.fastq.Ref.p2 -sR $NameStub.overlap.asembly.hash.fastq.Ref.sample -s $NameStub.overlap.asembly.hash.fastq.sample - -grep ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -grep -v ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf | sort -k1,1 -k2,2n >> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/gkno_launcher/tools/tabix/bgzip -f ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/gkno_launcher/tools/tabix/tabix ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf.gz diff --git a/scripts/OverlapBashMultiThread.trio.save.sh b/scripts/OverlapBashMultiThread.trio.save.sh deleted file mode 100755 index 30da694f..00000000 --- a/scripts/OverlapBashMultiThread.trio.save.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/bash -File=$1 -FinalCoverage=$2 -NameStub=$3.V2 -HashList=$4 -HashSize=$5 -Threads=$6 - -SampleJhash=$7 -Parent1Jhash=$8 -Parent2Jhash=$9 -Parent3Jhash=$10 - -echo " you gave -File=$1 -FinalCoverage=$2 -NameStub=$3.V2 -HashList=$4 -HashSize=$5 -Threads=$6 - -SampleJhash=$7 -Parent1Jhash=$8 -Parent2Jhash=$9 -Parent3Jhash=$10 -" - -mkdir ./TempOverlap/ -echo "Overlaping $File" - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -gkno=$RDIR/bin/gkno_launcher/gkno -samtools=$RDIR/bin/gkno_launcher/tools/samtools/samtools -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -humanRef=$RDIR/bin/gkno_launcher/resources/homo_sapiens/build_37_version_3/human_reference_v37_decoys.fa -CheckHash=$RDIR/cloud/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam - - - - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - -if [ -s ./TempOverlap/$NameStub.sam.fastqd ] -then - echo "skipping sam assemble" -else - $gkno bwa-se -ps human -q $File -id $File -s $File -o $File.bam -p ILLUMINA - $OverlapSam <( $samtools view $File.bam ) .95 50 3 ./TempOverlap/$NameStub.sam $NameStub 1 $Threads -fi - -if [ -s ./TempOverlap/$NameStub.1.fastqd ] -then - echo "skipping first overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 50 2 FP 24 1 ./TempOverlap/$NameStub.1 1 $Threads #> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.2.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 50 2 FP 15 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out -fi -$ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.2.fastqd > ./TempOverlap/$NameStub.3.fastqd -if [ -s ./TempOverlap/$NameStub.4.fastqd ] -then - echo "skipping overlap 4" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .95 30 0 ./TempOverlap/$NameStub.4 $NameStub 1 $Threads #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.5.fastqd ] -then - echo "skipping ovelrap 5" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.4.fastqd .95 30 $FinalCoverage ./TempOverlap/$NameStub.5 $NameStub 1 $Threads #>> $File.overlap.out -fi - -if [ -s ./$NameStub.overlap.hashcount.fastq ] -then - echo "skipping final overlap work" -else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.5.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq $NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - - $gkno bwa-se -ps human -q ./$NameStub.overlap.hashcount.fastq -id ./$NameStub.overlap.hashcount.fastq -s ./$NameStub.overlap.hashcount.fastq -o ./$NameStub.overlap.hashcount.fastq.bam -p ILLUMINA -fi - -if [ -e $NameStub.overlap.asembly.hash.fastq.ref.fastq ] -then - echo "skipping pull reference sequecnes" -else - $RDIR/bin/bedtools2/bin/fastaFromBed -bed <( $RDIR/bin/bedtools2/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam) -fi $RDIR/bin/gkno_launcher/resources/homo_sapiens/current/human_reference_v37.fa -fo $NameStub.overlap.asembly.hash.fastq.ref.fastq -fi - -if [ -e ./$NameStub.overlap.hashcount.fastq.Jhash.tab ] -then - echo "skipping var hash generationr" -else - $RDIR/bin/jellyfish/bin/jellyfish count -C -m $HashSize -s 1G -t 20 -o ./$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq - $RDIR/bin/jellyfish/bin/jellyfish dump -c ./$NameStub.overlap.hashcount.fastq.Jhash > ./$NameStub.overlap.hashcount.fastq.Jhash.tab -fi - -if [ -e ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab ] -then - echo "skipping ref hash generation" -else - $RDIR/bin/jellyfish/bin/jellyfish count -C -m $HashSize -s 1G -t 20 -o ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq - $RDIR/bin/jellyfish/bin/jellyfish dump -c ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab -fi -if [ -s $NameStub.overlap.asembly.hash.fastq.p1 ] -then - echo "skipping hash lookup" -else - echo "stargin hash lookup" - bash $CheckHash $SampleJhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.sample - bash $CheckHash $Parent1Jhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.p1 - bash $CheckHash $Parent2Jhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.p2 - echo "done with hash lookup" -fi - - -if [ -s $NameStub.overlap.asembly.hash.fastq.Ref.sample ] -then - echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.sample" -else - bash $CheckHash $SampleJhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.sample - bash $CheckHash $Parent1Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.p1 - bash $CheckHash $Parent2Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.p2 - -fi - -wait - -mkfifo check -$samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mQ 8 -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000000 -c $NameStub.overlap.asembly.hash.fastq.p1 -c $NameStub.overlap.asembly.hash.fastq.p2 -cR $NameStub.overlap.asembly.hash.fastq.Ref.p1 -cR $NameStub.overlap.asembly.hash.fastq.Ref.p2 -sR $NameStub.overlap.asembly.hash.fastq.Ref.sample -s $NameStub.overlap.asembly.hash.fastq.sample - -grep ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -grep -v ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf | sort -k1,1 -k2,2n >> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/gkno_launcher/tools/tabix/bgzip -f ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/gkno_launcher/tools/tabix/tabix ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf.gz diff --git a/scripts/OverlapBashMultiThread.trio.sh b/scripts/OverlapBashMultiThread.trio.sh deleted file mode 100755 index c0dd93e7..00000000 --- a/scripts/OverlapBashMultiThread.trio.sh +++ /dev/null @@ -1,165 +0,0 @@ -#!/bin/bash -File=$1 -FinalCoverage=$2 -NameStub=$3.V2 -HashList=$4 -HashSize=$5 -Threads=$6 - -SampleJhash=$7 -Parent1Jhash=$8 -Parent2Jhash=$9 -Parent3Jhash=$10 - -echo " you gave -File=$1 -FinalCoverage=$2 -NameStub=$3.V2 -HashList=$4 -HashSize=$5 -Threads=$6 - -SampleJhash=$7 -Parent1Jhash=$8 -Parent2Jhash=$9 -Parent3Jhash=$10 -" - -mkdir ./TempOverlap/ -echo "Overlaping $File" - -RDIR=/scratch/ucgd/lustre/u0991464/RUFUS.simulation.test/testStricterOverlap/RUFUS - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -#gkno=$RDIR/bin/gkno_launcher/gkno -bwa=$RDIR/bin/bwa/bwa -#samtools=$RDIR/bin/gkno_launcher/tools/samtools/samtools -samtools=$RDIR/bin/samtools-1.6/samtools -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -humanRef=/scratch/ucgd/lustre/u0991464/build_37_version_3/human_reference_v37_decoys -CheckHash=$RDIR/cloud/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam -JellyFish=$RDIR//src/externals/jellyfish-2.2.5/bin/jellyfish - - - -#if [ -s $NameStub.overlap.hashcount.fastq ] -#then -# echo "Skipping Overlap" -#else - -if [ -s ./TempOverlap/$NameStub.sam.fastqd ] -then - echo "skipping sam assemble" -else - $bwa mem $humanRef $File | samtools sort -T $File -O bam - > $File.bam - $samtools index $File.bam - #$gkno bwa-se -ps human -q $File -id $File -s $File -o $File.bam -p ILLUMINA - $OverlapSam <( $samtools view $File.bam ) .95 75 3 ./TempOverlap/$NameStub.sam $NameStub 1 $Threads -fi - -if [ -s ./TempOverlap/$NameStub.1.fastqd ] -then - echo "skipping first overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 75 2 FP 24 1 ./TempOverlap/$NameStub.1 1 $Threads #> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.2.fastqd ] -then - echo "skipping second overlap" -else - time $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 50 2 FP 15 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out -fi -$ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.2.fastqd > ./TempOverlap/$NameStub.3.fastqd -if [ -s ./TempOverlap/$NameStub.4.fastqd ] -then - echo "skipping overlap 4" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .97 50 0 ./TempOverlap/$NameStub.4 $NameStub 1 $Threads #>> $File.overlap.out -fi -if [ -s ./TempOverlap/$NameStub.5.fastqd ] -then - echo "skipping ovelrap 5" -else - time $OverlapRebion2 ./TempOverlap/$NameStub.4.fastqd .97 50 $FinalCoverage ./TempOverlap/$NameStub.5 $NameStub 1 $Threads #>> $File.overlap.out -fi - -if [ -s ./$NameStub.overlap.hashcount.fastq ] -then - echo "skipping final overlap work" -else - - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.5.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq $NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq -fi - - -if [ -s ./$NameStub.overlap.hashcount.fastq.bam ] -then - echo "skipping contig alignment" -else - - $bwa mem -Y -E 9,9 -O 4,4 -d 500 -w 500 -L 10,10 $humanRef ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - #$bwa mem -Y $humanRef ./$NameStub.overlap.hashcount.fastq | samtools sort -T $File -O bam - > ./$NameStub.overlap.hashcount.fastq.bam - #$gkno bwa-se -ps human -q ./$NameStub.overlap.hashcount.fastq -id ./$NameStub.overlap.hashcount.fastq -s ./$NameStub.overlap.hashcount.fastq -o ./$NameStub.overlap.hashcount.fastq.bam -p ILLUMINA -fi - -if [ -e $NameStub.overlap.asembly.hash.fastq.ref.fastq ] -then - echo "skipping pull reference sequecnes" -else - $RDIR/bin/bedtools2/bin/fastaFromBed -bed <( $RDIR/bin/bedtools2/bin/bamToBed -i ./$NameStub.overlap.hashcount.fastq.bam) -fi $RDIR/bin/gkno_launcher/resources/homo_sapiens/current/human_reference_v37.fa -fo $NameStub.overlap.asembly.hash.fastq.ref.fastq -fi - -if [ -e ./$NameStub.overlap.hashcount.fastq.Jhash.tab ] -then - echo "skipping var hash generationr" -else - $JellyFish count -C -m $HashSize -s 1G -t 20 -o ./$NameStub.overlap.hashcount.fastq.Jhash ./$NameStub.overlap.hashcount.fastq - $JellyFish dump -c ./$NameStub.overlap.hashcount.fastq.Jhash > ./$NameStub.overlap.hashcount.fastq.Jhash.tab -fi - -if [ -e ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab ] -then - echo "skipping ref hash generation" -else - $JellyFish count -C -m $HashSize -s 1G -t 20 -o ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq - $JellyFish dump -c ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash > ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab -fi -if [ -s $NameStub.overlap.asembly.hash.fastq.p1 ] -then - echo "skipping hash lookup" -else - echo "stargin hash lookup" - bash $CheckHash $SampleJhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.sample - bash $CheckHash $Parent1Jhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.p1 - bash $CheckHash $Parent2Jhash ./$NameStub.overlap.hashcount.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.p2 - echo "done with hash lookup" -fi - - -if [ -s $NameStub.overlap.asembly.hash.fastq.Ref.sample ] -then - echo "skipping $NameStub.overlap.asembly.hash.fastq.Ref.sample" -else - bash $CheckHash $SampleJhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.sample - bash $CheckHash $Parent1Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.p1 - bash $CheckHash $Parent2Jhash ./$NameStub.overlap.asembly.hash.fastq.ref.fastq.Jhash.tab 0 > $NameStub.overlap.asembly.hash.fastq.Ref.p2 - -fi - -wait - -mkfifo check -$samtools index ./$NameStub.overlap.hashcount.fastq.bam -$samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -mod $NameStub.overlap.asembly.hash.fastq.sample -mQ 8 -r $humanRef.fa -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 1000000 -c $NameStub.overlap.asembly.hash.fastq.p1 -c $NameStub.overlap.asembly.hash.fastq.p2 -cR $NameStub.overlap.asembly.hash.fastq.Ref.p1 -cR $NameStub.overlap.asembly.hash.fastq.Ref.p2 -sR $NameStub.overlap.asembly.hash.fastq.Ref.sample -s $NameStub.overlap.asembly.hash.fastq.sample - -grep ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -grep -v ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf | sort -k1,1 -k2,2n >> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/tabix/bgzip -f ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/tabix/tabix ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf.gz diff --git a/scripts/PullKmerCountsFromSequence.pl b/scripts/PullKmerCountsFromSequence.pl deleted file mode 100755 index 177175d0..00000000 --- a/scripts/PullKmerCountsFromSequence.pl +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl - - -use strict; -my $kgJhash = "/scratch/ucgd/lustre/work/u0991464/RUFUS.1000g.reference/1000G.RUFUSreference.min45.Jhash"; -my $jellyfishPath="~/bin/RUFUS//bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish"; -my $string = $ARGV[0]; -my $HS = $ARGV[1]; -print "sequence\t$ARGV[2]\t"; -for (my $j = 3; $j < scalar(@ARGV); $j++) - {print "$ARGV[$j]\t";} - print "1kg\n"; - -for ( my $i = 0; $i < length($string) - $HS; $i++) -{ - - my $hash = substr($string, $i, $HS); - print "$hash\t"; - my $first = `$jellyfishPath query $ARGV[2] $hash`; - chomp $first; - my @temp1 = split / /, $first; - print "$temp1[1]\t"; - - for (my $j = 3; $j < scalar(@ARGV); $j++) - { - my $first = `$jellyfishPath query $ARGV[$j] $hash`; - chomp $first; - my @temp1 = split / /, $first; - print "$temp1[1]\t"; - } - - my $first = `$jellyfishPath query $kgJhash $hash`; - chomp $first; - my @temp1 = split / /, $first; - if ($temp1[1] eq 0){ - my $revcomp = reverse $hash; - $revcomp =~ tr/ATGCatgc/TACGtacg/; - $first = `$jellyfishPath query $kgJhash $revcomp`; - chomp $first; - @temp1 = split / /, $first; - } - print "$temp1[1]\t"; - print "\n"; -} -print "\n"; diff --git a/scripts/RemoveDuplicateCalls.pl b/scripts/RemoveDuplicateCalls.pl deleted file mode 100644 index 549a2b00..00000000 --- a/scripts/RemoveDuplicateCalls.pl +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/perl - - -use strict; - - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -my $l; -my @temp; -my $last = "first"; -while ($l = ) -{ - chomp($l); - @temp = split("\t", $l); - if ($temp[0] =~ /^#/) - { - print "$l\n"; - } - else - { - if ($last eq "first") - { - print "$l\n"; - } - else - { - my @lastTemp = split("\t", $last); - if ($lastTemp[0] eq $temp[0] && $lastTemp[1] eq $temp[1] && $lastTemp[2] eq $temp[2] && $lastTemp[3] eq $temp[3] && $lastTemp[4] eq $temp[4]) - { - ####I should do something better here, merge the calls or use the one with the higher value - } - else - { - print "$l\n"; - } - } - $last = $l; - } -} - - - diff --git a/scripts/RufusCreateModelPlot.DIST.R b/scripts/RufusCreateModelPlot.DIST.R deleted file mode 100644 index 70a52620..00000000 --- a/scripts/RufusCreateModelPlot.DIST.R +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env Rscript -args = commandArgs(trailingOnly=TRUE) -if (length(args)==0) { - stop("At least one argument must be supplied (input file).n", call.=FALSE) -} else if (length(args)==1) { - print(args[1]) -} - -library(ggplot2) -data <- read.table(args[1],header=FALSE, skip=6) -trans=0.8 -print(paste0(trimws(args[1]),".pdf")) -pdf(paste0(trimws(args[1]),".pdf"), width=6, height =2) -ggplot(data=data)+ - geom_line(aes(x=V1, y=V4), size=1, color = "black", alpha=trans)+ - geom_line(aes(x=V1, y=V5), size=1, color="red", alpha=trans)+ - geom_line(aes(x=V1, y=V6), color="green", alpha=trans)+ - geom_line(aes(x=V1, y=V7), color="#00008B", alpha=trans)+ - geom_line(aes(x=V1, y=V8), color="#0000CD", alpha=trans)+ - geom_line(aes(x=V1, y=V9), color="#0000FF", alpha=trans)+ - geom_line(aes(x=V1, y=V10), color="#4169E1", alpha=trans)+ - xlim(0,500)+ - xlab("Kmer depth")+ - ylab("Frequency") -dev.off() - diff --git a/scripts/RufusCreateModelPlot.R b/scripts/RufusCreateModelPlot.R deleted file mode 100644 index f372855b..00000000 --- a/scripts/RufusCreateModelPlot.R +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env Rscript -args = commandArgs(trailingOnly=TRUE) -if (length(args)==0) { - stop("At least one argument must be supplied (input file).n", call.=FALSE) -} else if (length(args)==1) { - print(args[1]) -} - -library(ggplot2) -data <- read.table(args[1],header=TRUE, skip=5) - - -myCon = file(description = args[1], open="r", blocking = TRUE) -min = as.numeric(readLines(myCon, n = 1)) # Read one line from the connection. -cutoff = as.numeric(readLines(myCon, n = 1) ) -genomesize = as.numeric(readLines(myCon, n = 1)) -diploid = as.numeric(readLines(myCon, n = 1)) -close(myCon) -#cutoff <- as.numeric(args[2]) -#diploid <-as.numeric(args[3]) -haploid <-diploid/2 -trans=0.8 -print(paste0(trimws(args[1]),".pdf")) -pdf(paste0(trimws(args[1]),".pdf"), width=6, height =2) -ggplot(data=data)+ - geom_line(aes(x=K, y=RawCount), size=1, color = "black", alpha=trans)+ - geom_line(aes(x=K, y=ModelSum), size=1, color="red", alpha=trans)+ - geom_line(aes(x=K, y=ErrorModel), color="yellow", alpha=trans)+ - geom_line(aes(x=K, y=X1x), color="green", alpha=trans)+ - geom_line(aes(x=K, y=X2x), color="#00008B", alpha=trans)+ - geom_line(aes(x=K, y=X3x), color="#0000CD", alpha=trans)+ - geom_line(aes(x=K, y=X4x), color="#0000FF", alpha=trans)+ - geom_line(aes(x=K, y=X5x), color="#4169E1", alpha=trans)+ - scale_y_log10(limits = c(1, max(data$RawCount)))+ - scale_x_continuous(limits=c(2,max(data$K)), breaks=seq(0,max(data$K), max(data$K)/10))+ - geom_vline(xintercept=cutoff, color="red", alpha=0.5)+ - geom_vline(xintercept=haploid, color="green", alpha=0.5)+ - geom_vline(xintercept=diploid, color="blue", alpha=0.5)+ - xlab("Kmer depth")+ - ylab("Frequency") -dev.off() - diff --git a/scripts/RunJellyForRUFUS.fq b/scripts/RunJellyForRUFUS.fq deleted file mode 100755 index 934772e6..00000000 --- a/scripts/RunJellyForRUFUS.fq +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -echo "ok lets do this" - -GEN=$1 -K=$2 -T=$3 -L=$4 -#T=10 - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS -JELLYFISH="$RDIR/bin/jellyfish/bin/jellyfish" -SORT="$RDIR/scripts/sort" - -#ulimit -v 3000000 -ulimit -v 100000000 -ulimit -a -if [ -e "$GEN.Jhash" ] -then - echo "Skipping jelly, $GEN.Jhash alreads exists" -else - - echo "here" - mkfifo $GEN.Jhash.temp - mkfifo $GEN.fq - /usr/bin/time -v $JELLYFISH count -C -m $K -L $L -s 100 -t $T -o $GEN.Jhash -g $GEN -G 20 - /usr/bin/time -v $JELLYFISH histo -f -o $GEN.Jhash.histo $GEN.Jhash - rm $GEN.Jhash.temp - rm $GEN.fq - -fi diff --git a/scripts/RunJellyForRUFUS.neoSeq.sh b/scripts/RunJellyForRUFUS.neoSeq.sh deleted file mode 100755 index 18ff8cf2..00000000 --- a/scripts/RunJellyForRUFUS.neoSeq.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -set -e -GEN=$1 -K=$2 -T=$3 -L=$4 - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -RDIR=$CDIR/../ - - -JELLYFISH="$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish" -SORT="$RDIR/scripts/sort" - -if [ -e "$GEN.Jhash" ] -then - echo "Skipping jelly, $GEN.Jhash alreads exists" -else - echo "Running jellyfish for $GEN" - /usr/bin/time -v $JELLYFISH count --disk -m $K -L $L -s 8G -t $T -o $GEN.Jhash -C -g $GEN.J -G 2 - wait -fi - -if [ ! -s $GEN.Jhash.histo ]; then - /usr/bin/time -v $JELLYFISH histo -f -o $GEN.Jhash.histo $GEN.Jhash -fi -if [ $(awk '$2 > 0' $GEN.Jhash.histo | wc -l ) -eq "0" ]; then - echo "ERROR: jellyfish failed on the file $GEN" - exit 100 -fi - - -exit diff --git a/scripts/RunJellyForRUFUS.sh b/scripts/RunJellyForRUFUS.sh index bb2ef877..208ebf98 100755 --- a/scripts/RunJellyForRUFUS.sh +++ b/scripts/RunJellyForRUFUS.sh @@ -1,45 +1,90 @@ -#!/bin/sh +#!/bin/bash set -e GEN=$1 K=$2 T=$3 L=$4 +HASH_SIZE=$5 -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -RDIR=$CDIR/../ - - +: "${RUFUS_ROOT:=/opt/RUFUS}" +RDIR="$RUFUS_ROOT" JELLYFISH="$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish" -SORT="$RDIR/scripts/sort" +trap 'rm -f "$FIFO_FQ"' EXIT + +# If we're using a region-specific hash, adjust size accordingly (1MB hashes made w/ 1G) if [ -e "$GEN.Jhash" ] then echo "Skipping jelly, $GEN.Jhash alreads exists" else - echo "Running jellyfish for $GEN" - if [ -e $GEN.Jhash.temp ]; then - rm $GEN.Jhash.temp - fi - mkfifo $GEN.Jhash.temp - if [ -e $GEN.fq ]; then - rm $GEN.fq + # Extra thread safety + PID=$$ + FIFO_FQ="${GEN}.fq.${PID}" + + rm -f "$FIFO_FQ" + mkfifo "$FIFO_FQ" + + # bash "$GEN" | "$RDIR/bin/PassThroughSamCheck" "$GEN.Jelly.chr" > "$FIFO_FQ" & + # samtools fastq validated bit-identical to PassThroughSamCheck for counting (job 16682513); generator now emits -h so the header is present. + bash "$GEN" | samtools fastq -@ "$T" - > "$FIFO_FQ" & + FEEDER=$! + + # -C is canonical ("Count both strand, canonical representation") + # -L is filtering out low frequency kmers ("Don't output k-mer with count < lower-count") + # For subject, we keep kmers with 2+ counts + # For controls, we keep kmers with 2+ counts OR the provided argument to rufus (_argParLowK) + # These arguments combined, I interpret this as keeping kmers with a single read + # --disk means hash will be written to disk if entire thing can't be held in memory + # -s (intial hash size) is G + Gcek (genome size * coverage * error * kmer length) ~228G for 300x, 22.8G for 30x, etc + # guessing this starting number is far too low and there's a lot of memory swapping happening here + # good area of parallelization and possible merging after - will neeed to think through + + # Capture jellyfish's status explicitly rather than letting `set -e` abort with it. + # Callers must be able to tell "the tool failed" (OOM, disk full, crash) apart from + # "this region legitimately has no k-mers" -- both otherwise leave an empty histogram + # and were previously indistinguishable. In a sharded whole-genome run that turns a + # lost shard into a silent "no variants here". See exit-code contract below. + set +e + "$JELLYFISH" count --disk -m "$K" -L "$L" -s "$HASH_SIZE" -t "$T" -o "$GEN.Jhash" -C "$FIFO_FQ" + jf_rc=$? + + if [ "$jf_rc" -ne 0 ]; then + # jellyfish is gone, so nothing is draining the FIFO and the feeder is blocked + # mid-write. Tear it down before reaping, or `wait` never returns. + rm -f "$FIFO_FQ" + kill "$FEEDER" 2>/dev/null + wait "$FEEDER" 2>/dev/null + set -e + echo "ERROR: jellyfish count failed (exit $jf_rc) for $GEN" >&2 + exit 2 fi - mkfifo $GEN.fq - bash $GEN | $RDIR/bin/PassThroughSamCheck $GEN.Jelly.chr > $GEN.fq & - $JELLYFISH count --disk -m $K -L $L -s 8G -t $T -o $GEN.Jhash -C $GEN.fq - rm $GEN.Jhash.temp - rm $GEN.fq wait -fi + set -e -if [ ! -s $GEN.Jhash.histo ]; then - $JELLYFISH histo -f -o $GEN.Jhash.histo $GEN.Jhash -fi -if [ $(awk '$2 > 0' $GEN.Jhash.histo | wc -l ) -eq "0" ]; then - echo "ERROR: jellyfish failed on the file $GEN" - exit 100 + # A zero exit with no output file means jellyfish died without reporting it. + if [ ! -s "$GEN.Jhash" ]; then + echo "ERROR: jellyfish count reported success but produced no $GEN.Jhash" >&2 + exit 2 + fi fi +if [ ! -s "$GEN.Jhash.histo" ]; then + set +e + "$JELLYFISH" histo -f -o "$GEN.Jhash.histo" "$GEN.Jhash" + histo_rc=$? + set -e + if [ "$histo_rc" -ne 0 ] || [ ! -s "$GEN.Jhash.histo" ]; then + echo "ERROR: jellyfish histo failed (exit $histo_rc) for $GEN" >&2 + exit 2 + fi +fi -exit +# Exit-code contract for callers (runRufus.sh check_empty_hashes depends on this): +# 0 - counted OK, k-mers found +# 1 - ran successfully, but the region genuinely contains no k-mers +# 2 - the counting tool itself failed; the result says nothing about coverage +if [ $(awk '$2 > 0' "$GEN.Jhash.histo" | wc -l ) -eq "0" ]; then + exit 1 +fi +exit 0 \ No newline at end of file diff --git a/scripts/RunJellyForSample.sh b/scripts/RunJellyForSample.sh deleted file mode 100644 index cf6f74d1..00000000 --- a/scripts/RunJellyForSample.sh +++ /dev/null @@ -1,44 +0,0 @@ -RDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -sample=$1 -k=$2 -Threads=$3 -Min=$4 -_arg_cramref=$5 - - sampleFileName=$(basename "$1") - echo "file name is" "$sampleFileName" - sampleExtension="${sampleFileName##*.}" - echo "file extension name is" "$sampleExtension" - - if [[ "$sampleExtension" != "cram" ]] && [[ "$sampleExtension" != "bam" ]] && [[ "$sampleExtension" != "generator" ]] - then - echo "The control bam/generator file" "$sample" " was not provided, or does not exist; killing run with non-zero exit status" - kill -9 $$ - elif [[ "$sampleExtension" == "bam" ]] - then - sampleGenerator="$sampleFileName".generator - ParentGenerators+=("$sampleGenerator") - echo "samtools view -F 3328 $sample" > "$sampleGenerator" - echo "You provided the control bam file" "$sample" - elif [[ "$sampleExtension" == "cram" ]] - then - sampleGenerator="$sampleFileName".generator - ParentGenerators+=("$sampleGenerator") - if [ "$_arg_cramref" == "" ] - then - echo "ERROR cram reference not provided for cram input"; - kill -9 $$ - fi - echo "samtools view -F 3328 -T $_arg_cramref $sample" > "$sampleGenerator" - echo "You provided the control cram file" "$sample" - elif [[ "$sampleExtension" = "generator" ]] - then - sampleGenerator="$sampleFileName" - ParentGenerators+=("$sampleGenerator") - echo "You provided the control bam file" "$sample" - fi - -RunJelly=$RDIR/RunJellyForRUFUS.sh - -bash $RunJelly $sampleGenerator $k $(echo $Threads -2 | bc) $Min diff --git a/scripts/RunRUFUS.1000G.2.sh b/scripts/RunRUFUS.1000G.2.sh deleted file mode 100755 index ca1b1144..00000000 --- a/scripts/RunRUFUS.1000G.2.sh +++ /dev/null @@ -1,95 +0,0 @@ -date -ProbandGenerator=$1 -K=$2 -Threads=$3 -Out=$4 -ReferenceHash=$5 -echo "You gave -ProbandGenerator=$1 -K=$2 -Threads=$3 -Out=$4 -ReferenceHash=$5 -" - -if [ -z "$ReferenceHash" ] -then - echo "out file not specified" - exit -fi - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.individual.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate -PullSampleHashes=$RDIR/cloud/CheckJellyHashList.sh -RUFUS1kgFilter=$RDIR/bin/RUFUS.1kg.filter -RunJelly=$RDIR/cloud/RunJellyForRUFUS - - - -/usr/bin/time -v bash $RunJelly $ProbandGenerator $K $(echo $Threads -2 | bc) 2 & -wait - -perl -ni -e 's/ /\t/;print' $ProbandGenerator.Jhash.histo -if [ -e "$ProbandGenerator.Jhash.histo.7.7.model" ] -then - echo "skipping model" -else - echo "staring model" - /usr/bin/time -v $RUFUSmodel $ProbandGenerator.Jhash.histo $K 150 $Threads - echo "done with model " -fi - -ParentMaxE=1 -MutantMinCov=$(head -2 $ProbandGenerator.Jhash.histo.7.7.model | tail -1 ) - -date -#echo "starting RUFUS build " -#let "Max= $MutantMinCov*100" -#if [ -e "$Out.Family.Unique.HashList" ] -#then -# echo "Skipping build" -#else -# /usr/bin/time -v $RDIR/cloud/jellyfish-MODIFIED-merge/bin/jellyfish merge $ProbandGenerator.Jhash $ReferenceHash> $Out.Family.Unique.HashList -#fi - -echo "Mut cov = $MutantMinCov " -if [ -e $ProbandGenerator.k$K_c$MutantMinCov.HashList ] -then - echo "skipping $ProbandGenerator.HashList pull " -else - /usr/bin/time -v bash $PullSampleHashes $ProbandGenerator.Jhash <($RDIR/cloud/jellyfish-MODIFIED-merge/bin/jellyfish merge $ProbandGenerator.Jhash $ReferenceHash) $MutantMinCov > $ProbandGenerator.k$K_c$MutantMinCov.HashList -fi - - -echo "done with RUFUS build " - -echo "startin RUFUS filter" -if [ -e $ProbandGenerator.Mutations.fastq ] -then - echo "skipping filter" -else - rm $ProbandGenerator.temp - mkfifo $ProbandGenerator.temp - /usr/bin/time -v bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck $ProbandGenerator.filter.chr > $ProbandGenerator.temp & - /usr/bin/time -v $RUFUSfilter $ProbandGenerator.k$K_c$MutantMinCov.HashList $ProbandGenerator.temp $ProbandGenerator $K 5 5 10 $(echo $Threads -2 | bc) & - wait - -fi - -if [ -e $ProbandGenerator.V2.overlap.hashcount.fastq.bam.vcf ] -then - echo "skipping overlap" -else - echo "startin RUFUS overlap" - /usr/bin/time -v bash $RUFUSOverlap $ProbandGenerator.Mutations.fastq 5 $ProbandGenerator $ProbandGenerator.k$MutantMinCov.HashList $Threads $ProbandGenerator.Jhash -fi - -echo "done with everything " -#rm *Jhash -#rm *.tab - - diff --git a/scripts/RunRUFUS.1000G.sh b/scripts/RunRUFUS.1000G.sh deleted file mode 100755 index 68c55e1a..00000000 --- a/scripts/RunRUFUS.1000G.sh +++ /dev/null @@ -1,97 +0,0 @@ -ProbandGenerator=$1 -K=$2 -Threads=$3 -Out=$4 -RUF1kGReff=$5 - -echo "You gave -ProbandGenerator=$1 -K=$2 -Threads=$3 -Out=$4 -RUF1kGReff=$5" - -if [ -z "$RUF1kGReff" ] -then - echo "RUFUS 1000G reference file not specified file not specified" - exit -fi - - - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -RDIR=$CDIR/../ -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.individual.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate -PullSampleHashes=$RDIR/scripts/CheckJellyHashList.sh -RUFUS1kgFilter=$RDIR/bin/RUFUS.1kg.filter -RunJelly=$RDIR/scripts/RunJellyForRUFUS.sh - - -if [ -s $ProbandGenerator.Jhash.sorted.min2.tab ] -then - echo "skipping jelly " -else - - #mkfifo $ProbandGenerator.temp - #/usr/bin/time -v bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck $ProbandGenerator.filter.chr > $ProbandGenerator.temp & - /usr/bin/time -v bash $RunJelly $ProbandGenerator $K $(echo $Threads -2 | bc) 2 - rm $ProbandGenerator.temp -fi - - -perl -ni -e 's/ /\t/;print' $ProbandGenerator.Jhash.histo -if [ -e $ProbandGenerator.Jhash.histo.7.7.model ] -then - echo "skipping model" -else - echo "staring model" - /usr/bin/time -v $RUFUSmodel $ProbandGenerator.Jhash.histo $K 150 $Threads - echo "done with model " -fi - -ParentMaxE=1 -MutantMinCov=$(head -2 $ProbandGenerator.Jhash.histo.7.7.model | tail -1 ) - -date -echo "starting RUFUS build " -let "Max= $MutantMinCov*100" -if [ -s $ProbandGenerator.k$MutantMinCov.HashList ] -then - echo "Skipping build" -else - /usr/bin/time -v $RUFUSbuild -c $RUF1kGReff -s $ProbandGenerator.Jhash.sorted.min2.tab -o $ProbandGenerator.k$MutantMinCov.HashList -hs $K -mS $MutantMinCov -max 300 -t $Threads -d ' ' -mC 0 - -fi - -echo "starting RUFUS filter" -if [ -s $ProbandGenerator.Mutations.fastq ] -then - echo "skipping filter" -else - rm $ProbandGenerator.temp - mkfifo $ProbandGenerator.temp - #/usr/bin/time -v bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck $ProbandGenerator.filter.chr > $ProbandGenerator.temp & - /usr/bin/time -v bash $ProbandGenerator > $ProbandGenerator.temp & - /usr/bin/time -v $RUFUSfilter $ProbandGenerator.k$MutantMinCov.HashList $ProbandGenerator.temp $ProbandGenerator $K 5 5 10 $(echo $Threads -2 | bc) & - wait - -fi - - -if [ -e $ProbandGenerator.V2.overlap.hashcount.fastq.bam.vcf ] -then - echo "skipping overlap" -else - echo "startin RUFUS overlap" - /usr/bin/time -v bash $RUFUSOverlap $ProbandGenerator.Mutations.fastq 5 $ProbandGenerator $ProbandGenerator.k$MutantMinCov.HashList $Threads $ProbandGenerator.Jhash -fi - -echo "done with everything " - - - -s diff --git a/scripts/RunRUFUS.Quad.sh b/scripts/RunRUFUS.Quad.sh deleted file mode 100755 index babea713..00000000 --- a/scripts/RunRUFUS.Quad.sh +++ /dev/null @@ -1,106 +0,0 @@ -date -Parent1Generator=$1 -Parent2Generator=$2 -Parent3Generator=$3 -ProbandGenerator=$4 -K=$5 -Threads=$6 -Out=$7 - -echo "You gave -Parent1Generator=$1 -Parent2Generator=$2 -Parent3Generator=$3 -ProbandGenerator=$4 -K=$5 -Threads=$6 -Out=$7" - -if [ -z "$Out" ] -then - echo "out file not specified" - exit -fi - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.trio.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate -PullSampleHashes=$RDIR/cloud/CheckJellyHashList.sh -RUFUS1kgFilter=$RDIR/bin/RUFUS.1kg.filter -RunJelly=$RDIR/cloud/RunJellyForRUFUS - - - - -/usr/bin/time -v bash $RunJelly $Parent1Generator $K $(echo $Threads -2 | bc) 2 & -/usr/bin/time -v bash $RunJelly $Parent2Generator $K $(echo $Threads -2 | bc) 2 & -/usr/bin/time -v bash $RunJelly $Parent3Generator $K $(echo $Threads -2 | bc) 2 & -/usr/bin/time -v bash $RunJelly $ProbandGenerator $K $(echo $Threads -2 | bc) 2 & -wait - -perl -ni -e 's/ /\t/;print' $ProbandGenerator.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent1Generator.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent2Generator.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent3Generator.Jhash.histo -if [ -e "$ProbandGenerator.Jhash.histo.7.7.model" ] -then - echo "skipping model" -else - echo "staring model" - /usr/bin/time -v $RUFUSmodel $ProbandGenerator.Jhash.histo $K 150 $Threads - echo "done with model " -fi - -ParentMaxE=1 -MutantMinCov=$(head -2 $ProbandGenerator.Jhash.histo.7.7.model | tail -1 ) - -date -echo "starting RUFUS build " -let "Max= $MutantMinCov*100" -if [ -e "$Out.Family.Unique.HashList" ] -then - echo "Skipping build" -else - /usr/bin/time -v $RDIR/cloud/jellyfish-MODIFIED-merge/bin/jellyfish merge $Parent1Generator.Jhash $Parent2Generator.Jhash $Parent3Generator.Jhash $ProbandGenerator.Jhash > $Out.Family.Unique.HashList -fi - -echo "Mut cov = $MutantMinCov " -if [ -e $ProbandGenerator.k$K_c$MutantMinCov.HashList ] -then - echo "skipping $ProbandGenerator.HashList pull " -else - /usr/bin/time -v bash $PullSampleHashes $ProbandGenerator.Jhash $Out.Family.Unique.HashList $MutantMinCov > $ProbandGenerator.k$K_c$MutantMinCov.HashList -fi - - -echo "done with RUFUS build " - -echo "startin RUFUS filter" -if [ -e $ProbandGenerator.Mutations.fastq ] -then - echo "skipping filter" -else - rm $ProbandGenerator.temp - mkfifo $ProbandGenerator.temp - /usr/bin/time -v bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck $ProbandGenerator.filter.chr > $ProbandGenerator.temp & - /usr/bin/time -v $RUFUSfilter $ProbandGenerator.k$K_c$MutantMinCov.HashList $ProbandGenerator.temp $ProbandGenerator $K 5 5 10 $(echo $Threads -2 | bc) & - wait - -fi - -if [ -e $ProbandGenerator.V2.overlap.hashcount.fastq.bam.vcf ] -then - echo "skipping overlap" -else - echo "startin RUFUS overlap" - /usr/bin/time -v bash $RUFUSOverlap $ProbandGenerator.Mutations.fastq 5 $ProbandGenerator $ProbandGenerator.k$MutantMinCov.HashList $K $Threads $ProbandGenerator.Jhash $Parent1Generator.Jhash $Parent2Generator.Jhash $Parent3Generator.Jhash -fi - -echo "done with everything " -#rm *Jhash -#rm *.tab - - diff --git a/scripts/RunRUFUS.Trio.sh b/scripts/RunRUFUS.Trio.sh deleted file mode 100755 index cba5c0a3..00000000 --- a/scripts/RunRUFUS.Trio.sh +++ /dev/null @@ -1,104 +0,0 @@ -date -Parent1Generator=$1 -Parent2Generator=$2 -ProbandGenerator=$3 -K=$4 -Threads=$5 -Out=$6 - -echo "You gave -Parent1Generator=$1 -Parent2Generator=$2 -ProbandGenerator=$3 -K=$4 -Threads=$5 -Out=$6 -" - -if [ -z "$Out" ] -then - echo "out file not specified" - exit -fi - -RDIR=/scratch/ucgd/lustre/u0991464/RUFUS.simulation.test/testStricterOverlap/RUFUS -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.trio.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate -PullSampleHashes=$RDIR/cloud/CheckJellyHashList.sh -RUFUS1kgFilter=$RDIR/bin/RUFUS.1kg.filter -RunJelly=$RDIR/cloud/RunJellyForRUFUS - - -module load samtools - -/usr/bin/time -v bash $RunJelly $Parent1Generator $K $(echo $Threads -2 | bc) 2 & -/usr/bin/time -v bash $RunJelly $Parent2Generator $K $(echo $Threads -2 | bc) 2 & -/usr/bin/time -v bash $RunJelly $ProbandGenerator $K $(echo $Threads -2 | bc) 2 & -wait -perl -ni -e 's/ /\t/;print' $ProbandGenerator.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent1Generator.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent2Generator.Jhash.histo -if [ -s "$ProbandGenerator.Jhash.histo.7.7.model" ] -then - echo "skipping model" -else - echo "staring model" - /usr/bin/time -v $RUFUSmodel $ProbandGenerator.Jhash.histo $K 150 $Threads - echo "done with model " -fi - -ParentMaxE=1 -MutantMinCov=$(head -2 $ProbandGenerator.Jhash.histo.7.7.model | tail -1 ) -date -echo "starting RUFUS build " -let "Max= $MutantMinCov*100" -if [ -s "$Out.Family.Unique.HashList" ] -then - echo "Skipping build" -else - /usr/bin/time -v $RDIR/cloud/jellyfish-MODIFIED-merge/bin/jellyfish merge $Parent1Generator.Jhash $Parent2Generator.Jhash $ProbandGenerator.Jhash > $Out.Family.Unique.HashList -fi - -echo "Mut cov = $MutantMinCov " -if [ -s $ProbandGenerator.k$K_c$MutantMinCov.HashList ] -then - echo "skipping $ProbandGenerator.HashList pull " -else - /usr/bin/time -v bash $PullSampleHashes $ProbandGenerator.Jhash $Out.Family.Unique.HashList $MutantMinCov > $ProbandGenerator.k$K_c$MutantMinCov.HashList -fi - - -echo "done with RUFUS build " - -echo "startin RUFUS filter" -if [ -s $ProbandGenerator.Mutations.fastq ] && [ $(tail -n 1 $ProbandGenerator.filter.chr ) = "booya" ] -then - echo "skipping filter" -else - echo "filtering" - rm $ProbandGenerator.temp - mkfifo $ProbandGenerator.temp - #/usr/bin/time -v bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck.stranded $ProbandGenerator.filter.chr > $ProbandGenerator.temp & - #/usr/bin/time -v $RUFUSfilter $ProbandGenerator.k$K_c$MutantMinCov.HashList $ProbandGenerator.temp $ProbandGenerator $K 5 5 10 $(echo $Threads -2 | bc) & - #bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck.stranded $ProbandGenerator.filter.chr | head - - /usr/bin/time -v $RUFUSfilter $ProbandGenerator.k$K_c$MutantMinCov.HashList <(bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck.stranded $ProbandGenerator.filter.chr) $ProbandGenerator $K 5 5 10 $(echo $Threads -2 | bc) - -fi - -if [ -e $ProbandGenerator.V2.overlap.hashcount.fastq.bam.vcf ] -then - echo "skipping overlap" -else - echo "startin RUFUS overlap" - /usr/bin/time -v bash $RUFUSOverlap $ProbandGenerator.Mutations.fastq 5 $ProbandGenerator $ProbandGenerator.k$MutantMinCov.HashList $K $Threads $ProbandGenerator.Jhash $Parent1Generator.Jhash $Parent2Generator.Jhash -fi - -echo "done with everything " -#rm *Jhash -#rm *.tab - - diff --git a/scripts/RunRUFUS.Trio.with.1000Gfilter.sh b/scripts/RunRUFUS.Trio.with.1000Gfilter.sh deleted file mode 100755 index 378dbcff..00000000 --- a/scripts/RunRUFUS.Trio.with.1000Gfilter.sh +++ /dev/null @@ -1,111 +0,0 @@ -date -Parent1Generator=$1 -Parent2Generator=$2 -ProbandGenerator=$3 -K=$4 -Threads=$5 -Out=$6 -RUF1kGReff=$7 - -echo "You gave -Parent1Generator=$1 -Parent2Generator=$2 -ProbandGenerator=$3 -K=$4 -Threads=$5 -Out=$6 -RUF1kGReff=$7 -" - -if [ -z "$RUF1kGReff" ] -then - echo "RUFUS 1000G reff file not specified" - exit -fi - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.trio.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate -PullSampleHashes=$RDIR/cloud/CheckJellyHashList.sh -RUFUS1kgFilter=$RDIR/bin/RUFUS.1kg.filter -RunJelly=$RDIR/cloud/RunJellyForRUFUS.UGP - - - -/usr/bin/time -v bash $RunJelly $Parent1Generator $K $(echo $Threads -2 | bc) 2 -/usr/bin/time -v bash $RunJelly $Parent2Generator $K $(echo $Threads -2 | bc) 2 -/usr/bin/time -v bash $RunJelly $ProbandGenerator $K $(echo $Threads -2 | bc) 2 - -perl -ni -e 's/ /\t/;print' $ProbandGenerator.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent1Generator.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent2Generator.Jhash.histo - -if [ -e "$ProbandGenerator.Jhash.histo.7.7.model" ] -then - echo "skipping model" -else - echo "staring model" - /usr/bin/time -v $RUFUSmodel $ProbandGenerator.Jhash.histo $K 150 $Threads - echo "done with model " -fi - -ParentMaxE=0 -MutantMinCov=$(head -2 $ProbandGenerator.Jhash.histo.7.7.model | tail -1 ) - -date -echo "starting RUFUS build " -let "Max= $MutantMinCov*100" -if [ -s "Family.Unique.HashList" ] -then - echo "Skipping build" -else - /usr/bin/time -v $RDIR/cloud/jellyfish-MODIFIED-merge/bin/jellyfish merge $Parent1Generator.Jhash $Parent2Generator.Jhash $ProbandGenerator.Jhash > Family.Unique.HashList -fi - -echo "Mut cov = $MutantMinCov " -if [ -s $ProbandGenerator.k$K_c$MutantMinCov.HashList.prefilter ] -then - echo "skipping $ProbandGenerator.HashList pull " -else - /usr/bin/time -v bash $PullSampleHashes $ProbandGenerator.Jhash Family.Unique.HashList $MutantMinCov > $ProbandGenerator.k$K_c$MutantMinCov.HashList.prefilter -fi - -if [ -s $ProbandGenerator.k$K_c$MutantMinCov.HashList ] -then - echo "skipping 1kg filter" -else - /usr/bin/time -v $RDIR/cloud/RUFUS.search.1kg -hf <(awk '{print $1 "\t" $2}' $ProbandGenerator.k$K_c$MutantMinCov.HashList.prefilter ) -o $ProbandGenerator.k$K_c$MutantMinCov.HashList -c $RUF1kGReff -hs 25 -fi - -echo "done with RUFUS build " - -echo "startin RUFUS filter" -if [ -s $ProbandGenerator.Mutations.fastq ] -then - echo "skipping filter" -else -echo "crap" - rm $ProbandGenerator.temp - mkfifo $ProbandGenerator.temp - /usr/bin/time -v bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck $ProbandGenerator.filter.chr > $ProbandGenerator.temp & - /usr/bin/time -v $RUFUSfilter $ProbandGenerator.k$K_c$MutantMinCov.HashList $ProbandGenerator.temp $ProbandGenerator $K 5 5 10 $(echo $Threads -2 | bc) & - wait - -fi - -if [ -e $ProbandGenerator.V2.overlap.hashcount.fastq.bam.vcf ] -then - echo "skipping overlap" -else - echo "startin RUFUS overlap" - /usr/bin/time -v bash $RUFUSOverlap $ProbandGenerator.Mutations.fastq 5 $ProbandGenerator $ProbandGenerator.k$MutantMinCov.HashList $Threads $ProbandGenerator.Jhash $Parent1Generator.Jhash $Parent2Generator.Jhash -fi - - -echo "done with everything " - - - diff --git a/scripts/RunRUFUS.Tumor.sh b/scripts/RunRUFUS.Tumor.sh deleted file mode 100755 index 07586157..00000000 --- a/scripts/RunRUFUS.Tumor.sh +++ /dev/null @@ -1,99 +0,0 @@ -date -Parent1Generator=$1 -ProbandGenerator=$2 -K=$3 -Threads=$4 -Out=$5 - -echo "You gave -Parent1Generator=$1 -ProbandGenerator=$2 -K=$3 -Threads=$4 -Out=$5 -" - -if [ -z "$Out" ] -then - echo "out file not specified" - exit -fi - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.trio.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate -PullSampleHashes=$RDIR/cloud/CheckJellyHashList.sh -RUFUS1kgFilter=$RDIR/bin/RUFUS.1kg.filter -RunJelly=$RDIR/scripts/RunJellyForRUFUS.fq - - - - -/usr/bin/time -v bash $RunJelly $Parent1Generator $K $(echo $Threads -2 | bc) 4 & -/usr/bin/time -v bash $RunJelly $ProbandGenerator $K $(echo $Threads -2 | bc) 4 & -wait - -perl -ni -e 's/ /\t/;print' $ProbandGenerator.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent2Generator.Jhash.histo -if [ -e "$ProbandGenerator.Jhash.histo.7.7.model" ] -then - echo "skipping model" -else - echo "staring model" - /usr/bin/time -v $RUFUSmodel $ProbandGenerator.Jhash.histo $K 150 $Threads & - echo "done with model " -fi - -ParentMaxE=1 -#MutantMinCov=$(head -2 $ProbandGenerator.Jhash.histo.7.7.model | tail -1 ) -MutantMinCov=5 -date -echo "starting RUFUS build " -let "Max= $MutantMinCov*500" -if [ -e "$Out.Family.Unique.HashList" ] -then - echo "Skipping build" -else - /usr/bin/time -v $RDIR/cloud/jellyfish-MODIFIED-merge/bin/jellyfish merge $Parent1Generator.Jhash $ProbandGenerator.Jhash > $Out.Family.Unique.HashList -fi - -echo "Mut cov = $MutantMinCov " -if [ -e $ProbandGenerator.k$K_c$MutantMinCov.HashList ] -then - echo "skipping $ProbandGenerator.HashList pull " -else - /usr/bin/time -v bash $PullSampleHashes $ProbandGenerator.Jhash $Out.Family.Unique.HashList $MutantMinCov > $ProbandGenerator.k$K_c$MutantMinCov.HashList -fi - - -echo "done with RUFUS build " - -echo "startin RUFUS filter" -if [ -e $ProbandGenerator.Mutations.fastq ] -then - echo "skipping filter" -else - rm $ProbandGenerator.temp - mkfifo $ProbandGenerator.temp - /usr/bin/time -v bash $ProbandGenerator > $ProbandGenerator.temp & - /usr/bin/time -v $RUFUSfilter $ProbandGenerator.k$K_c$MutantMinCov.HashList $ProbandGenerator.temp $ProbandGenerator $K 5 5 10 $(echo $Threads -2 | bc) & - wait - -fi - -if [ -e $ProbandGenerator.V2.overlap.hashcount.fastq.bam.vcf.runanyway ] -then - echo "skipping overlap" -else - echo "startin RUFUS overlap" - /usr/bin/time -v bash $RUFUSOverlap $ProbandGenerator.Mutations.fastq 5 $ProbandGenerator $ProbandGenerator.k$MutantMinCov.HashList $Threads $ProbandGenerator.Jhash $Parent1Generator.Jhash -fi - -echo "done with everything " -#rm *Jhash -#rm *.tab - - diff --git a/scripts/RunSVcheck.sh b/scripts/RunSVcheck.sh deleted file mode 100644 index 2f31680c..00000000 --- a/scripts/RunSVcheck.sh +++ /dev/null @@ -1,9 +0,0 @@ -RDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - - -#call is FINAL.vcf.gz .gff3 -perl $RDIR/VCFtoSVbed.pl <(zcat $1) > $1.SV.bed - -bedtools intersect -a $1.SV.bed -b $2 -wb > $1.intersect.out - -bash $RDIR/processGFFintersect.sh $1.intersect.out diff --git a/scripts/SamToFastq.pl b/scripts/SamToFastq.pl deleted file mode 100755 index 2244de71..00000000 --- a/scripts/SamToFastq.pl +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/perl - - -use strict; - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - - -my @temp; -my $l1; -my $counter = 0; -while ($l1 = <>) -{ - @temp = split(/\t/, $l1); - $counter = $counter+1; - if (length($temp[9] > 25)) - { - print "\@$temp[0]\n"; - print "$temp[9]\n"; - print "+\n"; - print "$temp[10]\n"; - } - -} -#Call should be GFFfile, FastaReff, SNPFilePath - diff --git a/scripts/VCF.qual_dist.BIG.pl b/scripts/VCF.qual_dist.BIG.pl deleted file mode 100755 index 9ddbc14a..00000000 --- a/scripts/VCF.qual_dist.BIG.pl +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/perl - - -use strict; - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -open (Fastq , $ARGV[0]) || die "ERROR could not open sam file"; - -my $l1 = ""; -my @temp; -my @scores; -for (my $i = 0; $i < 30; $i ++) -{ - $scores[$i] = 0; -} -my $counter = 0; -while ($l1 = ) -{ - - if (substr ( $l1, 1, 1) eq "#") - {} - else - { - - @temp = split("\t", $l1); - $scores[$temp[5]]++; # = $scores[$temp[6]] +1; - } - - - -} -for (my $i = 0; $i < 40; $i ++) -{ - print "$i; "; - for (my $j = 0; $j < $scores[$i]; $j+=100) - { - print "+"; - } - print "; $scores[$i] \n"; -} -#Call should be GFFfile, FastaReff, SNPFilePath - diff --git a/scripts/VCF.qual_dist.pl b/scripts/VCF.qual_dist.pl deleted file mode 100755 index ee5c9a37..00000000 --- a/scripts/VCF.qual_dist.pl +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/perl - - -use strict; - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -open (Fastq , $ARGV[0]) || die "ERROR could not open sam file"; - -my $l1 = ""; -my @temp; -my @scores; -for (my $i = 0; $i < 30; $i ++) -{ - $scores[$i] = 0; -} -my $counter = 0; -while ($l1 = ) -{ - - if (substr ( $l1, 1, 1) eq "#") - {} - else - { - - @temp = split("\t", $l1); - $scores[$temp[5]]++; # = $scores[$temp[6]] +1; - } - - - -} -for (my $i = 0; $i < 40; $i ++) -{ - print "$i; "; - for (my $j = 0; $j < $scores[$i]; $j++) - { - print "+"; - } - print "; $scores[$i] \n"; -} -print "~~~~~~~~~\n"; -for (my $i = 30; $i < 10000; $i ++) -{ - if ( $scores[$i] > 0) - { - print "$i; "; - for (my $j = 0; $j < $scores[$i]; $j++) - { - print "+"; - } - print "; $scores[$i] \n"; - } -} -#Call should be GFFfile, FastaReff, SNPFilePath - diff --git a/scripts/VCFtoSVbed.pl b/scripts/VCFtoSVbed.pl deleted file mode 100755 index 4a0614c4..00000000 --- a/scripts/VCFtoSVbed.pl +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/perl - - -use strict; - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -open (Fastq , $ARGV[0]) || die "ERROR could not open sam file"; - -my $l1 = ""; -my $counter = 0; -while ($l1 = ) -{ - - if (substr ( $l1, 1, 1) eq "#") - {} - else - { - - my @temp = split("\t", $l1); - my @info = split(";", $temp[7]); - $temp[0] =~ s/chr//; - if ($temp[4] =~/\ 50) - { - my $start = $temp[1] - 1; - if ( $temp[2] =~ /Y/ ) - { - $start = $start - length($temp[4]); - } - - my $end = $temp[1] - 1 + length($temp[3]); - print "$temp[0] $start $end $temp[2]-$temp[5]\n"; - } - } - - - -} -#Call should be GFFfile, FastaReff, SNPFilePath - diff --git a/scripts/VilterAutosomeOnly.AllCalls b/scripts/VilterAutosomeOnly.AllCalls deleted file mode 100644 index 854531bd..00000000 --- a/scripts/VilterAutosomeOnly.AllCalls +++ /dev/null @@ -1,3 +0,0 @@ -egrep '^#' $1 -egrep '^1|^2|^3|^4|^5|^6|^7|^8|^9|^X|^Y|^chr1|^chr2|^chr3|^chr4|^chr5|^chr6|^chr7|^chr8|^chr9|^chrX|^chrY' $1 - diff --git a/scripts/VilterAutosomeOnly.wMosaic.nosb b/scripts/VilterAutosomeOnly.wMosaic.nosb deleted file mode 100644 index d47705e5..00000000 --- a/scripts/VilterAutosomeOnly.wMosaic.nosb +++ /dev/null @@ -1,3 +0,0 @@ -egrep '^#' $1 -egrep '^1|^2|^3|^4|^5|^6|^7|^8|^9|^X|^Y|^chr1|^chr2|^chr3|^chr4|^chr5|^chr6|^chr7|^chr8|^chr9|^chrX|^chrY' $1 | awk '$7 ~/PASS/ || $3~/Mosaic/ || $7=="SB;"' - diff --git a/scripts/ci/check_doc_versions.sh b/scripts/ci/check_doc_versions.sh new file mode 100755 index 00000000..f2358a61 --- /dev/null +++ b/scripts/ci/check_doc_versions.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# Keep the version strings that must appear literally in the docs in step with +# resources/globals.txt. +# +# check_doc_versions.sh verify (exit 1 on drift) -- this is what CI runs +# check_doc_versions.sh --write rewrite the managed spots to match globals.txt +# +# Most places that need the version can just derive it (docs/publish_new_sif.md reads +# globals.txt inline, and the workflow extracts it the same way). Only user-facing text +# that is read outside a checkout -- i.e. README.md -- has to carry a literal, so only +# those spots are managed here. Each rule is an explicit anchor plus the expected +# rendering, so this can never false-positive on a deliberate historical reference to an +# older version. +# +# The README's *download instructions* no longer carry a version at all: the Docker Hub +# route pulls :latest (or a version the reader chooses), and the Zenodo route asks the API +# which file to fetch from the concept record. Both are drift-free by construction, so the +# only literal left is the human-readable tagline. Note that a stable Zenodo asset name +# would NOT have been sufficient on its own -- Zenodo 404s on /records//files/..., +# because it redirects the record endpoint but not paths beneath it, so the version-specific +# record id is unavoidable in a hand-built URL. Hence the API lookup. + +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/../.." + +GLOBALS="resources/globals.txt" +[ -r "$GLOBALS" ] || { echo "ERROR: cannot read $GLOBALS" >&2; exit 1; } + +# Same extraction the workflow's release guard uses -- keep these identical. +VERSION=$(grep -E '^RUFUS_VERSION=' "$GLOBALS" | cut -d'"' -f2) +[ -n "$VERSION" ] || { echo "ERROR: RUFUS_VERSION not found or empty in $GLOBALS" >&2; exit 1; } + +MODE="${1:-check}" +case "$MODE" in + ""|check) MODE=check ;; + --write) MODE=write ;; + *) echo "usage: $0 [--write]" >&2; exit 1 ;; +esac + +status=0 + +# check_rule +# anchor-regex selects exactly the line(s) this rule owns +# expected-line what that line must look like once correct +# sed-subst how --write repairs it +check_rule() { + local file="$1" anchor="$2" expected="$3" subst="$4" + local found + found=$(grep -nE "$anchor" "$file" || true) + + if [ -z "$found" ]; then + echo " FAIL $file: no line matching /$anchor/ -- the doc was restructured, update this rule" >&2 + status=1 + return + fi + + if [ "$(printf '%s\n' "$found" | wc -l)" -ne 1 ]; then + echo " FAIL $file: /$anchor/ matched more than one line; the rule is ambiguous" >&2 + printf '%s\n' "$found" | sed 's/^/ /' >&2 + status=1 + return + fi + + local line="${found#*:}" + if [ "$line" = "$expected" ]; then + echo " ok $file: $expected" + return + fi + + if [ "$MODE" = write ]; then + sed -i "$subst" "$file" + echo " wrote $file: $line -> $expected" + else + echo " FAIL $file" >&2 + echo " have: $line" >&2 + echo " want: $expected" >&2 + status=1 + fi +} + +echo "RUFUS_VERSION in $GLOBALS = $VERSION" + +# README tagline, e.g. "K-mer based variant detection. v1.2.0." +check_rule README.md \ + '^K-mer based variant detection\.' \ + "K-mer based variant detection. ${VERSION}." \ + "s/^K-mer based variant detection\..*/K-mer based variant detection. ${VERSION}./" + +# README "pin a specific version" example. The :latest line beside it is deliberately not +# managed -- it must stay literal. +check_rule README.md \ + '^apptainer pull rufus\.sif docker://stefinfection/rufus:v' \ + "apptainer pull rufus.sif docker://stefinfection/rufus:${VERSION}" \ + "s|^apptainer pull rufus\.sif docker://stefinfection/rufus:v.*|apptainer pull rufus.sif docker://stefinfection/rufus:${VERSION}|" + +if [ "$status" -ne 0 ]; then + cat >&2 < +# +# Creates a new version under an existing concept record (so all releases share one concept +# DOI), uploads the SIF, sets minimal metadata, and publishes. Intended to run in CI on a +# git tag push (see .github/workflows/build-publish.yml). +# +# Required environment: +# ZENODO_TOKEN personal access token with deposit:write + deposit:actions +# ZENODO_CONCEPT_RECORD_ID the concept (all-versions) record id of the existing RUFUS record +set -euo pipefail + +SIF_PATH="${1:?usage: zenodo_upload.sh }" +VERSION="${2:?usage: zenodo_upload.sh }" +: "${ZENODO_TOKEN:?ZENODO_TOKEN must be set}" +: "${ZENODO_CONCEPT_RECORD_ID:?ZENODO_CONCEPT_RECORD_ID must be set}" + +API="https://zenodo.org/api" +AUTH="Authorization: Bearer ${ZENODO_TOKEN}" + +# jq is preinstalled on GitHub-hosted ubuntu runners. +api() { + # api ; echoes the JSON body, fails on HTTP >= 400 + local body http + body=$(curl -sS -w $'\n%{http_code}' -H "$AUTH" "$@") + http=$(tail -n1 <<<"$body") + body=$(sed '$d' <<<"$body") + if [ "$http" -ge 400 ]; then + echo "Zenodo API error (HTTP $http):" >&2 + echo "$body" >&2 + return 1 + fi + echo "$body" +} + +echo "Resolving latest deposition for concept record ${ZENODO_CONCEPT_RECORD_ID}..." +LATEST_ID=$(api "${API}/records/${ZENODO_CONCEPT_RECORD_ID}" | jq -r '.id') +echo "Latest record id: ${LATEST_ID}" + +echo "Creating new version..." +NEWVER=$(api -X POST "${API}/deposit/depositions/${LATEST_ID}/actions/newversion") +DRAFT_URL=$(jq -r '.links.latest_draft' <<<"$NEWVER") +DRAFT_ID="${DRAFT_URL##*/}" +echo "New draft deposition id: ${DRAFT_ID}" + +# Remove files inherited from the previous version so only the new SIF remains. +echo "Clearing inherited files..." +DRAFT=$(api "${API}/deposit/depositions/${DRAFT_ID}") +BUCKET=$(jq -r '.links.bucket' <<<"$DRAFT") +for fid in $(jq -r '.files[].id' <<<"$DRAFT"); do + api -X DELETE "${API}/deposit/depositions/${DRAFT_ID}/files/${fid}" >/dev/null || true +done + +echo "Uploading ${SIF_PATH}..." +FNAME=$(basename "$SIF_PATH") +api -X PUT "${BUCKET}/${FNAME}" --upload-file "$SIF_PATH" >/dev/null + +echo "Setting version metadata..." +api -X PUT "${API}/deposit/depositions/${DRAFT_ID}" \ + -H "Content-Type: application/json" \ + -d "{\"metadata\": $(jq -n --arg v "$VERSION" '.version=$v | .publication_date=(now|strftime("%Y-%m-%d"))' \ + <<<"$(jq '.metadata' <<<"$DRAFT")")}" >/dev/null + +echo "Publishing..." +PUBLISHED=$(api -X POST "${API}/deposit/depositions/${DRAFT_ID}/actions/publish") +DOI=$(jq -r '.doi' <<<"$PUBLISHED") +echo "Published RUFUS ${VERSION} to Zenodo. DOI: ${DOI}" diff --git a/scripts/clean.sh b/scripts/clean.sh deleted file mode 100755 index 64de7c10..00000000 --- a/scripts/clean.sh +++ /dev/null @@ -1,8 +0,0 @@ -####this script cleans up the RUFUS folder and output -#### only run when you are sure your run is complete and -#### you have everything you need. It will remove all -#### your intermeidate files and youll have to do your -#### run all over again - - -rm *Mutations.fastq.merged.bam* *generator.Mutations.fastq.pared.bam* *.generator.Mutations.Mate*.fastq* *.generator.temp* *generator.V2.overlap.fastq* *generator.V2.overlap.hashcount.fastq *generator.V2.overlap.hashcount.fastq.bam.vcf* *.generator.Jhash fastp.html fastp.json ./Intermediates/*.overlap.asembly.hash* Intermediates/*overlap.hashcount.fastq.Jhash* Intermediates/*.V2.ref.RepRefHash* mer_counts_merged.jf TempOverlap/*.generator.V2.* diff --git a/scripts/multiLineFastaToSingleLineFastq.pl b/scripts/multiLineFastaToSingleLineFastq.pl deleted file mode 100755 index 1df59f61..00000000 --- a/scripts/multiLineFastaToSingleLineFastq.pl +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/perl - -use strict; - -sub trim($) -{ - my $string = shift; - $string =~ s/^\s+//; - $string =~ s/\s+$//; - chomp($string); - return $string; -} - - -open (Fastq , $ARGV[0]) || die "ERROR could not open sam file"; - -my $l; -my $seq = ""; -$l = ; -my @a = split(" ", $l); -my @len = split("=", $a[1]); -my @reads = split("=", $a[2]); - -print "$a[0]_L$len[1]_D$reads[1]:5:5\n"; -while ($l = ) -{ - chomp($l); - my $FC = substr($l , 0, 1); - if ($FC eq ">") - { - # print "yay header\n"; - print "$seq\n"; - print "+\n"; - print "$seq\n"; - - - my @a = split(" ", $l); - my @len = split("=", $a[1]); - my @reads = split("=", $a[2]); - print "$a[0]_L$len[1]_D$reads[1]:5:5\n"; - - #print "$l\n"; - $seq = ""; - } - else - { - $seq=$seq . $l; - } - -} -print "$seq\n"; -print "+\n"; -print "$seq\n"; - diff --git a/scripts/old/OverlapBashMultiThread.sh b/scripts/old/OverlapBashMultiThread.sh deleted file mode 100755 index 25a85c3b..00000000 --- a/scripts/old/OverlapBashMultiThread.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -File=$1 -FinalCoverage=$2 -NameStub=$3.V2 -HashList=$4 -Threads=$5 - -SampleJhash=$6 -Parent1Jhash=$7 -Parent2Jhash=$8 -Parent3Jhash=$9 - -echo " you gave -File=$File -FinalCoverage=$FinalCoverage -NameStub=$NameStub -HashList=$HashList -Threads=$Threads -" - -mkdir ./TempOverlap/ -echo "Overlaping $File" - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS - -OverlapHash=$RDIR/bin/Overlap -OverlapRebion2=$RDIR/bin/OverlapRegion -ReplaceQwithDinFASTQD=$RDIR/bin/ReplaceQwithDinFASTQD -ConvertFASTqD=$RDIR/bin/ConvertFASTqD.to.FASTQ -AnnotateOverlap=$RDIR/bin/AnnotateOverlap -gkno=$RDIR/bin/gkno_launcher/gkno -samtools=$RDIR/bin/gkno_launcher/tools/samtools/samtools -RUFUSinterpret=$RDIR/bin/RUFUS.interpret -humanRef=$RDIR/bin/gkno_launcher/resources/homo_sapiens/build_37_version_3/human_reference_v37_decoys.fa -CheckHash=$RDIR/cloud/CheckJellyHashList.sh -OverlapSam=$RDIR/bin/OverlapSam - -if [ -e $NameStub.overlap.hashcount.fastq ] -then - echo "Skipping Overlap" -else - $gkno bwa-se -ps human -q $File -id $File -s $File -o $File.bam -p ILLUMINA - $OverlapSam <($samtools view $File.bam ) .95 50 5 ./TempOverlap/$NameStub.sam $NameStub 1 $Threads - time $OverlapHash ./TempOverlap/$NameStub.sam.fastqd .98 50 2 FP 24 1 ./TempOverlap/$NameStub.1 1 $Threads #> $File.overlap.out - - #time $OverlapHash $File .98 50 2 FP 24 1 ./TempOverlap/$NameStub.1 1 $Threads #> $File.overlap.out - time $OverlapHash ./TempOverlap/$NameStub.1.fastqd .98 50 2 FP 15 1 ./TempOverlap/$NameStub.2 1 $Threads #>> $File.overlap.out - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.2.fastqd > ./TempOverlap/$NameStub.3.fastqd - time $OverlapRebion2 ./TempOverlap/$NameStub.3.fastqd .95 30 0 ./TempOverlap/$NameStub.4 $NameStub 1 $Threads #>> $File.overlap.out - time $OverlapRebion2 ./TempOverlap/$NameStub.4.fastqd .95 30 $FinalCoverage ./TempOverlap/$NameStub.5 $NameStub 1 $Threads #>> $File.overlap.out - $ReplaceQwithDinFASTQD ./TempOverlap/$NameStub.5.fastqd > ./$NameStub.overlap.fastqd - $ConvertFASTqD ./$NameStub.overlap.fastqd > ./$NameStub.overlap.fastq - $AnnotateOverlap $HashList ./$NameStub.overlap.fastq $NameStub.overlap.asembly.hash.fastq > ./$NameStub.overlap.hashcount.fastq - bash $CheckHash $SampleJhash $NameStub.overlap.asembly.hash.fastq 0 > $NameStub.overlap.asembly.hash.fastq.sample - bash $CheckHash $Parent1Jhash $NameStub.overlap.asembly.hash.fastq 0 > $NameStub.overlap.asembly.hash.fastq.p1 - bash $CheckHash $Parent2Jhash $NameStub.overlap.asembly.hash.fastq 0 > $NameStub.overlap.asembly.hash.fastq.p2 - bash $CheckHash $Parent3Jhash $NameStub.overlap.asembly.hash.fastq 0 > $NameStub.overlap.asembly.hash.fastq.p3 -fi - - -$gkno bwa-se -ps human -q ./$NameStub.overlap.hashcount.fastq -id ./$NameStub.overlap.hashcount.fastq -s ./$NameStub.overlap.hashcount.fastq -o ./$NameStub.overlap.hashcount.fastq.bam -p ILLUMINA - -mkfifo check -$samtools view ./$NameStub.overlap.hashcount.fastq.bam | $RUFUSinterpret -r $humanRef -hf $HashList -o ./$NameStub.overlap.hashcount.fastq.bam -m 100000000 -c $NameStub.overlap.asembly.hash.fastq.p1 -c $NameStub.overlap.asembly.hash.fastq.p2 -c $NameStub.overlap.asembly.hash.fastq.p3 - - -grep ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -grep -v ^# ./$NameStub.overlap.hashcount.fastq.bam.vcf | sort -k1,1 -k2,2n >> ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/gkno_launcher/tools/tabix/bgzip ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf -$RDIR/bin/gkno_launcher/tools/tabix/tabix ./$NameStub.overlap.hashcount.fastq.bam.vcf.sorted.vcf.gz - - diff --git a/scripts/old/RunRUFUS.1000G.withDupRemoce.sh b/scripts/old/RunRUFUS.1000G.withDupRemoce.sh deleted file mode 100755 index 086da7bc..00000000 --- a/scripts/old/RunRUFUS.1000G.withDupRemoce.sh +++ /dev/null @@ -1,81 +0,0 @@ -date -Parent1=$1 -Parent2=$2 -Parent3=$3 -MutantGenerator=$4 -K=$5 -Threads=$6 -Out=$7 - -echo "You gave -Parent1=$1 -Parent2=$2 -Parent3=$2 -MutantGenerator=$4 -K=$5 -Threads=$6 -Out=$7 -" - -if [ -z "$Out" ] -then - echo "out file not specified" - exit -fi - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate - - -perl -ni -e 's/ /\t/;print' $MutantGenerator.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent1.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent2.Jhash.histo -perl -ni -e 's/ /\t/;print' $Parent3.Jhash.histo - -echo "staring model" -if [ -e "$MutantGenerator.Jhash.histo.7.7.model" ] -then - echo "skipping model" -else - /usr/bin/time -v $RUFUSmodel $MutantGenerator.Jhash.histo $K 150 $Threads > $Out.Run.out -# /usr/bin/time -v $RUFUSmodel $Parent1.Jhash.histo $K 150 $Threads > $Out.Run.out - # /usr/bin/time -v $RUFUSmodel $Parent2.Jhash.histo $K 150 $Threads > $Out.Run.out - # /usr/bin/time -v $RUFUSmodel $Parent3.Jhash.histo $K 150 $Threads > $Out.Run.out - echo "done with model " -fi - -ParentMaxE=0 -MutantMinCov=$(head -2 $MutantGenerator.Jhash.histo.7.7.model | tail -1 ) -echo "$ParentMaxE \n $MutantMinCov \n" - - -date -echo "starting RUFUS build " -let "Max= $MutantMinCov*100" -if [ -e "$Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList" ] -then - echo "Skipping build" -else - /usr/bin/time -v $RUFUSbuild -c $Parent1.Jhash.sorted.min2.tab -c $Parent2.Jhash.sorted.min2.tab -c $Parent3.Jhash.sorted.min2.tab -s $MutantGenerator.Jhash.sorted.min2.tab -o $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList -hs $K -mS $MutantMinCov -mC $ParentMaxE -max $Max -t 1 >> $Out.Run.out - #/usr/bin/time -v $RUFUSbuild -c <(s3cmd get --no-progress s3://rufus.marth.lab/1000G.RUFUSreference.sorted.min45.tab.gz - | zcat) -c $Parent1.Jhash.sorted.min2.tab -c $Parent2.Jhash.sorted.min2.tab -c $Parent3.Jhash.sorted.min2.tab -s $MutantGenerator.Jhash.sorted.min2.tab -o $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList -hs $K -mS $MutantMinCov -mC $ParentMaxE -max $Max -t 1 >> $Out.Run.out -fi - - - - -echo "done with RUFUS build " -echo "startin RUFUS filter" -rm $MutantGenerator.temp -mkfifo $MutantGenerator.temp -/usr/bin/time -v bash $MutantGenerator > $MutantGenerator.temp & -/usr/bin/time -v $RUFUSfilter $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList $MutantGenerator.temp $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".filtered.fq $K 0 5 10 $Threads >> $Out.Run.out & -wait - -echo "startin RUFUS overlap" -/usr/bin/time -v bash $RUFUSOverlap $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".filtered.fq.Mutations.fastq 5 $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov" $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList $Threads -echo "done with everything " - diff --git a/scripts/old/RunTumor.sh b/scripts/old/RunTumor.sh deleted file mode 100755 index e177df45..00000000 --- a/scripts/old/RunTumor.sh +++ /dev/null @@ -1,83 +0,0 @@ -date -ParentGenerator=$1 -MutantGenerator=$2 -K=$3 -Threads=$4 -Out=$5 - -echo "You gave -ParentGenerator=$1 -MutantGenerator=$2 -K=$3 -Threads=$4 -Out=$5 -" - -if [ -z "$Out" ] -then - echo "out file not specified" - exit -fi - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate - - -perl -ni -e 's/ /\t/;print' $MutantGenerator.Jhash.histo -perl -ni -e 's/ /\t/;print' $ParentGenerator.Jhash.histo - -echo "staring model" -if [ -e "$MutantGenerator.Jhash.histo.7.7.model" ] -then - echo "skipping model" -else - /usr/bin/time -v $RUFUSmodel $MutantGenerator.Jhash.histo $K 150 $Threads > $Out.Run.out -# /usr/bin/time -v $RUFUSmodel $ParentGenerator.Jhash.histo $K 150 $Threads > $Out.Run.out - # /usr/bin/time -v $RUFUSmodel $Parent2.Jhash.histo $K 150 $Threads > $Out.Run.out - # /usr/bin/time -v $RUFUSmodel $Parent3.Jhash.histo $K 150 $Threads > $Out.Run.out - echo "done with model " -fi - -ParentMaxE=0 -MutantMinCov=$(head -2 $MutantGenerator.Jhash.histo.7.7.model | tail -1 ) -echo "$ParentMaxE \n $MutantMinCov \n" - - -date -echo "starting RUFUS build " -let "Max= $MutantMinCov*100" -if [ -e "$Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList" ] -then - echo "Skipping build" -else - /usr/bin/time -v $RUFUSbuild -c $ParentGenerator.Jhash.sorted.min2.tab -s $MutantGenerator.Jhash.sorted.min2.tab -o $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList -hs $K -mS $MutantMinCov -mC $ParentMaxE -max $Max -t 1 >> $Out.Run.out - #/usr/bin/time -v $RUFUSbuild -c <(s3cmd get --no-progress s3://rufus.marth.lab/1000G.RUFUSreference.sorted.min45.tab.gz - | zcat) -c $ParentGenerator.Jhash.sorted.min2.tab -c $Parent2.Jhash.sorted.min2.tab -c $Parent3.Jhash.sorted.min2.tab -s $MutantGenerator.Jhash.sorted.min2.tab -o $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList -hs $K -mS $MutantMinCov -mC $ParentMaxE -max $Max -t 1 >> $Out.Run.out -fi - - - - -echo "done with RUFUS build " -if [ -e "$Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".filtered.fq.Mutations.fastq" ] -then - echo "Skipping Filter" -else - - echo "startin RUFUS filter" - rm $MutantGenerator.temp - mkfifo $MutantGenerator.temp - echo $RDIR/cloud/PassThroughSamCheck $MutantGenerator.filter.chr - /usr/bin/time -v bash $MutantGenerator > $MutantGenerator.temp & - /usr/bin/time -v $RUFUSfilter $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList $MutantGenerator.temp $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".filtered.fq $K 0 5 10 $Threads >> $Out.Run.out & - wait -fi - - -echo "startin RUFUS overlap" -/usr/bin/time -v bash $RUFUSOverlap $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".filtered.fq.Mutations.fastq 5 $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov" $Out".k$K"_m"$ParentMaxE"_c"$MutantMinCov".HashList $Threads -echo "done with everything " - diff --git a/scripts/processGFFintersect.sh b/scripts/processGFFintersect.sh deleted file mode 100644 index 459e9102..00000000 --- a/scripts/processGFFintersect.sh +++ /dev/null @@ -1,17 +0,0 @@ -echo "" > $1.genes -for i in $(awk '$7 == "gene"' $1 | awk '{print $13}' ); do - echo $i; - gene=$(awk '{split($1, a, ";Name="); split(a[2], b, ";"); print b[1]}' <<< $i); - echo "gene = $gene"; - id=$(awk '{split($1, a, "ID=gene:"); split(a[2], b, ";"); print b[1]}' <<< $i); - echo "id = $id"; - - #grep $id intersect.out - - for j in $(grep $id $1 | awk '$7 == "mRNA"' | awk '{print $13}'); do - ts=$(awk '{split($1, a, "ID=transcript:"); split(a[2], b, ";"); print b[1]}' <<< $j); - grep $ts $1 | awk '$7 != "mRNA"'; - for i in $(grep $ts $1 | awk '$7 != "mRNA"'); do echo $gene; done | sort | uniq >> $1.genes - done -done - diff --git a/scripts/remove_coinherited.sh b/scripts/remove_coinherited.sh old mode 100755 new mode 100644 index d8588182..8a8183f2 --- a/scripts/remove_coinherited.sh +++ b/scripts/remove_coinherited.sh @@ -1,5 +1,12 @@ -#!/bin/bash +#!/bin/bash +module load bcftools +module load htslib +module load vt +module load samtools +module load bwa + +# UPDATED TO NEW VERSION SJG 09Aug2024 # This script removes inherited variants called by rufus which lie on the same contig as # a somatic variant. It accomplishes this task by performing a pileup and variant call # in the control bam for each of the rufus-identified variants, then taking the complement @@ -12,10 +19,11 @@ SAMPLE_NAME=$3 # Sample name, used in vcf output file name ARG_LIST=("$@") CONTROL_BAM_LIST=("${ARG_LIST[@]:3}") # Remaining args, all control bams -echo "Arguments to remove coinherited script: $ARG_LIST" +echo "Arguments provided to inherited removal script: $@" +echo "Control bam list is ${ARG_LIST[@]:3}" # static vars -OUT_VCF="$SAMPLE_NAME.FINAL.vcf.gz" +OUT_VCF="$SAMPLE_NAME.FINAL.normalized.vcf.gz" CONTROL_ALIGNED="temp_aligned.bam" CONTROL_VCF="isec_control.vcf.gz" @@ -41,21 +49,21 @@ for CONTROL in "${CONTROL_BAM_LIST[@]}"; do fi #run pileup and call variants - bcftools mpileup -d600 -T $OUT_VCF -f $REFERENCE_FILE $CONTROL_BAM | bcftools call -cv -Oz -o $CONTROL_VCF + bcftools mpileup -d600 -T $OUT_VCF -f $REFERENCE_FILE $CONTROL_BAM | $bcftools call -cv -Oz -o $CONTROL_VCF bcftools index -t $CONTROL_VCF #intersect the control vcf with formatted rufus vcf bcftools isec -Oz -w1 -n=1 -p $ISEC_OUT_DIR $OUT_VCF $CONTROL_VCF # save the new vcf as rufus final vcf - OUT_VCF=$ISEC_OUT_DIR/0000.vcf + OUTFILE=$ISEC_OUT_DIR/0000.vcf.gz + OUT_INDEX=$ISEC_OUT_DIR/0000.vcf.gz.tbi + + cp $OUTFILE $OUT_DIR/"$SAMPLE_NAME.FINAL.no_inherited.vcf.gz" + cp $OUT_INDEX $OUT_DIR/"$SAMPLE_NAME.FINAL.no_inherited.vcf.gz.tbi" # clean up aligned control file, if it exists if [ "$MADE_CONTROL_BAM" = true ]; then rm $CONTROL_ALIGNED fi done - -# Clean up files -rm -rf $ISEC_OUT_DIR -rm $CONTROL_VCF diff --git a/scripts/rufus_post_script.sh b/scripts/rufus_post_script.sh deleted file mode 100644 index a4dadd93..00000000 --- a/scripts/rufus_post_script.sh +++ /dev/null @@ -1,32 +0,0 @@ -#assign necessary variables -REFERENCE_FILE=$0 -RUFUS_VCF=$1 -OUTFILE=$2 -CONTROL_VCF=$3 -CONTROL_ALIGNED=$4 -control_bams=(list of control files given by user) - -#format final rufus vcf for intersections -vt normalize -n -r $REFERENCE_FILE $RUFUS_VCF -| vt decompose_blocksub - | bgzip > $OUTFILE -bcftools index $OUTFILE - -#for loop for each control file provided by user -for CONTROL in "${control_bams[@]}"; do - #check to see if the provided bam file is aligned - if [ "$(samtools view -H "$CONTROL" | grep -c '^@SQ')" -gt 0 ]; then - CONTROL_BAM=$CONTROL - #run pileup and call variants - bcftools mpileup -Oz -d600 -f $REFERENCE_FILE -T $OUTFILE $CONTROL_BAM - | bcftools call -Oz -v > $CONTROL_VCF - #intersect the control vcf with formatted rufus vcf - bcftools isec -Oz -w1 -n=1 -p $OUTPUT_DIR $OUTFILE $CONTROL_VCF - #save new rufus only vcf from intersection as the new outfile - OUTFILE=$OUTPUT_DIR/0000.vcf.gz - else - bwa mem -t 40 $REFERENCE_FILE $CONTROL | samtools view -S -@ 12 -b - > $CONTROL_ALIGNED - CONTROL_BAM=$CONTROL_ALIGNED - bcftools mpileup -Oz -d600 -f $REFERENCE_FILE -T $OUTFILE $CONTROL_BAM - | bcftools call -Oz -v > $CONTROL_VCF - bcftools isec -Oz -w1 -n=1 -p $OUTPUT_DIR $OUTFILE $CONTROL_VCF - #save the new vcf as rufus final vcf - OUTFILE=$OUTPUT_DIR/0000.vcf.gz - fi -done diff --git a/scripts/runRUFUSAny.sh b/scripts/runRUFUSAny.sh deleted file mode 100755 index 9769c737..00000000 --- a/scripts/runRUFUSAny.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -#date - -args=("$@") - -numArgs=$# - -parents=("${args[@]:0:$(($numArgs-4))}") -ProbandGenerator=$args[$(($numArgs-4))] -K=$args[$(($numArgs-3))] -Threads=$args[$(($numArgs-2))] -Out=$args[$(($numArgs-1))] - -parentsString="" -space=" " -jhash=".Jhash" - -for parent in "${parents[@]}" -do - parentsString=$parentsString$space$parent$jhash - echo "parents string equals " $parentsString -done - - -echo "you gave" - -for arg in "${args[@]}" -do - echo $arg -done -if [ -z "$Out" ] -then - echo "out file not specified" - exit -fi -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS -RDIR=$PWD -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.trio.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate -PullSampleHashes=$RDIR/cloud/CheckJellyHashList.sh -RUFUS1kgFilter=$RDIR/bin/RUFUS.1kg.filter -RunJelly=$RDIR/cloud/RunJellyForRUFUS -for parent in "${parents[@]}" -do - /usr/bin/time -v bash $RunJelly $parent $K $(echo $Threads -2 | bc) 2 & -done -/usr/bin/time -v bash $RunJelly $ProbandGenerator $K $(echo $Threads -2 | bc) 2 & -wait -perl -ni -e 's/ /\t/;print' $ProbandGenerator.Jhash.histo -for parent in "${parents[@]}" -do - perl -ni -e 's/ /\t/;print' $parent.Jhash.histo -done -if [ -e "$ProbandGenerator.Jhash.histo.7.7.model" ] -then - echo "skipping model" -else - echo "staring model" - /usr/bin/time -v $RUFUSmodel $ProbandGenerator.Jhash.histo $K 150 $Threads - echo "done with model" -fi -ParentMaxE=1 -MutantMinCov=$(head -2 $ProbandGenerator.Jhash.histo.7.7.model | tail -1 ) - -echo "starting RUFUS build" -let "Max= $MutantMinCov*100" -if [ -e "$Out.Family.Unique.HashList" ] -then - echo "Skipping build" -else - /usr/bin/time -v $RDIR/cloud/jellyfish-MODIFIED-merge/bin/jellyfish merge $parentsString $ProbandGenerator.Jhash > $Out.Family.Unique.HashList -fi -echo "Mut cov = $MutantMinCov" -if [ -e $ProbandGenerator.k$K_c$MutantMinCov.HashList ] -then - echo "skipping $ProbandGenerator.HashList pull " -else - /usr/bin/time -v bash $PullSampleHashes $ProbandGenerator.Jhash $Out.Family.Unique.HashList $MutantMinCov > $ProbandGenerator.k$K_c$MutantMinCov.HashList -fi -echo "done with RUFUS build " -echo "starting RUFUS filter" -if [ -e $ProbandGenerator.Mutations.fastq ] -then - echo "skipping filter" -else - rm $ProbandGenerator.temp - mkfifo $ProbandGenerator.temp - /usr/bin/time -v bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck $ProbandGenerator.filter.chr > $ProbandGenerator.temp & - /usr/bin/time -v $RUFUSfilter $ProbandGenerator.k$K_c$MutantMinCov.HashList $ProbandGenerator.temp $ProbandGenerator $K 5 5 10 $(echo $Threads -2 | bc) & - wait -fi -if [ -e $ProbandGenerator.V2.overlap.hashcount.fastq.bam.vcf ] -then - echo "skipping overlap" -else - echo "starting RUFUS overlap" - /usr/bin/time -v bash $RUFUSOverlap $ProbandGenerator.Mutations.fastq 5 $ProbandGenerator $ProbandGenerator.k$MutantMinCov.HashList $K $Threads $ProbandGenerator.Jhash $parentsString -fi -echo "done with everything" diff --git a/scripts/save b/scripts/save deleted file mode 100755 index ca3552f4..00000000 --- a/scripts/save +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -GEN=$1 -K=$2 -T=$3 -L=$4 - -CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -RDIR=$CDIR/../ - - -JELLYFISH="$RDIR/bin/externals/jellyfish/src/jellyfish_project/bin/jellyfish" -SORT="$RDIR/scripts/sort" - -if [ -e "$GEN.Jhash" ] -then - echo "Skipping jelly, $GEN.Jhash alreads exists" -else - echo "Running jellyfish for $GEN" - mkfifo $GEN.Jhash.temp - mkfifo $GEN.fq - bash $GEN | $RDIR/bin/PassThroughSamCheck $GEN.Jelly.chr > $GEN.fq & - /usr/bin/time -v $JELLYFISH count --disk -m $K -L $L -s 8G -t $T -o $GEN.Jhash -C $GEN.fq - /usr/bin/time -v $JELLYFISH histo -f -o $GEN.Jhash.histo $GEN.Jhash - rm $GEN.Jhash.temp - rm $GEN.fq - - wait -fi -wait -exit diff --git a/scripts/setupAWS.sh b/scripts/setupAWS.sh deleted file mode 100644 index a9d69fbe..00000000 --- a/scripts/setupAWS.sh +++ /dev/null @@ -1,27 +0,0 @@ - sudo apt-get -y install gcc - sudo apt-get -y install zlib - sudo apt-get -y update - sudo apt-get -y install build-essential - sudo apt-get -y install zlib1g-dev - sudo apt-get -y install libncurses5-dev - sudo apt-get -y install bzip2 - sudo apt-get -y install libbzip2 - sudo apt-get -y install libbz2-dev - sudo apt-get -y install liblzma-dev - sudo apt-get -y install libcurl - sudo apt -y install libcurl4-gnutls-dev - sudo apt -y install libcurl4-nss-dev - sudo apt -y install libcurl4-openssl-dev - sudo apt-get -y install bedtools - sudo apt-get -y install tabix - sudo apt-get -y install samtools - sudo apt-get -y install cmake - - git clone https://github.com/jandrewrfarrell/RUFUS.git - cd RUFUS/ - git checkout dev - git pull - mkdir bin - cd bin - cmake ../ - make diff --git a/scripts/sort b/scripts/sort deleted file mode 100755 index 7dc03c9a..00000000 Binary files a/scripts/sort and /dev/null differ diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100644 index e4ae8a96..00000000 --- a/scripts/test.sh +++ /dev/null @@ -1,136 +0,0 @@ -#!/bin/bash -args=("$@") - -echo "attempting to print out command line args\n" - -echo "Values of \"\$@\":" -for arg in "$@" -do - echo "Arg #$cnt= $arg" - let "cnt+=1" -done - - -numArgs=$# - -Parents=("${args[@]:0:$((numArgs-4))}") - - -echo "Parents: " -echo $Parents - - -ProbandGenerator=${args[$((numArgs-4))]} - -echo "ProbandGenerator: " -echo $ProbandGenerator - -K=${args[$((numArgs-3))]} -Threads=${args[$((numArgs-2))]} -Out=${args[$((numArgs-1))]} - -echo "K: " -echo $K - -echo "Threads: " -echo $Threads - -echo "Out:" - -echo $Out - -K=$args[$(($numArgs-3))] -Threads=$args[$(($numArgs-2))] -Out=$args[$(($numArgs-1))] - -parentsString="" -space=" " -jhash=".Jhash" - -for parent in "${Parents[@]}" -do - echo "parent is " $parent - parentsString=$parentsString$space$parent$jhash - echo "parents string equals " $parentsString -done - - -echo "you gave" - -for arg in "${args[@]}" -do - echo $arg -done -if [ -z "$Out" ] -then - echo "out file not specified" - exit -fi - -RDIR=/uufs/chpc.utah.edu/common/home/u0991464/d1/home/farrelac/RUFUS -RDIR=$PWD -RUFUSmodel=$RDIR/bin/ModelDist -RUFUSbuild=$RDIR/bin/RUFUS.Build -RUFUSfilter=$RDIR/bin/RUFUS.Filter -RUFUSOverlap=$RDIR/scripts/OverlapBashMultiThread.trio.sh -DeDupDump=$RDIR/scripts/HumanDedup.grenrator.tenplate -PullSampleHashes=$RDIR/cloud/CheckJellyHashList.sh -RUFUS1kgFilter=$RDIR/bin/RUFUS.1kg.filter -RunJelly=$RDIR/cloud/RunJellyForRUFUS -for parent in "${parents[@]}" -do - /usr/bin/time -v bash $RunJelly $parent $K $(echo $Threads -2 | bc) 2 & -done -/usr/bin/time -v bash $RunJelly $ProbandGenerator $K $(echo $Threads -2 | bc) 2 & -wait -perl -ni -e 's/ /\t/;print' $ProbandGenerator.Jhash.histo -for parent in "${parents[@]}" -do - perl -ni -e 's/ /\t/;print' $parent.Jhash.histo -done -if [ -e "$ProbandGenerator.Jhash.histo.7.7.model" ] -then - echo "skipping model" -else - echo "staring model" - /usr/bin/time -v $RUFUSmodel $ProbandGenerator.Jhash.histo $K 150 $Threads - echo "done with model" -fi -ParentMaxE=1 -MutantMinCov=$(head -2 $ProbandGenerator.Jhash.histo.7.7.model | tail -1 ) - -echo "starting RUFUS build" -let "Max= $MutantMinCov*100" -if [ -e "$Out.Family.Unique.HashList" ] -then - echo "Skipping build" -else - /usr/bin/time -v $RDIR/cloud/jellyfish-MODIFIED-merge/bin/jellyfish merge $parentsString $ProbandGenerator.Jhash > $Out.Family.Unique.HashList -fi -echo "Mut cov = $MutantMinCov" -if [ -e $ProbandGenerator.k$K_c$MutantMinCov.HashList ] -then - echo "skipping $ProbandGenerator.HashList pull " -else - /usr/bin/time -v bash $PullSampleHashes $ProbandGenerator.Jhash $Out.Family.Unique.HashList $MutantMinCov > $ProbandGenerator.k$K_c$MutantMinCov.HashList -fi -echo "done with RUFUS build " -echo "starting RUFUS filter" -if [ -e $ProbandGenerator.Mutations.fastq ] -then - echo "skipping filter" -else - rm $ProbandGenerator.temp - mkfifo $ProbandGenerator.temp - /usr/bin/time -v bash $ProbandGenerator | $RDIR/cloud/PassThroughSamCheck $ProbandGenerator.filter.chr > $ProbandGenerator.temp & - /usr/bin/time -v $RUFUSfilter $ProbandGenerator.k$K_c$MutantMinCov.HashList $ProbandGenerator.temp $ProbandGenerator $K 5 5 10 $(echo $Threads -2 | bc) & - wait -fi -if [ -e $ProbandGenerator.V2.overlap.hashcount.fastq.bam.vcf ] -then - echo "skipping overlap" -else - echo "starting RUFUS overlap" - /usr/bin/time -v bash $RUFUSOverlap $ProbandGenerator.Mutations.fastq 5 $ProbandGenerator $ProbandGenerator.k$MutantMinCov.HashList $K $Threads $ProbandGenerator.Jhash $parentsString -fi -echo "done with everything" diff --git a/singularity/build_rufus.sh b/singularity/build_rufus.sh deleted file mode 100644 index 29be187e..00000000 --- a/singularity/build_rufus.sh +++ /dev/null @@ -1,2 +0,0 @@ -export SINGULARITY_TMPDIR=/home/ubuntu/singularity_tmp -sudo -E singularity build rufus.sif rufus.def diff --git a/singularity/launch_utilities/arg_parser.sh b/singularity/launch_utilities/arg_parser.sh index 431682fd..8cf3b4ac 100644 --- a/singularity/launch_utilities/arg_parser.sh +++ b/singularity/launch_utilities/arg_parser.sh @@ -1,33 +1,48 @@ #!/bin/bash +# Statics +DEFAULT_1MB_CPUS_PER_JOB="12" +DEFAULT_1MB_MEM_PER_JOB="20G" +DEFAULT_WG_CPUS_PER_JOB="40" +DEFAULT_WG_MEM_PER_JOB="150G" + + usage() { - echo "Usage: $0 [-s subject] [-c control1,control2,control3...] [-b genome_build] [-a slurm_account] [-p slurm_partition] ...options" + echo "Usage: $0 [-s subject1,subject2,...] [-c control1,control2,control3...] [-b genome_build] [-a slurm_account] [-p slurm_partition] ...options" echo "Required Arguments:" - echo "-d data_directory The directory containing the subject, control, and reference files to be used in the run" - echo "-s subject The subject sample of interest; must be located in data_directory" - echo "-c control(s) A single control or comma-delimited array of multiple controls; must be located in data_directory" + echo "-s subject(s) A single subject or comma-delimited array of multiple subject BAM/CRAM files (full paths)" + echo "-c control(s) A single control or comma-delimited array of multiple controls (full paths)" echo "-b genome_build The desired genome build; currently only supports GRCh38" - echo "-r reference The reference file matching the genome build; must be located in data_directory" + echo "-r reference Full path to the reference file matching the genome build" echo "-a slurm_account The account for the slurm job" echo "-p slurm_partition The partition for the slurm job" echo "-l slurm_job_array_limit The maximum amount of jobs slurm allows in an array" echo "Optional Arguments:" echo "-m kmer_depth_cutoff The amount of kMers that must overlap the variant to be included in the final call set" echo "-w window_size The size of the windows to run RUFUS on, in units of kilabases (KB); allowed range between 500-5000; defaults to single run of entire genome if not provided" - echo "-f reference_hash: Jhash file containing reference kMer hash list" - echo "-x exclude_hash: Single or comma-delimited list of Jhash file(s) containing kMers to exclude from unique hash list" + echo "-f reference_hash Full path to Jhash file containing reference kMer hash list" + echo "-x exclude_hash Single or comma-delimited list of full paths to Jhash file(s) containing kMers to exclude (static, same for all regions)" + echo "-K kg1_hash_dir Full path to directory of per-region KG1 Jhash files (files named *{region}*.Jhash)" + echo "-G kg1_version KG1 hash version to download from S3 (e.g., v3.0)" + echo "-D ctrl_hash_dir Full path to directory of per-region control Jhash files (files named *{region}*.Jhash)" + echo "-V ctrl_version Control hash version to download from S3 (e.g., v1.0)" echo "-y path_to_rufus_container If not provided, will look in current directory for rufus.sif" - echo "-z rufus_threads Number of threads provided to RUFUS; defaults to 36" + echo "-z rufus_threads Number of threads provided to RUFUS; defaults to 36 for entire genome; 10 for 1MB windows (NOTE: must be less than cpus_per_call)" echo "-e email The email address to notify with slurm updates" echo "-q slurm_job_queue_limit The maximum amount of jobs able to be ran at once; defaults to 20" echo "-t slurm_time_limit The maximum amount of time to let the slurm job run; defaults to 7 days for full run, or one hour per window (DD-HH:MM:SS)" + echo "-M memory_per_call How much memory to allot to the rufus calling stage job; default 150G for entire genome; 20G for 1MB windows (e.g. 150G or 20G)" + echo "-C cpus_per_call How many cpus to allot to each rufus calling stage job; default 40 for entire genome; 12 for 1MB windows" + echo "-d dev_binds Comma-delimited list of host:container bind mounts for dev testing (e.g., /local/runRufus.sh:/opt/RUFUS/runRufus.sh)" + echo "-P par_low_cov_threshold Control k-mer count ceiling below which a variant is flagged as low-coverage-parent/inherited (default 7; set to 0 to disable, e.g. when using an assembly as the control)" echo "-h help Print usage" + echo "" + echo "Output files are written to the current working directory." exit 1 } # Initialize variables -HOST_DATA_DIR_RUFUS_ARG="" -SUBJECT_RUFUS_ARG="" +SUBJECTS_RUFUS_ARG=() CONTROL_STRING_RUFUS_ARG="" CONTROLS_RUFUS_ARG=() GENOME_BUILD_RUFUS_ARG="GRCh38" @@ -41,18 +56,32 @@ SLURM_JOB_LIMIT_RUFUS_ARG="20" SLURM_ARRAY_JOB_LIMIT_RUFUS_ARG="1000" SLURM_TIME_LIMIT_RUFUS_ARG="" CONTAINER_PATH_RUFUS_ARG="" -THREAD_LIMIT_RUFUS_ARG="20" +THREAD_LIMIT_RUFUS_ARG="" EXCLUDE_HASH_LIST_RUFUS_ARG=() REFERENCE_HASH_RUFUS_ARG="" +KG1_HASH_DIR="" +KG1_HASH_VERSION="" +CONTROL_HASH_DIR="" +CONTROL_HASH_VERSION="" +MEM_PER_JOB="" +CPUS_PER_JOB="" +PAR_LOW_COV_THRESHOLD_RUFUS_ARG="7" +DEV_BIND_MOUNTS_ARG=() # Parse command line options using getopts -while getopts ":d:s:c:b:a:p:r:m:w:e:l:q:t:f:x:y:z:h" opt; do +# +# -C previously lacked its trailing colon ("M:CK:"), so it took no argument while its handler +# still assigned CPUS_PER_JOB=$OPTARG. `-C 36` therefore left OPTARG unset, never set +# CPUS_PER_JOB, and dropped "36" as an unread positional -- the documented cpus_per_call option +# silently did nothing and every job got the default (40 whole-genome / 12 windowed). Now `C:`. +# +# STILL MISWIRED: -h carries a colon ("h:") so it demands an argument. Bare `-h` never reaches +# the h) case; it falls to the missing-argument branch, printing "Option -h requires an argument" +# before the usage text. Usage still prints, so this is cosmetic. Fix is to drop the colon. +while getopts ":s:c:b:a:p:r:m:w:e:l:q:t:f:x:y:z:M:C:K:G:D:V:d:P:h" opt; do case ${opt} in - d) - HOST_DATA_DIR_RUFUS_ARG=$OPTARG - ;; s) - SUBJECT_RUFUS_ARG=$OPTARG + IFS=',' read -r -a SUBJECTS_RUFUS_ARG <<< "$OPTARG" ;; c) IFS=',' read -r -a CONTROLS_RUFUS_ARG <<< "$OPTARG" @@ -93,12 +122,40 @@ while getopts ":d:s:c:b:a:p:r:m:w:e:l:q:t:f:x:y:z:h" opt; do x) IFS=',' read -r -a EXCLUDE_HASH_LIST_RUFUS_ARG <<< "$OPTARG" ;; + K) + KG1_HASH_DIR=$OPTARG + ;; + G) + KG1_HASH_VERSION=$OPTARG + ;; + D) + CONTROL_HASH_DIR=$OPTARG + ;; + V) + CONTROL_HASH_VERSION=$OPTARG + ;; f) REFERENCE_HASH_RUFUS_ARG=$OPTARG - ;; + ;; z) THREAD_LIMIT_RUFUS_ARG=$OPTARG ;; + M) + MEM_PER_JOB=$OPTARG + ;; + C) + CPUS_PER_JOB=$OPTARG + ;; + d) + IFS=',' read -r -a DEV_BIND_MOUNTS_ARG <<< "$OPTARG" + ;; + P) + if ! [[ "$OPTARG" =~ ^[0-9]+$ ]]; then + echo "ERROR: -P par_low_cov_threshold must be a non-negative integer." >&2 + exit 1 + fi + PAR_LOW_COV_THRESHOLD_RUFUS_ARG=$OPTARG + ;; h) usage ;; @@ -115,33 +172,26 @@ done shift $((OPTIND - 1)) # Check for required strings -if [[ -z "$HOST_DATA_DIR_RUFUS_ARG" || -z "$SUBJECT_RUFUS_ARG" || -z "$GENOME_BUILD_RUFUS_ARG" || -z "$REFERENCE_RUFUS_ARG" || -z "$SLURM_ACCOUNT_RUFUS_ARG" || -z "$SLURM_PARTITION_RUFUS_ARG" || -z "$SLURM_ARRAY_JOB_LIMIT_RUFUS_ARG" ]]; then - echo "Error: Missing required argument(s)." >&2 - usage -fi - -# Add on a trailing slash to dir, just in case user omits -HOST_DATA_DIR_RUFUS_ARG="${HOST_DATA_DIR_RUFUS_ARG}/" - -# Check that data directory exists -if [ ! -d "$HOST_DATA_DIR_RUFUS_ARG" ]; then - echo "Error: provided data_directory argument is not a directory." >&2 - usage +if [[ ${#SUBJECTS_RUFUS_ARG[@]} -eq 0 || -z "$GENOME_BUILD_RUFUS_ARG" || -z "$REFERENCE_RUFUS_ARG" || -z "$SLURM_ACCOUNT_RUFUS_ARG" || -z "$SLURM_PARTITION_RUFUS_ARG" || -z "$SLURM_ARRAY_JOB_LIMIT_RUFUS_ARG" ]]; then + echo "ERROR: Missing required argument(s); please see usage instructions with -h." >&2 + exit 1 fi -# Check that subject file is in provided data directory -if [ ! -f "${HOST_DATA_DIR_RUFUS_ARG}${SUBJECT_RUFUS_ARG}" ]; then - echo "Error: provided subject file $SUBJECT_RUFUS_ARG does not exist in the provided data directory or cannot be read." >&2 - usage -fi +# Check that all subject files exist +for subject in "${SUBJECTS_RUFUS_ARG[@]}"; do + if [ ! -f "$subject" ]; then + echo "ERROR: subject file $subject does not exist or cannot be read." >&2 + exit 1 + fi +done -# Check that all of the control files are in the provided data directory +# Check that all control files exist for control in "${CONTROLS_RUFUS_ARG[@]}"; do - if [ ! -f "${HOST_DATA_DIR_RUFUS_ARG}${control}" ]; then - echo "Error: provided control file $controls does not exist in the provided data directory or cannot be read." >&2 - usage + if [ ! -f "$control" ]; then + echo "ERROR: control file $control does not exist or cannot be read." >&2 + exit 1 else - if [ -z $CONTROL_STRING_RUFUS_ARG ]; then + if [ "$CONTROL_STRING_RUFUS_ARG" == "" ]; then CONTROL_STRING_RUFUS_ARG="$control" else CONTROL_STRING_RUFUS_ARG="${CONTROL_STRING_RUFUS_ARG}, $control" @@ -149,38 +199,205 @@ for control in "${CONTROLS_RUFUS_ARG[@]}"; do fi done -# Check that reference file is in provided data directory -if [ ! -f "${HOST_DATA_DIR_RUFUS_ARG}${REFERENCE_RUFUS_ARG}" ]; then - echo "Error: provided reference file $REFERENCE_RUFUS_ARG does not exist in the provided data directory or cannot be read." >&2 - usage +# Validate that subject and control files are all the same type (bam, cram, or fastq) +get_input_type() { + case "$1" in + *.cram) echo "cram" ;; + *.bam) echo "bam" ;; + *.fastq.gz|*.fq.gz) echo "fastq" ;; + *.fastq|*.fq) echo "fastq" ;; + *) echo "unknown" ;; + esac +} + +# Validate type of first subject, then ensure all subjects + controls match +SUBJECT_TYPE=$(get_input_type "${SUBJECTS_RUFUS_ARG[0]}") +if [ "$SUBJECT_TYPE" == "unknown" ]; then + echo "ERROR: subject file ${SUBJECTS_RUFUS_ARG[0]} has an unrecognized file type. Supported types: .bam, .cram, .fastq, .fq, .fastq.gz, .fq.gz" >&2 + exit 1 +fi +for subject in "${SUBJECTS_RUFUS_ARG[@]:1}"; do + SUBJ_TYPE=$(get_input_type "$subject") + if [ "$SUBJ_TYPE" != "$SUBJECT_TYPE" ]; then + echo "ERROR: all subject files must be the same type, but first subject is ${SUBJECT_TYPE} and $subject is ${SUBJ_TYPE}. Please ensure all inputs are either all BAMs, all CRAMs, or all FASTQs." >&2 + exit 1 + fi +done +for control in "${CONTROLS_RUFUS_ARG[@]}"; do + CTRL_TYPE=$(get_input_type "$control") + if [ "$CTRL_TYPE" != "$SUBJECT_TYPE" ]; then + echo "ERROR: all subject and control files must be the same type, but subject is ${SUBJECT_TYPE} and control $control is ${CTRL_TYPE}. Please ensure all inputs are either all BAMs, all CRAMs, or all FASTQs." >&2 + exit 1 + fi +done + +# Check that reference file exists +if [ ! -f "$REFERENCE_RUFUS_ARG" ]; then + echo "ERROR: reference file $REFERENCE_RUFUS_ARG does not exist or cannot be read." >&2 + exit 1 +fi + +# Check that BWA indexes exist alongside the reference. +# runRufus.sh prefers the extension-stripped prefix when .sa is present and +# otherwise falls back to the reference path itself, so validate whichever it will pick. +# Without this, the missing index only surfaces at the bwa mem step, which in region +# mode is hours into every queued array task. +REFERENCE_BWA_PREFIX="$REFERENCE_RUFUS_ARG" +if [ -e "${REFERENCE_RUFUS_ARG%.*}.sa" ]; then + REFERENCE_BWA_PREFIX="${REFERENCE_RUFUS_ARG%.*}" +fi + +MISSING_BWA_INDEXES=() +for bwa_suffix in amb ann bwt pac sa; do + if [ ! -e "${REFERENCE_BWA_PREFIX}.${bwa_suffix}" ]; then + MISSING_BWA_INDEXES+=("${REFERENCE_BWA_PREFIX}.${bwa_suffix}") + fi +done +if [ ! -e "${REFERENCE_RUFUS_ARG}.fai" ]; then + MISSING_BWA_INDEXES+=("${REFERENCE_RUFUS_ARG}.fai") +fi + +if [ ${#MISSING_BWA_INDEXES[@]} -ne 0 ]; then + echo "ERROR: reference $REFERENCE_RUFUS_ARG is missing required index files:" >&2 + for missing in "${MISSING_BWA_INDEXES[@]}"; do + echo " $missing" >&2 + done + echo "RUFUS aligns candidate reads with BWA and cannot run without these." >&2 + echo "Build them once with:" >&2 + echo " bash \${RUFUS_ROOT}/resource_helpers/build_bwa_indexes.sh $REFERENCE_RUFUS_ARG" >&2 + echo "(indexing a human-sized reference takes roughly an hour)" >&2 + exit 1 fi # Check that window size is in valid range # Check if time limit has been assigned, if not - use defaults for full mode or windowed mode if [ "$WINDOW_SIZE_RUFUS_ARG" -eq 0 ]; then - if [ -z $SLURM_TIME_LIMIT_RUFUS ]; then + if [ -z "$SLURM_TIME_LIMIT_RUFUS_ARG" ]; then SLURM_TIME_LIMIT_RUFUS_ARG="7-00:00:00" fi -elif [ "$WINDOW_SIZE_RUFUS_ARG" -lt 500 ] || [ "$WINDOW_SIZE_RUFUS_ARG" -gt 5000 ]; then - echo "Error: window size must be between 500 and 5000 (kilobases)" - usage + CPUS_PER_JOB=${CPUS_PER_JOB:-$DEFAULT_WG_CPUS_PER_JOB} + MEM_PER_JOB=${MEM_PER_JOB:-$DEFAULT_WG_MEM_PER_JOB} + THREAD_LIMIT_RUFUS_ARG=${THREAD_LIMIT_RUFUS_ARG:-36} +elif [ "$WINDOW_SIZE_RUFUS_ARG" -ne 1000 ]; then + echo "ERROR: only windows of 1000 (1MB) supported currently" >&2 + exit 1 else - if [ -z $SLURM_TIME_LIMIT_RUFUS ]; then + if [ -z "$SLURM_TIME_LIMIT_RUFUS_ARG" ]; then SLURM_TIME_LIMIT_RUFUS_ARG="01:00:00" fi + CPUS_PER_JOB=${CPUS_PER_JOB:-$DEFAULT_1MB_CPUS_PER_JOB} + MEM_PER_JOB=${MEM_PER_JOB:-$DEFAULT_1MB_MEM_PER_JOB} + THREAD_LIMIT_RUFUS_ARG=${THREAD_LIMIT_RUFUS_ARG:-10} +fi + +if [ "$THREAD_LIMIT_RUFUS_ARG" -ge "$CPUS_PER_JOB" ]; then + echo "ERROR: thread limit ($THREAD_LIMIT_RUFUS_ARG) must be less than cpus per job ($CPUS_PER_JOB)." >&2 + exit 1 +fi +# Validate per-region hash flags: cannot specify both local dir and S3 version for same type +if [ -n "$KG1_HASH_DIR" ] && [ -n "$KG1_HASH_VERSION" ]; then + echo "ERROR: Cannot specify both -K (local KG1 hash dir) and -G (KG1 S3 version). Use one or the other." >&2 + exit 1 +fi +if [ -n "$CONTROL_HASH_DIR" ] && [ -n "$CONTROL_HASH_VERSION" ]; then + echo "ERROR: Cannot specify both -D (local control hash dir) and -V (control S3 version). Use one or the other." >&2 + exit 1 +fi + +# Validate local hash directories exist if provided +if [ -n "$KG1_HASH_DIR" ] && [ ! -d "$KG1_HASH_DIR" ]; then + echo "ERROR: KG1 hash directory does not exist: $KG1_HASH_DIR" >&2 + exit 1 +fi +if [ -n "$CONTROL_HASH_DIR" ] && [ ! -d "$CONTROL_HASH_DIR" ]; then + echo "ERROR: Control hash directory does not exist: $CONTROL_HASH_DIR" >&2 + exit 1 fi # Check that if path to image not provided, it's in the current dir if [ -z $CONTAINER_PATH_RUFUS_ARG ]; then if [ ! -f "rufus.sif" ]; then - echo "Error: rufus.sif not in current directory - please provide path to container or put it in this one under rufus.sif" - usage + echo "ERROR: rufus.sif not in current directory - please provide path to container or put it in this one under rufus.sif" fi fi +# Validate dev bind mounts and build singularity --bind args string +DEV_BIND_ARGS="" +if [ ${#DEV_BIND_MOUNTS_ARG[@]} -gt 0 ]; then + for bind_spec in "${DEV_BIND_MOUNTS_ARG[@]}"; do + host_path="${bind_spec%%:*}" + container_path="${bind_spec#*:}" + if [ "$host_path" == "$bind_spec" ]; then + echo "ERROR: dev bind mount '$bind_spec' must be in host:container format (e.g., /local/runRufus.sh:/opt/RUFUS/runRufus.sh)" >&2 + exit 1 + fi + if [ ! -e "$host_path" ]; then + echo "ERROR: dev bind mount host path does not exist: $host_path" >&2 + exit 1 + fi + DEV_BIND_ARGS+=" --bind ${bind_spec}" + done + echo "DEV MODE: additional bind mounts:${DEV_BIND_ARGS}" +fi + +# Collect unique parent directories for all input files to use as bind mounts. +# Singularity --bind preserves host paths inside the container (no remapping needed). +collect_bind_dirs() { + local -A seen_dirs + local dirs=() + + # Always include pwd for output + seen_dirs["$(pwd)"]=1 + dirs+=("$(pwd)") + + local files=("${SUBJECTS_RUFUS_ARG[@]}" "$REFERENCE_RUFUS_ARG") + for control in "${CONTROLS_RUFUS_ARG[@]}"; do + files+=("$control") + done + if [ -n "$REFERENCE_HASH_RUFUS_ARG" ]; then + files+=("$REFERENCE_HASH_RUFUS_ARG") + fi + for exclude in "${EXCLUDE_HASH_LIST_RUFUS_ARG[@]}"; do + files+=("$exclude") + done + + # Add hash directories directly (not individual files) + local hash_dirs=() + if [ -n "$KG1_HASH_DIR" ]; then + hash_dirs+=("$KG1_HASH_DIR") + fi + if [ -n "$CONTROL_HASH_DIR" ]; then + hash_dirs+=("$CONTROL_HASH_DIR") + fi + + for hd in "${hash_dirs[@]}"; do + local resolved_hd + resolved_hd="$(realpath "$hd")" + if [ -z "${seen_dirs[$resolved_hd]+x}" ]; then + seen_dirs["$resolved_hd"]=1 + dirs+=("$resolved_hd") + fi + done + + for f in "${files[@]}"; do + local d + d="$(dirname "$(realpath "$f")")" + if [ -z "${seen_dirs[$d]+x}" ]; then + seen_dirs["$d"]=1 + dirs+=("$d") + fi + done + + # Join with commas + local IFS=',' + echo "${dirs[*]}" +} + +BIND_MOUNTS="$(collect_bind_dirs)" + # Export variables for use in the main script -export HOST_DATA_DIR_RUFUS_ARG -export SUBJECT_RUFUS_ARG +export BIND_MOUNTS +export SUBJECTS_RUFUS_ARG export CONTROL_STRING_RUFUS_ARG export CONTROLS_RUFUS_ARG export GENOME_BUILD_RUFUS_ARG @@ -197,3 +414,11 @@ export CONTAINER_PATH_RUFUS_ARG export THREAD_LIMIT_RUFUS_ARG export EXCLUDE_HASH_LIST_RUFUS_ARG export REFERENCE_HASH_RUFUS_ARG +export KG1_HASH_DIR +export KG1_HASH_VERSION +export CONTROL_HASH_DIR +export CONTROL_HASH_VERSION +export MEM_PER_JOB +export CPUS_PER_JOB +export PAR_LOW_COV_THRESHOLD_RUFUS_ARG +export DEV_BIND_ARGS \ No newline at end of file diff --git a/singularity/launch_utilities/chunk_utilities.sh b/singularity/launch_utilities/chunk_utilities.sh index 433c43ac..c5e0e3f7 100644 --- a/singularity/launch_utilities/chunk_utilities.sh +++ b/singularity/launch_utilities/chunk_utilities.sh @@ -3,7 +3,9 @@ set -e #LOCAL_TESTING_UTIL_PATH=/home/ubuntu/RUFUS/singularity/launch_utilities/ #UTIL_PATH=$LOCAL_TESTING_UTIL_PATH -UTIL_PATH=/opt/RUFUS/singularity/launch_utilities/ + +: "${RUFUS_ROOT:=/opt/RUFUS}" +UTIL_PATH=${RUFUS_ROOT}/singularity/launch_utilities/ GENOME_HELPERS_PATH=${UTIL_PATH}genome_helpers.sh . $GENOME_HELPERS_PATH @@ -53,6 +55,22 @@ function get_chunk_region() { echo "$chr:${chunkStart}-${chunkEnd}" } +# Returns 1000g sub_dir/file_name for given region +function get_1kg_file() { + local chunkNum=$1 + local chunkSize=$2 + local build=$3 + + reg=$(get_chunk_region $chunkNum $chunkSize $build) + fmtd_reg=$(echo $reg | sed 's/[:-]/_/g') + + if [ "$chunkSize" = "1000" ]; then + echo "1mb/${fmtd_reg}.Jhash" + else + echo "" + fi +} + # Returns the number of chunks for the given genome build # Takes in 1) the chunk size and 2) the genome build function get_num_chunks() { diff --git a/singularity/launch_utilities/genome_helpers.sh b/singularity/launch_utilities/genome_helpers.sh index c6b55965..5601b909 100644 --- a/singularity/launch_utilities/genome_helpers.sh +++ b/singularity/launch_utilities/genome_helpers.sh @@ -54,7 +54,7 @@ function get_ref_path() { case "$build" in "GRCh38") # TODO: need to actually put reference in this spot - echo "/opt/RUFUS/resources/references/GRCh38_full_analysis_set_plus_decoy_hla.fa" + echo "${RUFUS_ROOT}/resources/references/GRCh38_full_analysis_set_plus_decoy_hla.fa" ;; *) echo "Genome $build not yet supported" diff --git a/singularity/launch_utilities/get_1kg_region_file.sh b/singularity/launch_utilities/get_1kg_region_file.sh new file mode 100644 index 00000000..a1ae55ea --- /dev/null +++ b/singularity/launch_utilities/get_1kg_region_file.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +#LOCAL_TESTING_UTIL_PATH=/home/ubuntu/RUFUS/singularity/launch_utilities/ +#UTIL_PATH=$LOCAL_TESTING_UTIL_PATH +: "${RUFUS_ROOT:=/opt/RUFUS}" + +UTIL_PATH=${RUFUS_ROOT}/singularity/launch_utilities/ +CHUNK_UTILITIES=${UTIL_PATH}chunk_utilities.sh +. $CHUNK_UTILITIES + +KG1_FILE_PATH=${RUFUS_ROOT}/resources/1kg_window_hashes/ + +sub_dir=$(get_1kg_file "$1" "$2" "$3") +echo "${KG1_FILE_PATH}${sub_dir}" \ No newline at end of file diff --git a/singularity/launch_utilities/get_region.sh b/singularity/launch_utilities/get_region.sh index 21768f29..d822469c 100644 --- a/singularity/launch_utilities/get_region.sh +++ b/singularity/launch_utilities/get_region.sh @@ -2,7 +2,8 @@ #LOCAL_TESTING_UTIL_PATH=/home/ubuntu/RUFUS/singularity/launch_utilities/ #UTIL_PATH=$LOCAL_TESTING_UTIL_PATH -UTIL_PATH=/opt/RUFUS/singularity/launch_utilities/ +: "${RUFUS_ROOT:=/opt/RUFUS}" +UTIL_PATH=${RUFUS_ROOT}/singularity/launch_utilities/ CHUNK_UTILITIES=${UTIL_PATH}chunk_utilities.sh . $CHUNK_UTILITIES diff --git a/singularity/pull_staged_image.sh b/singularity/pull_staged_image.sh new file mode 100755 index 00000000..ccd1bcc9 --- /dev/null +++ b/singularity/pull_staged_image.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Pull a published RUFUS image from Docker Hub into a SIF on HPC (CHPC). +# +# Replaces the old manual `sudo singularity build rufus.sif rufus.def` flow: the image is now +# built and published by CI, and apptainer converts it to a SIF directly from Docker Hub. +# +# Usage: +# pull_staged_image.sh [tag] [dest_dir] +# tag Docker Hub tag to pull (default: stage). Use a version like v1.1.11 for prod. +# dest_dir Directory to write the SIF into (default: the CHPC zenodo_images dir). +set -euo pipefail + +IMAGE="docker://stefinfection/rufus" +TAG="${1:-stage}" +DEST_DIR="${2:-/uufs/chpc.utah.edu/common/HIPAA/u0746015/marth_software/RUFUS/zenodo_images}" + +command -v apptainer >/dev/null 2>&1 || { echo "ERROR: apptainer not found (try: module load apptainer)"; exit 1; } +mkdir -p "$DEST_DIR" + +SIF_PATH="${DEST_DIR}/rufus_${TAG}.sif" +echo "Pulling ${IMAGE}:${TAG} -> ${SIF_PATH}" +apptainer pull --force "$SIF_PATH" "${IMAGE}:${TAG}" + +echo "Verifying image..." +apptainer exec "$SIF_PATH" bash /opt/RUFUS/tests/smoke_test.sh + +echo "Done: ${SIF_PATH}" diff --git a/singularity/rufus.def b/singularity/rufus.def deleted file mode 100644 index 7ff829f7..00000000 --- a/singularity/rufus.def +++ /dev/null @@ -1,45 +0,0 @@ -Bootstrap: library -From: ubuntu:22.04 - -%labels - Author Stephanie Georges - Version v0.0.1 - -%post - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y git cmake wget g++ build-essential software-properties-common zlib1g-dev libbz2-dev bc libncurses5-dev autoconf automake make liblzma-dev libcurl4-gnutls-dev libssl-dev samtools bamtools bedtools bcftools vt parallel gawk - add-apt-repository ppa:ubuntu-toolchain-r/test - - # install htslib - cd /opt - git clone --recurse-submodules https://github.com/samtools/htslib.git - cd htslib - autoreconf -i - ./configure - make - make install - - # install rufus - cd /opt - git clone https://github.com/stefinfection/RUFUS.git - cd RUFUS - git checkout singularity_gamma - mkdir bin - cd bin - cmake ../ - make - - apt-get purge -y --auto-remove git wget - unset DEBIAN_FRONTEND - -%environment - export PATH=$PATH:/opt/RUFUS/bin - export RUFUS_ROOT=/opt/RUFUS - export LC_CTYPE=en_US.utf8 - -%test - samtools || true - bamtools || true - bedtools || true - bgzip || true diff --git a/singularity/setup_slurm.sh b/singularity/setup_slurm.sh index 7ad5571d..f7b504ed 100644 --- a/singularity/setup_slurm.sh +++ b/singularity/setup_slurm.sh @@ -3,11 +3,31 @@ # 1. A rufus call slurm script # 2. A rufus post-process slurm script # 3. A bash script to batch submit the two above slurm scripts -# v1.0.0-gamma +# d1.1.9 #LOCAL_TESTING_UTIL_PATH=/home/ubuntu/RUFUS/singularity/launch_utilities/ #UTIL_PATH=$LOCAL_TESTING_UTIL_PATH -UTIL_PATH=/opt/RUFUS/singularity/launch_utilities/ + +: "${RUFUS_ROOT:=/opt/RUFUS}" +UTIL_PATH=${RUFUS_ROOT}/singularity/launch_utilities/ + +# TODO: detect the container runtime instead of hard-coding `singularity`. +# +# The SLURM scripts generated below emit `singularity exec ...` (10 sites in this file, plus +# get_region.sh invocations). That works on Apptainer hosts only because Apptainer installs a +# `singularity` compatibility shim -- it is not a guarantee, and a site that ships Apptainer +# without the shim cannot run a generated script. Flipping the literal to `apptainer` just moves +# the breakage to sites still on Singularity CE, so neither hard-coded name is right. Detect once +# here and substitute the result into the generated scripts: +# +# CONTAINER_CMD="$(command -v apptainer || command -v singularity)" \ +# || { echo "ERROR: neither apptainer nor singularity found on PATH" >&2; exit 1; } +# +# Deliberately deferred: this changes every generated SLURM script, which is exactly the machinery +# the sharded whole-genome release gate exercises. Land it after that run, not into it. The docs +# and the newer functional cases (tests/functional/cases/f*.sh) already say/use `apptainer`; this +# file and singularity/tests/ are the remaining holdouts, and those tests are separately stale +# (hard-coded /home/ubuntu paths, references to Child/Mother/Father.bam that do not exist). PARSER=${UTIL_PATH}arg_parser.sh . $PARSER "$@" @@ -20,10 +40,45 @@ CHUNK_UTILITIES=${UTIL_PATH}chunk_utilities.sh NUM_CHUNKS=$(get_num_chunks "$WINDOW_SIZE_RUFUS_ARG" "$GENOME_BUILD_RUFUS_ARG") +# Resolve per-region hashes (download from S3 if needed, validate all exist) +RESOLVE_HASHES=${RUFUS_ROOT}/resource_helpers/resolve_hashes.sh +. $RESOLVE_HASHES + +if [ -n "$KG1_HASH_VERSION" ]; then + KG1_HASH_DIR="$(pwd)/rufus_hashes/kg1" + download_hashes "kg1" "$KG1_HASH_VERSION" "$WINDOW_SIZE_RUFUS_ARG" "$GENOME_BUILD_RUFUS_ARG" "$KG1_HASH_DIR" \ + || { echo "ERROR: Failed to download KG1 hashes"; exit 1; } +fi + +if [ -n "$CONTROL_HASH_VERSION" ]; then + CONTROL_HASH_DIR="$(pwd)/rufus_hashes/control" + download_hashes "control" "$CONTROL_HASH_VERSION" "$WINDOW_SIZE_RUFUS_ARG" "$GENOME_BUILD_RUFUS_ARG" "$CONTROL_HASH_DIR" \ + || { echo "ERROR: Failed to download control hashes"; exit 1; } +fi + +if [ -n "$KG1_HASH_DIR" ]; then + validate_all_region_hashes "$KG1_HASH_DIR" "$WINDOW_SIZE_RUFUS_ARG" "$GENOME_BUILD_RUFUS_ARG" \ + || { echo "ERROR: KG1 hash validation failed"; exit 1; } +fi + +if [ -n "$CONTROL_HASH_DIR" ]; then + validate_all_region_hashes "$CONTROL_HASH_DIR" "$WINDOW_SIZE_RUFUS_ARG" "$GENOME_BUILD_RUFUS_ARG" \ + || { echo "ERROR: Control hash validation failed"; exit 1; } +fi + +# Re-compute bind mounts now that hash dirs may have been set by S3 downloads +BIND_MOUNTS="$(collect_bind_dirs)" + WORKING_DIR=$(pwd) echo -en "##RUFUS_callCommand=" > rufus.cmd +# Build subject args string for runRufus.sh (each subject gets its own -s flag) +SUBJECT_ARGS_STRING="" +for subj in "${SUBJECTS_RUFUS_ARG[@]}"; do + SUBJECT_ARGS_STRING+="-s $subj " +done + # Compose run script(s) RUFUS_SLURM_SCRIPT="rufus_call.slurm" HEADER_LINES=("#!/bin/bash" @@ -31,9 +86,6 @@ HEADER_LINES=("#!/bin/bash" "#SBATCH --time=${SLURM_TIME_LIMIT_RUFUS_ARG}" "#SBATCH --account=${SLURM_ACCOUNT_RUFUS_ARG}" "#SBATCH --partition=${SLURM_PARTITION_RUFUS_ARG}" -"#SBATCH --cpus-per-task=${THREAD_LIMIT_RUFUS_ARG}" -"#SBATCH -o ${WORKING_DIR}/slurm_out/%A_%a.out" -"#SBATCH -e ${WORKING_DIR}/slurm_err/%A_%a.err" ) # Helper function to avoid redundant echoes @@ -48,14 +100,41 @@ function write_out_rest_of_rufus_args() { echo -en "-f $REFERENCE_HASH_RUFUS_ARG " >> $RUFUS_SLURM_SCRIPT echo -en "-f $REFERENCE_HASH_RUFUS_ARG " >> rufus.cmd fi + + # Static exclude hashes (same for all regions) if [ -n "$EXCLUDE_HASH_LIST_RUFUS_ARG" ]; then for exclude in "${EXCLUDE_HASH_LIST_RUFUS_ARG[@]}"; do echo -en "-e $exclude " >> $RUFUS_SLURM_SCRIPT echo -en "-e $exclude " >> rufus.cmd done fi - echo -e "-r $REFERENCE_RUFUS_ARG -m $KMER_DEPTH_CUTOFF_RUFUS_ARG -k 25 -t $THREAD_LIMIT_RUFUS_ARG -L -vs \$REGION_ARG" >> $RUFUS_SLURM_SCRIPT - echo -e "-r $REFERENCE_RUFUS_ARG -m $KMER_DEPTH_CUTOFF_RUFUS_ARG -k 25 -t $THREAD_LIMIT_RUFUS_ARG -L -vs \$REGION_ARG" >> rufus.cmd + + # Per-region hash args (resolved at SLURM job runtime via glob) + if [ -n "$KG1_HASH_DIR" ] || [ -n "$CONTROL_HASH_DIR" ]; then + echo -en "\$HASH_ARGS " >> $RUFUS_SLURM_SCRIPT + echo -en "\$HASH_ARGS " >> rufus.cmd + fi + + # Use -cr for CRAM inputs, -r otherwise (check first subject) + local ref_flag="-r" + if [[ "${SUBJECTS_RUFUS_ARG[0]}" == *.cram ]]; then + ref_flag="-cr" + fi + echo -en "$ref_flag $REFERENCE_RUFUS_ARG -m $KMER_DEPTH_CUTOFF_RUFUS_ARG -k 25 -t $THREAD_LIMIT_RUFUS_ARG -L -vs " >> $RUFUS_SLURM_SCRIPT + echo -en "$ref_flag $REFERENCE_RUFUS_ARG -m $KMER_DEPTH_CUTOFF_RUFUS_ARG -k 25 -t $THREAD_LIMIT_RUFUS_ARG -L -vs " >> rufus.cmd + + if [ "${PAR_LOW_COV_THRESHOLD_RUFUS_ARG}" != "7" ]; then + echo -en "-plct $PAR_LOW_COV_THRESHOLD_RUFUS_ARG " >> $RUFUS_SLURM_SCRIPT + echo -en "-plct $PAR_LOW_COV_THRESHOLD_RUFUS_ARG " >> rufus.cmd + fi + + if [ "$WINDOW_SIZE_RUFUS_ARG" -ne 0 ]; then + echo -en "\$REGION_ARG " >> $RUFUS_SLURM_SCRIPT + echo -en "\$REGION_ARG " >> rufus.cmd + fi + + printf '\n' >> "$RUFUS_SLURM_SCRIPT" + printf '\n' >> rufus.cmd } # Don't overwrite a run if already exists @@ -74,9 +153,32 @@ if [ -n "$EMAIL_RUFUS_ARG" ]; then echo -e "#SBATCH --mail-user=${EMAIL_RUFUS_ARG}" >> $RUFUS_SLURM_SCRIPT fi -if [ "$WINDOW_SIZE_RUFUS_ARG" = "0" ]; then - echo "" >> $RUFUS_SLURM_SCRIPT - echo -e "REGION_ARG=\"\"" >> $RUFUS_SLURM_SCRIPT +if [ "$WINDOW_SIZE_RUFUS_ARG" -eq 0 ]; then + echo -e "#SBATCH --mem=${MEM_PER_JOB}" >> $RUFUS_SLURM_SCRIPT + echo -e "#SBATCH --cpus-per-task=${CPUS_PER_JOB}" >> $RUFUS_SLURM_SCRIPT + echo -e "#SBATCH -o ${WORKING_DIR}/slurm_out/rufus_call_%j.out" >> $RUFUS_SLURM_SCRIPT + echo -e "#SBATCH -e ${WORKING_DIR}/slurm_out/rufus_call_%j.err" >> $RUFUS_SLURM_SCRIPT + printf '\n' >> $RUFUS_SLURM_SCRIPT + + # Resolve whole-genome hash files at setup time (static paths) + if [ -n "$KG1_HASH_DIR" ] || [ -n "$CONTROL_HASH_DIR" ]; then + WG_HASH_ARGS="" + if [ -n "$KG1_HASH_DIR" ]; then + wg_kg1_hash=$(resolve_hash_for_region "$KG1_HASH_DIR" "wg") \ + || { echo "ERROR: Could not resolve whole-genome KG1 hash"; exit 1; } + WG_HASH_ARGS="$WG_HASH_ARGS -e $wg_kg1_hash" + fi + if [ -n "$CONTROL_HASH_DIR" ]; then + wg_ctrl_hash=$(resolve_hash_for_region "$CONTROL_HASH_DIR" "wg") \ + || { echo "ERROR: Could not resolve whole-genome control hash"; exit 1; } + WG_HASH_ARGS="$WG_HASH_ARGS -e $wg_ctrl_hash" + fi + echo -e "HASH_ARGS=\"${WG_HASH_ARGS}\"" >> $RUFUS_SLURM_SCRIPT + fi + + echo -en "srun --mem=${MEM_PER_JOB} singularity exec --bind ${BIND_MOUNTS}${DEV_BIND_ARGS} ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/runRufus.sh $SUBJECT_ARGS_STRING" >> $RUFUS_SLURM_SCRIPT + echo -en "srun --mem=${MEM_PER_JOB} singularity exec --bind ${BIND_MOUNTS}${DEV_BIND_ARGS} ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/runRufus.sh $SUBJECT_ARGS_STRING" >> rufus.cmd + write_out_rest_of_rufus_args else # Add a chunk for post-processing if [ "$SLURM_ARRAY_JOB_LIMIT_RUFUS_ARG" -lt $((NUM_CHUNKS + 1)) ]; then @@ -90,7 +192,7 @@ else # Get remainder that needs to be distributed amongst the last N scripts (0-based count) NUM_JOBS_PLUS_ONE=$((NUM_CHUNKS % ADJ_SLURM_ARRAY_LIMIT)) - echo "NUM_JOBS_PLUS_ONE: $NUM_JOBS_PLUS_ONE" + # echo "NUM_JOBS_PLUS_ONE: $NUM_JOBS_PLUS_ONE" # 3102 % 999 = 105 # Get the switch point (i.e. the 0-based array index number where we need to have +1 on the base count) @@ -110,17 +212,24 @@ else echo -e "INFO: $NUM_JOBS_PLUS_ONE slurm array jobs will be run with $((BASE_COUNT_PER_SCRIPT + 1)) rufus calls per script" echo "ERROR: Calculation error in determining number of jobs per script; could not create SLURM scripts" exit 1 - else - echo -e "INFO: $NUM_JOBS_BASE_COUNT slurm array jobs will be run with $BASE_COUNT_PER_SCRIPT rufus calls per script" - echo -e "INFO: $NUM_JOBS_PLUS_ONE slurm array jobs will be run with $((BASE_COUNT_PER_SCRIPT + 1)) rufus calls per script" - echo -e "INFO: 1 slurm array job will be run to combine results" - echo -e "INFO: to fit into the allotted $SLURM_ARRAY_JOB_LIMIT_RUFUS_ARG jobs" fi + # Keeping until final job distribution schema settled on + #else + # echo -e "INFO: $NUM_JOBS_BASE_COUNT slurm array jobs will be run with $BASE_COUNT_PER_SCRIPT rufus calls per script" + # echo -e "INFO: $NUM_JOBS_PLUS_ONE slurm array jobs will be run with $((BASE_COUNT_PER_SCRIPT + 1)) rufus calls per script" + # echo -e "INFO: 1 slurm array job will be run to combine results" + # echo -e "INFO: to fit into the allotted $SLURM_ARRAY_JOB_LIMIT_RUFUS_ARG jobs" + #fi + # Write out the slurm header ADJ_SLURM_ARRAY_END=$((ADJ_SLURM_ARRAY_LIMIT - 1)) + echo -e "#SBATCH --mem=${MEM_PER_JOB}" >> $RUFUS_SLURM_SCRIPT + echo -e "#SBATCH --cpus-per-task=${CPUS_PER_JOB}" >> $RUFUS_SLURM_SCRIPT + echo -e "#SBATCH -o ${WORKING_DIR}/slurm_out/rufus_call_%A_%a.out" >> $RUFUS_SLURM_SCRIPT + echo -e "#SBATCH -e ${WORKING_DIR}/slurm_err/rufus_call_%A_%a.err" >> $RUFUS_SLURM_SCRIPT echo -e "#SBATCH -a 0-${ADJ_SLURM_ARRAY_END}%${SLURM_JOB_LIMIT_RUFUS_ARG}" >> $RUFUS_SLURM_SCRIPT - echo "" >> $RUFUS_SLURM_SCRIPT + printf '\n' >> $RUFUS_SLURM_SCRIPT # Write out the region argument and srun command echo -e "job_count=$BASE_COUNT_PER_SCRIPT" >> $RUFUS_SLURM_SCRIPT @@ -134,10 +243,24 @@ else echo -e "fi" >> $RUFUS_SLURM_SCRIPT echo -e "for i in \$(seq 0 \$((\$job_count - 1))); do" >> $RUFUS_SLURM_SCRIPT echo -e " curr_job=\$((\$starting_index + \$i))" >> $RUFUS_SLURM_SCRIPT - echo -e " region_arg=\$(singularity exec ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/singularity/launch_utilities/get_region.sh \"\$curr_job\" \"$WINDOW_SIZE_RUFUS_ARG\" \"$GENOME_BUILD_RUFUS_ARG\")" >> $RUFUS_SLURM_SCRIPT + echo -e " region_arg=\$(singularity exec ${CONTAINER_PATH_RUFUS_ARG} bash ${RUFUS_ROOT}/singularity/launch_utilities/get_region.sh \"\$curr_job\" \"$WINDOW_SIZE_RUFUS_ARG\" \"$GENOME_BUILD_RUFUS_ARG\")" >> $RUFUS_SLURM_SCRIPT echo -e " REGION_ARG=\"-R \$region_arg\"" >> $RUFUS_SLURM_SCRIPT - echo -en " srun --mem=0 singularity exec --bind ${HOST_DATA_DIR_RUFUS_ARG}:/mnt ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/runRufus.sh -s /mnt/$SUBJECT_RUFUS_ARG " >> $RUFUS_SLURM_SCRIPT - echo -en "srun --mem=0 singularity exec --bind ${HOST_DATA_DIR_RUFUS_ARG}:/mnt ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/runRufus.sh -s /mnt/$SUBJECT_RUFUS_ARG " >> rufus.cmd + + # Per-region hash resolution (validated at setup time, glob guaranteed to match exactly one file) + if [ -n "$KG1_HASH_DIR" ] || [ -n "$CONTROL_HASH_DIR" ]; then + echo -e " fmtd_region=\$(echo \"\$region_arg\" | tr ':-' '_')" >> $RUFUS_SLURM_SCRIPT + echo -e " HASH_ARGS=\"\"" >> $RUFUS_SLURM_SCRIPT + if [ -n "$KG1_HASH_DIR" ]; then + echo -e " kg1_hash=\$(ls ${KG1_HASH_DIR}/*\${fmtd_region}*.Jhash)" >> $RUFUS_SLURM_SCRIPT + echo -e " HASH_ARGS=\"\$HASH_ARGS -e \$kg1_hash\"" >> $RUFUS_SLURM_SCRIPT + fi + if [ -n "$CONTROL_HASH_DIR" ]; then + echo -e " ctrl_hash=\$(ls ${CONTROL_HASH_DIR}/*\${fmtd_region}*.Jhash)" >> $RUFUS_SLURM_SCRIPT + echo -e " HASH_ARGS=\"\$HASH_ARGS -e \$ctrl_hash\"" >> $RUFUS_SLURM_SCRIPT + fi + fi + echo -en " srun --mem=${MEM_PER_JOB} singularity exec --bind ${BIND_MOUNTS}${DEV_BIND_ARGS} ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/runRufus.sh $SUBJECT_ARGS_STRING" >> $RUFUS_SLURM_SCRIPT + echo -en "srun --mem=${MEM_PER_JOB} singularity exec --bind ${BIND_MOUNTS}${DEV_BIND_ARGS} ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/runRufus.sh $SUBJECT_ARGS_STRING" >> rufus.cmd echo -en "-pa \$SLURM_ARRAY_TASK_ID " >> $RUFUS_SLURM_SCRIPT echo -en "-cn \$curr_job " >> $RUFUS_SLURM_SCRIPT write_out_rest_of_rufus_args @@ -149,10 +272,25 @@ else echo "" >> $RUFUS_SLURM_SCRIPT # Write out the region argument and srun command - echo -e "region_arg=\$(singularity exec ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/singularity/launch_utilities/get_region.sh \"\$SLURM_ARRAY_TASK_ID\" \"$WINDOW_SIZE_RUFUS_ARG\" \"$GENOME_BUILD_RUFUS_ARG\")" >> $RUFUS_SLURM_SCRIPT + echo -e "region_arg=\$(singularity exec ${CONTAINER_PATH_RUFUS_ARG} bash ${RUFUS_ROOT}/singularity/launch_utilities/get_region.sh \"\$SLURM_ARRAY_TASK_ID\" \"$WINDOW_SIZE_RUFUS_ARG\" \"$GENOME_BUILD_RUFUS_ARG\")" >> $RUFUS_SLURM_SCRIPT echo -e "REGION_ARG=\"-R \$region_arg\"" >> $RUFUS_SLURM_SCRIPT - echo -en "srun --mem=0 singularity exec --bind ${HOST_DATA_DIR_RUFUS_ARG}:/mnt ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/runRufus.sh -s /mnt/$SUBJECT_RUFUS_ARG " >> $RUFUS_SLURM_SCRIPT - echo -en "srun --mem=0 singularity exec --bind ${HOST_DATA_DIR_RUFUS_ARG}:/mnt ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/runRufus.sh -s /mnt/$SUBJECT_RUFUS_ARG " >> rufus.cmd + + # Per-region hash resolution (validated at setup time, glob guaranteed to match exactly one file) + if [ -n "$KG1_HASH_DIR" ] || [ -n "$CONTROL_HASH_DIR" ]; then + echo -e "fmtd_region=\$(echo \"\$region_arg\" | tr ':-' '_')" >> $RUFUS_SLURM_SCRIPT + echo -e "HASH_ARGS=\"\"" >> $RUFUS_SLURM_SCRIPT + if [ -n "$KG1_HASH_DIR" ]; then + echo -e "kg1_hash=\$(ls ${KG1_HASH_DIR}/*\${fmtd_region}*.Jhash)" >> $RUFUS_SLURM_SCRIPT + echo -e "HASH_ARGS=\"\$HASH_ARGS -e \$kg1_hash\"" >> $RUFUS_SLURM_SCRIPT + fi + if [ -n "$CONTROL_HASH_DIR" ]; then + echo -e "ctrl_hash=\$(ls ${CONTROL_HASH_DIR}/*\${fmtd_region}*.Jhash)" >> $RUFUS_SLURM_SCRIPT + echo -e "HASH_ARGS=\"\$HASH_ARGS -e \$ctrl_hash\"" >> $RUFUS_SLURM_SCRIPT + fi + fi + + echo -en "srun --mem=${MEM_PER_JOB} singularity exec --bind ${BIND_MOUNTS}${DEV_BIND_ARGS} ${CONTAINER_PATH_RUFUS_ARG} bash ${RUFUS_ROOT}/runRufus.sh $SUBJECT_ARGS_STRING" >> $RUFUS_SLURM_SCRIPT + echo -en "srun --mem=${MEM_PER_JOB} singularity exec --bind ${BIND_MOUNTS}${DEV_BIND_ARGS} ${CONTAINER_PATH_RUFUS_ARG} bash ${RUFUS_ROOT}/runRufus.sh $SUBJECT_ARGS_STRING" >> rufus.cmd write_out_rest_of_rufus_args fi fi @@ -164,8 +302,9 @@ PP_HEADER_LINES=("#!/bin/bash" "#SBATCH --account=${SLURM_ACCOUNT_RUFUS_ARG}" "#SBATCH --partition=${SLURM_PARTITION_RUFUS_ARG}" "#SBATCH --output=${WORKING_DIR}/slurm_out/rufus_post_process_%j.out" -"#SBATCH --error=${WORKING_DIR}/slurm_err/rufus_post_process_%j.err" -"#SBATCH --nodes=1" +"#SBATCH --error=${WORKING_DIR}/slurm_err/rufus_post_process_%j.err" +"#SBATCH --cpus-per-task=10" +"#SBATCH --mem=1G" ) for line in "${PP_HEADER_LINES[@]}" @@ -182,13 +321,10 @@ echo "" >> $PP_SLURM_SCRIPT IFS=$',' CONTROL_STRING="${CONTROLS_RUFUS_ARG[*]}" -BOUND_DATA_DIR="/mnt" - -echo -e "srun singularity exec --bind ${HOST_DATA_DIR_RUFUS_ARG}:/mnt ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/post_process/post_process.sh -w $WINDOW_SIZE_RUFUS_ARG -r $REFERENCE_RUFUS_ARG -c $CONTROL_STRING -s $SUBJECT_RUFUS_ARG -d ${BOUND_DATA_DIR}" >> $PP_SLURM_SCRIPT +echo -e "srun singularity exec --bind ${BIND_MOUNTS}${DEV_BIND_ARGS} ${CONTAINER_PATH_RUFUS_ARG} bash ${RUFUS_ROOT}/post_process/post_process.sh -s ${SUBJECTS_RUFUS_ARG[0]} -w $WINDOW_SIZE_RUFUS_ARG" >> $PP_SLURM_SCRIPT echo -en "##RUFUS_postProcessCommand=" >> rufus.cmd -echo -e "srun singularity exec --bind ${HOST_DATA_DIR_RUFUS_ARG}:/mnt ${CONTAINER_PATH_RUFUS_ARG} bash /opt/RUFUS/post_process/post_process.sh -w $WINDOW_SIZE_RUFUS_ARG -r $REFERENCE_RUFUS_ARG -c $CONTROL_STRING -s $SUBJECT_RUFUS_ARG -d ${BOUND_DATA_DIR}" >> rufus.cmd -mv rufus.cmd "${HOST_DATA_DIR_RUFUS_ARG}" +echo -e "srun singularity exec --bind ${BIND_MOUNTS}${DEV_BIND_ARGS} ${CONTAINER_PATH_RUFUS_ARG} bash ${RUFUS_ROOT}/post_process/post_process.sh -s ${SUBJECTS_RUFUS_ARG[0]} -w $WINDOW_SIZE_RUFUS_ARG" >> rufus.cmd # Compose invocation script to be executed outside of container EXE_SCRIPT=launch_rufus.sh @@ -204,4 +340,4 @@ echo -e "# Launch post-process job - will wait on calling phase to complete" >> echo -e "sbatch --depend=afterany:\$ARRAY_JOB_ID $PP_SLURM_SCRIPT" >> $EXE_SCRIPT echo -e "Slurm scripts ready to execute with $EXE_SCRIPT. Please make sure singularity is available in your environment, and then run... " -echo -e "bash $EXE_SCRIPT" +echo -e "bash $EXE_SCRIPT" \ No newline at end of file diff --git a/src/._RUFUS.interpret.cpp b/src/._RUFUS.interpret.cpp deleted file mode 100644 index efa3f86f..00000000 Binary files a/src/._RUFUS.interpret.cpp and /dev/null differ diff --git a/src/AnnotateOverlap.fasta.cpp b/src/AnnotateOverlap.fasta.cpp deleted file mode 100644 index 4422ce2c..00000000 --- a/src/AnnotateOverlap.fasta.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/*This vertion imcorporates both copy number and mutation detection in 1 - * * it needs to be run in two sptes, first the build, then the filter - * * it is split up to allow distribution to a cluster */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Util.h" - -using namespace std; - -int main(int argc, char *argv[]) { - int HashSize; - double vm, rss, MAXvm, MAXrss; - MAXvm = 0; - MAXrss = 0; - Util::process_mem_usage(vm, rss, MAXvm, MAXrss); - int BufferSize = 1000; - ifstream MutHashFile; - MutHashFile.open(argv[1]); - string filename = argv[2]; - ifstream MutFile; - - if (filename == "stdin") { - MutFile.open("/dev/stdin"); - } else { - MutFile.open(argv[2]); - } - - string line; - unordered_map Mutations; - ofstream HashOut; - HashOut.open(argv[3]); - int lines = 0; - string L1; - string L2; - string L3; - string L4; - unsigned long LongHash; - bool notdone = true; - - while (getline(MutHashFile, L1)) { - vector temp; - temp = Util::Split(L1, '\t'); - - if (temp.size() == 2) { - unsigned long b = Util::HashToLong(temp[0].c_str()); - Mutations.insert( - pair(b, atoi(temp[1].c_str()))); - HashSize = temp[0].length(); - } else if (temp.size() == 4) { - unsigned long b = Util::HashToLong(temp[3].c_str()); - Mutations.insert( - pair(b, atoi(temp[2].c_str()))); - HashSize = temp[3].length(); - } else if (temp.size() == 1) { - temp = Util::Split(L1, ' '); - unsigned long b = Util::HashToLong(temp[0].c_str()); - Mutations.insert( - pair(b, atoi(temp[1].c_str()))); - HashSize = temp[0].length(); - } - } - MutHashFile.close(); - - int who = RUSAGE_SELF; - struct rusage usage; - int b = getrusage(RUSAGE_SELF, &usage); - clock_t St, Et; - St = clock(); - int found = 0; - lines = 0; - - while (getline(MutFile, L1)) { - lines++; - getline(MutFile, L2); - vector positions; - vector HashPos; - - for (int i = 0; i < L2.size(); i++) { - HashPos.push_back(0); - } - - int rejected = 0; - int MutHashesFound = 0; - for (int i = 0; i < L2.length() - HashSize; i++) { - string hash = L2.substr(i, HashSize); - string Qhash = L4.substr(i, HashSize); - bool good = true; - - for (int j = 0; j < HashSize; j++) { - int B = hash.c_str()[j]; - if (B == 78) { - good = false; - break; - } - - - int C = Qhash.c_str()[j]; - if ((int)C -33 < 3) - good = false; - } - if (good) { - unsigned long LongHash = Util::HashToLong(hash); - if (Mutations.count(LongHash) > 0) { - positions.push_back(i); - - for (int j = i; j < i + HashSize; j++) { - HashPos[j]++; - } - } else if (Mutations.count(Util::HashToLong(Util::RevComp(hash))) > 0) { - positions.push_back(i); - - for (int j = i; j < i + HashSize; j++) { - HashPos[j]++; - } - } - } - } - cout << L1 << ":MH" << MutHashesFound << endl << L2 << endl << "+" << endl; - - if (HashPos[0] < 93) - cout << char(HashPos[0] + 33); - else - cout << char(126); - for (int i = 1; i < HashPos.size(); i++) { - if (HashPos[i] < 93) - cout << char(HashPos[i] + 33); - else - cout << char(126); - } - - for (int i = 0; i < L2.size() - HashSize; i++) { - string hash = L2.substr(i, HashSize); - string rev = Util::RevComp(hash); - if (hash < rev) - HashOut << hash << " 1" << endl; - else - HashOut << rev << " 1" << endl; - } - cout << endl; - } - HashOut.close(); - MutFile.close(); -} diff --git a/src/AnnotateOverlap.multi.cpp b/src/AnnotateOverlap.multi.cpp deleted file mode 100644 index 640d7695..00000000 --- a/src/AnnotateOverlap.multi.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/*This vertion imcorporates both copy number and mutation detection in 1 - * * it needs to be run in two sptes, first the build, then the filter - * * it is split up to allow distribution to a cluster */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Util.h" - -using namespace std; -class fasta{ - public: - - string name; - string seq; - string sep; - string qual; - -}; - -int main(int argc, char *argv[]) { - int HashSize; - double vm, rss, MAXvm, MAXrss; - MAXvm = 0; - MAXrss = 0; - Util::process_mem_usage(vm, rss, MAXvm, MAXrss); - int BufferSize = 1000; - ifstream MutHashFile; - MutHashFile.open(argv[1]); - string filename = argv[2]; - ifstream MutFile; - - if (filename == "stdin") { - MutFile.open("/dev/stdin"); - } else { - MutFile.open(argv[2]); - } - - string line; - unordered_map Mutations; - ofstream HashOut; - HashOut.open(argv[3]); - string L1; - string L2; - string L3; - string L4; - unsigned long LongHash; - bool notdone = true; - - while (getline(MutHashFile, L1)) { - vector temp; - temp = Util::Split(L1, '\t'); - - if (temp.size() == 2) { - unsigned long b = Util::HashToLong(temp[0].c_str()); - Mutations.insert( - pair(b, atoi(temp[1].c_str()))); - HashSize = temp[0].length(); - } else if (temp.size() == 4) { - unsigned long b = Util::HashToLong(temp[3].c_str()); - Mutations.insert( - pair(b, atoi(temp[2].c_str()))); - HashSize = temp[3].length(); - } else if (temp.size() == 1) { - temp = Util::Split(L1, ' '); - unsigned long b = Util::HashToLong(temp[0].c_str()); - Mutations.insert( - pair(b, atoi(temp[1].c_str()))); - HashSize = temp[0].length(); - } - } - MutHashFile.close(); - int who = RUSAGE_SELF; - struct rusage usage; - int b = getrusage(RUSAGE_SELF, &usage); - clock_t St, Et; - St = clock(); - int found = 0; - int size = 10000; - - while (getline(MutFile, L1)) { - vector buffer; - getline(MutFile, L2); - getline(MutFile, L3); - getline(MutFile, L4); - - fasta temp; - temp.name = L1; - temp.seq = L2; - temp.sep = L3; - temp.qual = L4; - buffer.push_back(temp); - int count = 1; - while (count < size && getline(MutFile, L1)) - { - getline(MutFile, L2); - getline(MutFile, L3); - getline(MutFile, L4); - - fasta temp; - temp.name = L1; - temp.seq = L2; - temp.sep = L3; - temp.qual = L4; - buffer.push_back(temp); - count++; - } - #pragma omp parallel for num_threads(50) - for (int b = 0; b < buffer.size(); b++) - { - fasta entry = buffer[b]; - unordered_map LMutations; - LMutations = Mutations; - vector positions; - vector HashPos; - for (int i = 0; i < entry.seq.size(); i++) { - HashPos.push_back(0); - } - int rejected = 0; - int MutHashesFound = 0; - for (int i = 0; i < entry.seq.length() - HashSize; i++) { - string hash = entry.seq.substr(i, HashSize); - string Qhash = entry.qual.substr(i, HashSize); - bool good = true; - - for (int j = 0; j < HashSize; j++) { - int B = hash.c_str()[j]; - if (B == 78) { - good = false; - break; - } - - - int C = Qhash.c_str()[j]; - if ((int)C -33 < 3) - good = false; - } - if (good) { - unsigned long LongHash = Util::HashToLong(hash); - if (LMutations.count(LongHash) > 0) { - positions.push_back(i); - - for (int j = i; j < i + HashSize; j++) { - HashPos[j]++; - } - } else if (LMutations.count(Util::HashToLong(Util::RevComp(hash))) > 0) { - positions.push_back(i); - - for (int j = i; j < i + HashSize; j++) { - HashPos[j]++; - } - } - } - } - - { - cout << entry.name << ":MH" << MutHashesFound << endl << entry.seq << endl << entry.sep << endl; - - if (HashPos[0] < 93) - cout << char(HashPos[0] + 33); - else - cout << char(126); - for (int i = 1; i < HashPos.size(); i++) { - if (HashPos[i] < 93) - cout << char(HashPos[i] + 33); - else - cout << char(126); - } - - for (int i = 0; i < buffer[b].seq.size() - HashSize; i++) { - string hash = buffer[b].seq.substr(i, HashSize); - string rev = Util::RevComp(hash); - if (hash < rev) - HashOut << hash << " 1" << endl; - else - HashOut << rev << " 1" << endl; - } - cout << endl; - } - } - } - HashOut.close(); - MutFile.close(); -} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index acde045f..5724cb59 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,6 +33,7 @@ add_library(rufus_core STATIC OverlapSam.cpp ReplaceQwithDinFASTQD.cpp RUFUS.Filter.cpp + RUFUS.Filter.single.cpp RUFUS.Build.cpp RUFUS.1kg.filter.cpp PassThroughSamCheck.cpp @@ -105,6 +106,13 @@ target_link_libraries(RUFUS.Filter ${RUFUS_UTIL} ) +add_executable(RUFUS.Filter.single + RUFUS.Filter.single.cpp +) +target_link_libraries(RUFUS.Filter.single + ${RUFUS_UTIL} +) + add_executable(RUFUS.interpret RUFUS.interpret.cpp ) diff --git a/src/DumpSamReadKmerCount.cpp b/src/DumpSamReadKmerCount.cpp deleted file mode 100644 index b43b4800..00000000 --- a/src/DumpSamReadKmerCount.cpp +++ /dev/null @@ -1,1100 +0,0 @@ -/*By ANDREW FARRELL - * OverlapSam.cpp - * -------------------------------------------------- - * Assembles k-mers containing variation into contigs - * that represent the variant sequence - * -------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "Util.h" - -using namespace std; -unordered_map Mutations; -int HashSize = -1; -bool FullOut = false; -unordered_map DupCheck; -int Align3(vector& sequenes, vector& quals, string Ap, string Aqp, int Ai, int& overlap, int& index, float minPercentpassed, bool& PerfectMatch, int MinOverlapPassed, int Threads) -{ - int QualityOffset = 33; //=64; - int MinQual = 20; - bool verbose = false; - int bestScore = 0; - int NumReads = sequenes.size(); - int start = Ai + 1; - int end = start + 3; - if (end > sequenes.size()) - { - end = sequenes.size(); - } - - #pragma omp parallel for shared(Ap, Aqp, index, overlap, bestScore) num_threads(Threads) - for (int j = start; j < end; j++) - { - int MinOverlap = MinOverlapPassed; - float minPercent = minPercentpassed; - int LocalBestScore = 0; - int LocalIndex = -1; - int LocalOverlap = 0; - string A; - int Alen; - string Aq; - //#pragma omp critical - { - A = Ap; - Alen = A.length(); - Aq = Aqp; - } - string B; - string Bq; - int Blength = -1; - int Alength = Alen; - int k; - - //#pragma omp critical - { - B = sequenes[j]; - Bq = quals[j]; - } - Blength = B.length(); - int window = -1; - int longest = -1; - bool Asmaller = true; - - if (Blength > Alength) - { - window = Alength; - longest = Blength; - Asmaller = false; - } - else - { - window = Blength; - longest = Alength; - Asmaller = true; - } - - int MM = window - (window * minPercent); - int Acount = 0; - int Bcount = 0; - - for (int i = 0; i <= longest - window; i++) - { - float score = 0; - //first check where the reads completely overlap - for (k = 0; k < window; k++) - { - if (A.c_str()[k + Acount] == B.c_str()[k + Bcount]) - { - if (B.c_str()[k + Bcount] != 'N' && (int)Aq.c_str()[k + Acount] > 5 && (int)Bq.c_str()[k + Bcount] > 5) - { - score++; - } - } - if ((k - score) > MM) - { - score = -1; - break; - } - } - - if (Asmaller) - { - Acount++; - } else { - Bcount++; - } - - if (verbose) - { - cout << " Score = " << score << endl; - } - - float percent = score / (window); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - if (Asmaller) - { - LocalOverlap = i * -1; - } else { - LocalOverlap = i; - } - } - if (score == window) { - PerfectMatch = true; - break; - } - } - } - - if (PerfectMatch == false) - { - for (int i = window - 1; i >= MinOverlap; i--) - { - if (verbose) {cout << "i = " << i << endl;} - - float score = 0; - for (k = 0; k <= i; k++) - { - if (verbose) {cout << " k = " << k << " so A = " << Alength - i + k<< " /\\ B = " << 0 + k << endl;} - if (verbose) {cout << " A >> " << A.c_str()[Alength - i + k - 1] << "="<< B.c_str()[0 + k] << " << B" << endl;} - - if (A.c_str()[Alength - i + k - 1] == B.c_str()[0 + k]) - { - if (B.c_str()[0 + k] != 'N' && (int)Aq.c_str()[Alength - i + k - 1] > 5 &&(int)Bq.c_str()[0 + k] > 5) - { - score++; - } - } - if ((k - score) > MM) { - score = -1; - break; - } - } - if (verbose) {cout << " Score = " << score << endl;} - - float percent = score / (k); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = i - Alength + 1; - if (score == i) - { - break; - } - } - } - } - - for (int i = window - 1; i >= MinOverlap; i--) - { - if (verbose) { cout << "i = " << i << endl;} - float score = 0; - for (k = 0; k <= i; k++) { - if (B.c_str()[Blength - i + k - 1] == A.c_str()[0 + k]) - { - if (A.c_str()[0 + k] != 'N' && (int)Aq.c_str()[0 + k] > 5 && (int)Bq.c_str()[Blength - i + k - 1] > 5) - { - score++; - } - } - if ((k - score) > MM) { - score = -1; - break; - } - } - - if (verbose) {cout << " Score = " << score << endl;} - - float percent = score / (k); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = Blength - i - 1; - if (score == i) - { - break; - } - } - } - } - } - #pragma omp critical(updateCounts) - { - if (bestScore < LocalBestScore) { - bestScore = LocalBestScore; - index = LocalIndex; - overlap = LocalOverlap; - } - } - } - return bestScore; -} - -string ColapsContigs(string A, string B, int k, string Aq, string& Bq, - string& Ad, string& Bd, string& As, string& Bs) { - bool verbose = false; - if (verbose) { - cout << "Combinding; \n" << A << endl << B << endl; - } - - int Asize = A.length(); - int Bsize = B.length(); - - int Aoffset = 0; - int Boffset = 0; - int window; - string newString = ""; - string newQual = ""; - string newDepth = ""; - - if (k > 0) { - Aoffset = k; - } else { - Boffset = abs(k); - } - - if (verbose) { - cout << "K = " << k << " so Aofset = " << Aoffset - << " and Boffset = " << Boffset << endl; - } - - for (int i = 0; i < Asize + Bsize; i++) { - char Abase = 'Z'; - char Bbase = 'Z'; - char Aqual = '!'; - char Bqual = '!'; - unsigned char Adep = 0; - unsigned char Bdep = 0; - - if (((i - Aoffset) >= 0) && ((i - Aoffset) < A.length())) { - Abase = A.c_str()[i - Aoffset]; - Aqual = Aq.c_str()[i - Aoffset]; - Adep = Ad.c_str()[i - Aoffset]; - } else { - Abase = 'Z'; - Aqual = '!'; - Adep = 0; - } - - if (i - Boffset >= 0 && i - Boffset < B.length()) { - Bbase = B.c_str()[i - Boffset]; - Bqual = Bq.c_str()[i - Boffset]; - Bdep = Bd.c_str()[i - Boffset]; - } else { - Bbase = 'Z'; - Bqual = '!'; - Bdep = 0; - } - - if (verbose) { - cout << "I = " << i << " Bi = " << i - Boffset << " Ai = " << i - Aoffset - << " thus " << Abase << "-" << Bbase << endl; - } - - if (Abase == Bbase && Abase != 'Z') { - newString += Abase; - - if (Aqual >= Bqual) { - newQual += Aqual; - } else { - newQual += Bqual; - } - - if ((int)Adep + (int)Bdep < 250) { - newDepth += (Adep + Bdep); - } else { - newDepth += 250; - } - - } else if (Abase == 'Z' && Bbase != 'Z') { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } else if (Abase != 'Z' && Bbase == 'Z') { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else if (Abase != 'Z' && Bbase != 'Z') { - - if (Abase == 'N' && Bbase != 'N') { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } else if (Abase != 'N' && Bbase == 'N') { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else if (Aqual >= Bqual) { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } - - } else if (Abase == 'Z' && Bbase == 'Z') { - Bq = newQual; - Bd = newDepth; - break; - } - } - Bq = newQual; - Bd = newDepth; - Bs += As; - return newString; -} - -string TrimNends(string S, string& qual) { - bool base = false; - string NewS = ""; - string NewQ = ""; - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } else if (S.c_str()[i] != 'A' && S.c_str()[i] != 'C' && - S.c_str()[i] != 'G' && S.c_str()[i] != 'T') { - } else { - base = true; - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } - } - qual = NewQ; - return NewS; -} - -string TrimLowCoverageEnds(string S, string& quals, string& depth, int cutoff) { - bool base = false; - string NewS = ""; - string NewD = ""; - string NewQ = ""; - - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } - } - - if (NewS.size() > 1) { - S = NewS; - depth = NewD; - quals = NewQ; - base = false; - NewS = ""; - NewD = ""; - NewQ = ""; - - for (int i = 0; i < S.size(); i++) { - if (base) { - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } - } - } - depth = NewD; - quals = NewQ; - return NewS; -} - -string AdjustBases(string sequence, string qual) { - int MinQ = 10; - int QualOffset = 32; - string NewString = ""; - for (int i = 0; i < sequence.length(); i++) { - if (qual.c_str()[i] - QualOffset < MinQ) { - NewString += 'N'; - } else { - NewString += sequence.c_str()[i]; - } - } - - if (NewString != sequence) { - return NewString; - } -} - -bool replace(std::string& str, const std::string& from, const std::string& to) { - size_t start_pos = str.find(from); - if (start_pos == std::string::npos) { - return false; - } - str.replace(start_pos, from.length(), to); - return true; -} - -bool validateFASTQD(string& L1, string& L2, string& L3, string& L4, string& L5, - string& L6) { - if (L1.c_str()[0] != '@') { - cout << "error header problems - " << L1 << endl; - return false; - } - if (L2.size() != L4.size()) { - cout << "error sequence and qual problems - \n" << L2 << endl - << L4 << endl; - return false; - } - vector temp = Util::Split(L6, ' '); - if (temp.size() != L2.size()) { - cout << "error counts problems - " << L2.size() << " != " << temp.size() - << endl; - return false; - } - return true; -} - -bool IsBitSet(int num, int bit) { return 1 == ((num >> bit) & 1); } - -int GetReadOrientation(int flag) { - bool is_set = IsBitSet(flag, 4); - cout << "flag is " << flag << endl; - cout << "orientation is " << is_set << endl; - return is_set; -} - -string FlipStrands(string strand) { - string NewStrand = ""; - for (int i = 0; i < strand.size(); i++) { - if (strand.c_str()[i] == '+') - NewStrand += "-"; - else if (strand.c_str()[i] == '-') - NewStrand += "+"; - else if(strand.c_str()[i] == '.') - NewStrand += "."; - } - return NewStrand; -} - -void compresStrand(string S, int& F, int& R) { - for (int i = 0; i < S.size(); i++) { - if (S.c_str()[i] == '+') - F++; - else if (S.c_str()[i] == '-') - R++; - } - return; -} -int CountHashes(string seq) -{ - int count=0; - for (int i = 0; i < seq.size()-HashSize; i++) - { - string hash = seq.substr(i, HashSize); - size_t found = hash.find("N"); - if (found == string::npos) - { - if(Mutations.count(Util::HashToLong( hash)) > 0) - {count++;} - } - } - return count; -} -int NumLowQbases(string qual, int min) -{ - int count = 0; - for (int i =0; i < qual.size(); i++) - { - if( int(qual.c_str()[i]) - 33 < min) - count++; - } - return count; -} -int main(int argc, char* argv[]) { - float MinPercent; - int MinOverlap; - int MinCoverage; - cout << "you gave " << argc << " Arguments" << endl; - if (argc != 10) { - cout << "ERROR, wrong numbe of arguemnts\nCall is: SAM, MinPercent, " - "MinOverlap, MinCoverage, ReportStub, NodeStub LCcutoff Threads" - << endl - << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] - << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] - << "\n FileStub = " << argv[5] - << "\n NodeStub = " << argv[6] - << "\n MinCov = " << argv[7] - << "\n HashPath = " << argv[8] - << "\n Threads = " << argv[9] - << endl; - return 0; - } - cout << "ERROR, wrong numbe of arguemnts\nCall is: SAM, MinPercent, " - "MinOverlap, MinCoverage, ReportStub, NodeStub LCcutoff Threads" - << endl - << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] - << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] - << "\n FileStub = " << argv[5] - << "\n NodeStub = " << argv[6] - << "\n MinCovTrimCov = " << argv[7] - << "\n HashPath = " << argv[8] - << "\n Threads = " << argv[9] - << endl; - - ifstream fastq; - fastq.open(argv[1]); - if (fastq.is_open()) { - cout << "File open - " << argv[1] << endl; - } else { - cout << "Error, ParentHashFile could not be opened"; - return 0; - } - - string temp = argv[2]; - MinPercent = atof(temp.c_str()); - temp = argv[3]; - MinOverlap = atoi(temp.c_str()); - temp = argv[4]; - MinCoverage = atoi(temp.c_str()); - temp = argv[7]; - int LCcutoff = atoi(temp.c_str()); - string HashPath = argv[8]; - temp = argv[9]; - int Threads = atoi(temp.c_str()); - ofstream report; - string FirstPassFile = argv[1]; - std::stringstream ss; - ss << argv[5] << ".fastq"; - FirstPassFile = ss.str(); - report.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile << endl; - return 0; - } - - ofstream Depreport; - FirstPassFile += "d"; - Depreport.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile << endl; - return 0; - } - - string line; - std::vector sequenes; - std::vector qual; - std::vector depth; - std::vector strand; - std::vector Unsequenes; - std::vector Unqual; - std::vector Undepth; - std::vector Unstrand; - int lines = -1; - string L1; - string L2; - string L3; - string L4; - string L5; - string L6; - unsigned long LongHash; - int Rejects = 0; - string Fastqd = argv[1]; - cout << "Reading in SAM \n"; - int counter = 0; - int unalignedCounter = 0; - int goodreads = 0; - int lowMapQual = 0; - int other = 0; - cout << "reading in hash list" << endl; - ifstream MutHashFile; - MutHashFile.open(HashPath); - if (MutHashFile.is_open()) { - cout << "Parent File open - " << argv[1] << endl; - } // cout << "##File Opend\n"; - else { - cout << "Error, ParentHashFile could not be opened"; - return 0; - } - - - while (getline(MutHashFile, L1)) { - vector temp; - temp = Util::Split(L1, '\t'); - - if (temp.size() == 2) { - unsigned long b = Util::HashToLong(temp[0]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[0])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - HashSize = temp[0].size(); - } else if (temp.size() == 4) { - unsigned long b = Util::HashToLong(temp[3]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[3])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - HashSize = temp[3].size(); - } - if (temp.size() == 1) { - temp = Util::Split(L1, ' '); - unsigned long b = Util::HashToLong(temp[0]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[0])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - HashSize = temp[0].size(); - } - } - - if (HashSize == -1) - { - cout << "ERROR Hash Size could not be determined by the HashFile" << endl; - return -1; - } - cout << "HashSize = " << HashSize << endl; - - while (getline(fastq, L1)) { - counter++; - //cout << L1 << endl; - if (counter % 100 == 1) { - cout << "Read in " << counter << " reads, with " << goodreads << " aligned reads, " << unalignedCounter<< " unaligned reads, " << lowMapQual << "low map qual and " << other <<" other with rejected " << Rejects - << " reads\r"; - } - - vector temp = Util::Split(L1, '\t'); - int ReadSize = temp[10].size(); - bool b[16]; - int v = atoi(temp[1].c_str()); - - //TODO: understand this syntax - for (int j = 0; j < 16; ++j) - { - b[j] = 0 != (v & (1 << j)); - } - //if (DupCheck.count(temp[9]) > 0) - //{ - // cout << "skipping exact match sequence " << L1 << endl; - //} - //else - { - int lowq = NumLowQbases(temp[10], 20); - DupCheck[temp[9]] == true; - if (b[8] or b[11] or b[10] or temp[9].length() < 100 or lowq > 50) - { - //cout << "rejected" << endl; - //cout << L1 << endl; - Rejects++; - } - else if ( b[2] )//or atoi(temp[4].c_str())<5) - { - if (b[2]) - unalignedCounter++; - else if (atoi(temp[4].c_str())<5) - lowMapQual++; - else - other++; - string L4 = temp[10]; - string L2 = temp[9]; ////////sequence////////// - L2 = TrimNends(L2, L4); - int hashes = CountHashes(L2); - - cout << "poorly_mapped_read " << L1 << " " << hashes << endl; - //cout << "with Hash = " << hashes << endl; - if ((double)L2.size() / (double)ReadSize > .6) - { - ReadSize = L2.size(); - lines++; - Unsequenes.push_back(L2); - Unqual.push_back(L4); - if (hashes > 0) - { - if (b[0]== 0) - { - Unstrand.push_back("."); - } - else if (b[4] == 0) - { - Unstrand.push_back("+"); - } - else if (b[4] == 1) - { - Unstrand.push_back("-"); - } - } - else - Unstrand.push_back("."); - - string depths = ""; - unsigned char C = 1; - - for (int i = 0; i < L2.length(); i++) - { - depths += C; - } - - Undepth.push_back(depths); - - } - else - { - Rejects++; - } - - } - else - { - goodreads++; - //cout << "good alignment" << endl; - string L4 = temp[10]; - string L2 = temp[9]; - L2 = TrimNends(L2, L4); - int hashes = CountHashes(L2); - cout << "mapped_read " << L1 << " " << hashes << endl; - //cout << "Hash = " << hashes << endl; - if ((double)L2.size() / (double)ReadSize > .6) - { - ReadSize = L2.size(); - lines++; - sequenes.push_back(L2); - qual.push_back(L4); - string depths = ""; - - if (hashes > 0) - { - if (b[0]== 0) - { - strand.push_back("."); - } - else if (b[4] == 0) - { - strand.push_back("+"); - } - else if (b[4] == 1) - { - strand.push_back("-"); - } - } - else - strand.push_back("."); - - unsigned char C = 1; - - for (int i = 0; i < L2.length(); i++) - { - depths += C; - } - - depth.push_back(depths); - - } - else - { - Rejects++; - } - } - } - } - return 0; - - cout << endl; - int NumReads = sequenes.size(); - cout << "\nDone reading in \n Read in a total of " << NumReads + Rejects - << " and rejected " << Rejects << endl; - clock_t St, Et; - float Dt; - - struct timeval start, end; - gettimeofday(&start, NULL); - int FoundMatch = 0; - St = clock(); - - for (std::vector::size_type i = 0; i < sequenes.size(); i++) - { - string A = sequenes[i]; - string Aqual = qual[i]; - string Adep = depth[i]; - string Astr = strand[i]; - - if (FullOut) { - cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<**************************************************************>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << endl; - } - - Et = clock(); - - if ((int)i % 10 < 1){ - gettimeofday(&end, NULL); - float Dt = end.tv_sec - start.tv_sec; - cout << "aligning " << i << " of " << NumReads << ", \% done = " << ((double)i / (double)NumReads) * 100.00<< ", TotalTime= " << Dt << " , second per read = " << Dt / i<< ", \% finding match = "<< ((double)FoundMatch / (double)i) * 100.00 << "\r"; - } - - if (FullOut) { - Dt = ((double)(Et - St)) / CLOCKS_PER_SEC; - cout << "aligning " << i << " of " << NumReads - << "\% done = " << ((double)i / (double)NumReads) * 100.00 - << ", TotalTime= " << Dt << " , second per read = " << Dt / i - << ", \% finding match = " - << ((double)FoundMatch / (double)i) * 100.00 << endl - << A << endl; - - for (int z = 0; z < Adep.length(); z++) { - int bam = Adep.c_str()[z]; - cout << bam; - } - cout << endl; - } - - int k = -1; - int bestIndex = -1; - bool PerfectMatch = false; - int booya = Align3(sequenes, qual, A, Aqual, i, k, bestIndex, MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) { - cout << "best forward score is " << booya << " k is " << k << endl; - } - - if (!(PerfectMatch)) { - string revA = Util::RevComp(A); - string revAqual = Util::RevQual(Aqual); - string revAdep = Util::RevQual(Adep); - string revAstr = FlipStrands(Astr); - int revk = -1; - int revbestIndex = -1; - int revbooya = - Align3(sequenes, qual, revA, revAqual, i, revk, revbestIndex, - - MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) { - cout << "best reverse score is " << revbooya << " k is " << revk - << endl; - } - - if (revbooya > booya) { - A = revA; - Aqual = revAqual; - Adep = revAdep; - Astr = revAstr; - k = revk; - booya = revbooya; - bestIndex = revbestIndex; - } - - } else { - if (FullOut) { - cout << "Perfect Match Found, Skipping Referse Search" << endl; - } - } - - if (booya < MinOverlap) { - if (FullOut) { - cout << "No good match found, skipping" << endl; - } - } else { - FoundMatch++; - string B = sequenes[bestIndex]; - string Bqual = qual[bestIndex]; - string Bdep = depth[bestIndex]; - string Bstr = strand[bestIndex]; - - if (k > 0) { - - if (FullOut) { - cout << "found match at " << k << endl; - - for (int z = 0; z < k; z++) { - cout << "+"; - } - - cout << A << endl << B << endl; - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - - cout << endl; - } - } else { - if (FullOut) { - cout << "found match at " << k << endl; - cout << A << endl; - - for (int z = 0; z < abs(k); z++) { - cout << "-"; - } - - cout << B << endl; - - for (int z = 0; z < abs(k); z++) { - cout << "-"; - } - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - - cout << endl; - } - } - - if (i == bestIndex) { - cout << "ERROR ____________________ SAME READS " << endl; - } - if (A.size() != Adep.size() && B.size() != Bdep.size()) { - cout << " ERRPR somethis the wrong size\n A= " << A.size() - << " Ad = " << Adep.size() << " B= " << B.size() - << " Bd = " << Bdep.size() << endl; - } - - string combined = - ColapsContigs(A, B, k, Aqual, Bqual, Adep, Bdep, Astr, Bstr); - - if (combined.size() != Bdep.size()) { - cout << " ERRPR combined is the wrong size\n C= " << combined.size() - << " Bd = " << Bdep.size() << endl; - } - - sequenes[bestIndex] = combined; - qual[bestIndex] = Bqual; - depth[bestIndex] = Bdep; - strand[bestIndex] = Bstr; - sequenes[i] = "moved"; - - if (FullOut) { - cout << combined << endl; - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - } - } - } - - cout << "\n\nRESULTS\n"; - int count = 0; - for (int i = 0; i < sequenes.size(); i++) { - - if (FullOut) { - cout << ">>>>" << sequenes[i] << endl; - } - - if (sequenes[i] != "moved" && sequenes[i].size() >= 95) { - string rDep = depth[i]; - int maxDep = -1; - - for (int z = 0; z < rDep.size(); z++) { - unsigned char bam = rDep.c_str()[z]; - if ((int)bam > maxDep) { - maxDep = (int)bam; - } - } - - if (maxDep >= MinCoverage && maxDep >= 2) { - - if (sequenes[i].size() != qual[i].size() && qual[i].size() != depth[i].size()) { - cout << "ERROR, read " - << "@NODE_" << argv[6] << "_" << i << "_L=" << sequenes[i].size() - << "_D=" << maxDep - << " Has the wrong size, Seq = " << sequenes[i].size() - << " Qual = " << qual[i].size() << " Dep = " << depth[i].size() - << endl; - } - - count++; - int F = 0; - int R = 0; - compresStrand(strand[i], F, R); - report << "@NODE_" << argv[6] << "_" << i << "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; - report << sequenes[i] << endl; - report << "+" << endl; - report << qual[i] << endl; - - Depreport << "@NODE_" << argv[6] << "_" << i<< "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; - Depreport << sequenes[i] << endl; - Depreport << "+" << endl; - Depreport << qual[i] << endl; - Depreport << strand[i] << endl; - unsigned char C = depth[i].c_str()[0]; - int booya = C; - Depreport << booya; - - for (int w = 1; w < depth[i].size(); w++) { - C = depth[i].c_str()[w]; - booya = C; - Depreport << " " << booya; - } - - Depreport << endl; - } - } - } - if (MinCoverage <= 1 ) - { - for (int i = 0; i < Unsequenes.size(); i++) { - - if (FullOut) { - cout << ">>>>" << Unsequenes[i] << endl; - } - - if (Unsequenes[i] != "moved" && Unsequenes[i].size() >= 95) { - int maxDep = -1; - - if (Unsequenes[i].size() != Unqual[i].size() && - Unqual[i].size() != Undepth[i].size()) { - cout << "ERROR, read " - << "@NODE_" << argv[6] << "_" << i << "_L=" << Unsequenes[i].size() - << "_D=" << maxDep - << " Has the wrong size, Seq = " << Unsequenes[i].size() - << " Qual = " << Unqual[i].size() << " Dep = " << Undepth[i].size() - << endl; - } - - count++; - report << "@NODE_" << argv[6] << "_" << i << "_L=" << Unsequenes[i].size() - << "_D" << maxDep << endl; - report << Unsequenes[i] << endl; - report << "+" << endl; - report << Unqual[i] << endl; - - Depreport << "@NODE_" << argv[6] << "_" << i - << "_L=" << Unsequenes[i].size() << "_D" << maxDep << endl; - Depreport << Unsequenes[i] << endl; - Depreport << "+" << endl; - Depreport << Unqual[i] << endl; - Depreport << Unstrand[i] << endl; - unsigned char C = Undepth[i].c_str()[0]; - int booya = C; - Depreport << booya; - - for (int w = 1; w < Undepth[i].size(); w++) { - C = Undepth[i].c_str()[w]; - booya = C; - Depreport << " " << booya; - } - - Depreport << endl; - } - } - } - else - cout << "min coverage = " << MinCoverage << " skipping Unaligned sequences" << endl; - cout << "\nWrote " << count << " sequences" << endl; - report.close(); -} diff --git a/src/ModelDist.cpp b/src/ModelDist.cpp index 4b018df9..7280e321 100644 --- a/src/ModelDist.cpp +++ b/src/ModelDist.cpp @@ -537,6 +537,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = @@ -572,6 +573,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = testModel(SClow + ((SChigh - SClow) / 10) * x, bestS, bestF, @@ -604,6 +606,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = @@ -640,6 +643,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = testModelLog(bestSC, bestS, bestF, @@ -680,6 +684,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = testModelLog(bestSC, bestS, bestF, bestSK, diff --git a/src/ModelDist.haploid b/src/ModelDist.haploid deleted file mode 100755 index 0fdc8a1b..00000000 Binary files a/src/ModelDist.haploid and /dev/null differ diff --git a/src/ModelDist.haploid.cpp b/src/ModelDist.haploid.cpp index bdde7ebd..76fd3381 100644 --- a/src/ModelDist.haploid.cpp +++ b/src/ModelDist.haploid.cpp @@ -550,6 +550,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = @@ -585,6 +586,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = testModel(SClow + ((SChigh - SClow) / 10) * x, bestS, bestF, @@ -617,6 +619,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = @@ -653,6 +656,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = testModelLog(bestSC, bestS, bestF, @@ -693,6 +697,7 @@ int main(int argc, char* argv[]) { count++; double values[9]; +// THREADS TODO: pass in $Threads variable instead of hardcoding 11 #pragma omp parallel for num_threads(11) for (int x = 0; x <= 10; x++) { values[x] = testModelLog(bestSC, bestS, bestF, bestSK, diff --git a/src/Overlap.cpp b/src/Overlap.cpp index fb61c2ec..7170890c 100644 --- a/src/Overlap.cpp +++ b/src/Overlap.cpp @@ -1,4 +1,4 @@ -/*By ANDREW FARRELL +/*By ANDREW FARRELL; updated by SJG Jul2025 * Overlap.cpp * -------------------------------------------------- * Assembles k-mers containing variation into contigs @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include "Util.h" @@ -31,170 +31,213 @@ using namespace std; bool FullOut = false; -int RebuildHashTable(vector& sequenes, int Ai, int SearchHash, unordered_map>& Hashes, int Threads, unordered_map& Hashesize) +struct OverlapArgs { + string FastqIn; + float MinPercent; + long int MinOverlap; + long int MinCoverage; + string NameStub; + long int hashLength; + long int ACT; // the alignment count threshold (how many times a kmer must be found in the sequences to be considered for alignment) + string OverlapStub; + long int TrimLCcuttoff; + long int Threads; + bool verbose = false; +}; + +/* + Completely clears and builds the Hashes hash table, which has (numeric hash of) kmer as keys and a vector as the value, which contains + all indices of full-length reads in "sequences" array that contain that kmer. This needs to be re-populated occassionally to + ensure that the hash table is up to date with the latest sequences after some have been collapsed and moved. +*/ +int RebuildHashTable(vector& sequences, int Ai, int hashLength, unordered_map>& Hashes, int Threads) { - cout << "\nDestrying HashTable\n"; + cout << "\nDestroying HashTable\n"; Hashes.clear(); cout << "HashTable destroyed\n"; cout << "Rebuilding HashTable - starting at " << Ai << endl; - int size = sequenes.size(); + int size = sequences.size(); - #pragma omp parallel for num_threads(12) shared(Hashes) + #pragma omp parallel for num_threads(Threads) shared(Hashes, sequences) for (int i = Ai; i < size; i++) { if (i % 10000 > 1 && i % 10000 < Threads) { - //pragma omp critical (sequenes) - {cout << " Hashed " << i << " of " << sequenes.size() << "\r";} - + #pragma omp critical (progressOut) + { + cout << "Hashed " << i << " of " << sequences.size() << "\r"; + } } - string Sequence; - //pragma omp critical (sequenes) - {Sequence = sequenes[i];} - int LoopLimit = Sequence.size() - SearchHash; + // Iterate through the sequence and get hashLength sized chunks + // If the chunk does NOT have an 'N' in it, add it to the hash table + string Sequence = sequences[i]; + int LoopLimit = Sequence.size() - hashLength; for (int j = 0; j < LoopLimit; j++) { - string hash = Sequence.substr(j, SearchHash); + string hash = Sequence.substr(j, hashLength); size_t found = hash.find('N'); - if (found == std::string::npos) { + if (found == std::string::npos) { // npos is a constant for "not found" unsigned long LongHash = Util::HashToLong(hash); unsigned long RevHash = Util::HashToLong(Util::RevComp(hash)); + + // Add sequene index to hash table #pragma omp critical(updateHash) { Hashes[LongHash].push_back(i); Hashes[RevHash].push_back(i); - } //end pragma?? - } //end if - } - } - Hashesize.clear(); - for (auto it = Hashes.begin(); it != Hashes.end(); it++) - { - Hashesize[it->first] = it->second.size(); + } + } + } } cout << "\nDone Rebulding HashTable size is " << Hashes.size() << endl; return 0; } -int PrepairSearchList(string A, int Ai, unordered_map>& Hashes,int SearchHash, int ACT, map>& array,bool& hitPosLimit, bool& hitIndexLimit, int& NumberPos, int& NumberIndex , unordered_map& Hashesize) +/* + For a single sequence, iterates through each kmer of hashLength N and looks to see what sequences it is + contained within (i.e. the indexes of those sequences in "sequences" array). + Counts how many times each kmer is found in the sequences, and if it is found more than ACT times, + it is considered a candidate for alignment. + Stores the results in the array map, which has the index of the sequence as key and a vector of indexes of sequences + that contain that kmer as value. + + Note: This function is called within a parallel section from main, hence the critical sections. + + Parameters: + A: sequence to search + Ai: the index of the sequence in the original list which is not passed here + hashLength: the window for creating kmers + ACT: the alignment count threshold (how many times a kmer must be found in the sequences to be considered for alignment) + Hashes: the hash table containing the kmer as key and a vector of indexes of sequences containing that kmer as value +*/ +int PrepareSearchList(string A, int Ai, unordered_map>& Hashes, int hashLength, int ACT, map>& array,bool& hitPosLimit, bool& hitIndexLimit, int& NumberPos, int& NumberIndex) { int Alength = A.size(); map Positions; int added = 0; - for (int i = 0; i < Alength - SearchHash; i++) { - string hash = A.substr(i, SearchHash); + // Iterate through each kmer in sequence A + for (int i = 0; i < Alength - hashLength; i++) { + string hash = A.substr(i, hashLength); size_t found = hash.find('N'); if (found == std::string::npos) { + // Pull out list of sequences that contain this kmer from hash table unsigned long LongHash = Util::HashToLong(hash); - int max=0; - - #pragma omp atomic - max += Hashesize[LongHash]; - for (vector::size_type i = 0; i < max; i++) + #pragma omp critical(updateHash) { - int holder = 0; - #pragma omp atomic - holder += Hashes[LongHash][i]; - if (holder > Ai ){//+ 1) { - - if (Positions.count(holder) > 0) { - Positions[holder]++; - added++; - } else { - Positions[holder] = 1; - added++; - } - } + int numMatches = Hashes[LongHash].size(); + + // Iterate through sequences that contain this kmer + for (vector::size_type j = 0; j < numMatches; j++) { + int holder = Hashes[LongHash][j]; // Index of sequence which "holds" this kmer + + // Avoid redundant comparisons by only looking at sequences that are after the current sequence A + // I.e. we've already processed any sequences before us in the 'sequences' array + if (holder > Ai){ + if (Positions.count(holder) > 0) { + Positions[holder]++; + added++; + } else { + Positions[holder] = 1; + added++; + } + } - if (added > 100000) { - hitPosLimit = true; - NumberPos = added; - break; + if (added > 100000) { + hitPosLimit = true; + NumberPos = added; + break; + } } } } } if (FullOut) { - cout << "done Hashing read" << endl; + #pragma omp critical(progressOut) + { + cout << "done Hashing read" << endl; + } } + // Sort our postions by the number of times a kmer was found in the sequence at that position + // i.e. the highest value of the Positions map to the lowest value NumberPos = added; map::iterator uspos; multimap SortedPositions; - for (uspos = Positions.begin(); uspos != Positions.end(); ++uspos) { - if (uspos->second > ACT) - { - SortedPositions.insert(std::make_pair(uspos->second,uspos->first)); - } - } + for (uspos = Positions.begin(); uspos != Positions.end(); ++uspos) { + if (uspos->second > ACT) + { + SortedPositions.insert(std::make_pair(uspos->second,uspos->first)); + } + } if (FullOut) { - cout << "found - " << Positions.size() << " possible locations" << endl; + #pragma omp critical(progressOut) + { + cout << "found - " << Positions.size() << " possible locations" << endl; + } } map::iterator pos; vector indexes; int sanity = 0; - + // Check to make sure that we are meeting our minimum alignment count threshold (ACT) for (auto pos = SortedPositions.rbegin() ; pos != SortedPositions.rend(); pos++) - { + { if (pos->first >= ACT) { - indexes.push_back(pos->second + 0); + indexes.push_back(pos->second + 0); sanity++; - if (sanity > 1000) { - hitIndexLimit = true; - NumberIndex = sanity; - break; - } - } - + if (sanity > 1000) { + hitIndexLimit = true; + NumberIndex = sanity; + break; + } } + } + NumberIndex = sanity; - #pragma omp critical (array) - { array[Ai] = indexes; } + #pragma omp critical (array) + { + array[Ai] = indexes; + } if (FullOut) { - cout << " " << indexes.size() << " locations passed filter" << endl; + #pragma omp critical(progressOut) + { + cout << " " << indexes.size() << " locations passed filter" << endl; + } } return 1; } -int Align3(vector& sequenes, string Ap, string Aq, int Ai, int& overlap,int& BestIndex, float minPercent, bool& PerfectMatch, int MinOverlap,vector& indexes, int Threads, int NumReads) +int Align3(vector& sequenes, string Ap, string Aq, int Ai, int& overlap, int& BestIndex, float minPercent, bool& PerfectMatch, int MinOverlap,vector& indexes, int Threads, int NumReads) { int QualityOffset = 33; bool verbose = false; int Alength = Ap.size(); int bestScore = 0; - #pragma omp parallel for num_threads(Threads) shared(BestIndex) - for (int booya = 0; booya < indexes.size(); booya++) + #pragma omp parallel for num_threads(Threads) shared(BestIndex, overlap, bestScore, PerfectMatch, sequenes) + for (int i = 0; i < indexes.size(); i++) { - string A; - int AlengthL; - int j; - //pragma omp critical (A) - { - A = Ap; - AlengthL = A.size(); - j = indexes[booya]; - } - string B; - bool localcheck; - //pragma omp critical (sequenes) - {B = sequenes[j];} + string A = Ap; + int AlengthL = A.size(); + int j = indexes[i]; + + string B = sequenes[j]; float score = 0; int Blength = B.size(); - int k; + int window = -1; int longest = -1; bool Asmaller = true; + bool LocalPerfectMatch = false; if (Blength > AlengthL) { @@ -214,6 +257,7 @@ int Align3(vector& sequenes, string Ap, string Aq, int Ai, int& overlap, int Loverlap = 0; int Acount = 0; int Bcount = 0; + int k; for (int i = 0; i <= longest - window; i++) { @@ -260,14 +304,15 @@ int Align3(vector& sequenes, string Ap, string Aq, int Ai, int& overlap, if (score == window) { - PerfectMatch = true; + LocalPerfectMatch = true; break; } } } } - if (PerfectMatch == false) + // If we haven't found a perfect match, continue searching for overlaps + if (LocalPerfectMatch == false) { for (int i = window - 1; i >= MinOverlap; i--) { @@ -333,7 +378,7 @@ int Align3(vector& sequenes, string Ap, string Aq, int Ai, int& overlap, float percent = score / (k); - if (percent > minPercent) + if (percent >= minPercent) { if (LbestScore < score) { @@ -349,16 +394,35 @@ int Align3(vector& sequenes, string Ap, string Aq, int Ai, int& overlap, } #pragma omp critical (best) { - if (LbestScore > bestScore) { - bestScore = LbestScore; - BestIndex = LBestIndex; - overlap = Loverlap; + if (LbestScore > bestScore || + (LbestScore == bestScore && LBestIndex < BestIndex) || + (LbestScore == bestScore && LBestIndex == BestIndex && Loverlap < overlap)) { + bestScore = LbestScore; + BestIndex = LBestIndex; + overlap = Loverlap; + } + // Only want to update this logic if we have found a perfect match + if (LocalPerfectMatch) { + PerfectMatch = true; } } } return bestScore; } +/* Combines sequences A and B into a single contiguous string. + * k is the offset between A and B, where positive k means A is upstream of B. + * Aq, Bq, Ad, Bd, As, Bs are the quality strings, depth strings, and strand strings for A and B respectively. + * Returns the combined string. + * + * Merges sequences based on the following logic: + * 1. If both sequences have the same base at a position → use that base, take the higher quality score, + * and sum the depths (capped at 250) + * 2. If only one sequence has a base at that position → use that sequence's data + * 3. If sequences disagree → prefer the base with higher depth, or if depths are equal, prefer the one with higher quality + * + * Updates the reference parameters (Bq, Bd, Bs) with the merged quality scores, depth data, and combined sequence information + */ string ColapsContigs(string A, string B, int k, string Aq, string& Bq,string Ad, string& Bd, string As, string& Bs) { bool verbose = false; if (verbose) {cout << "Combining; \n" << A << endl << B << endl;} @@ -505,8 +569,10 @@ string TrimNends(string S, string& qual) { qual = NewQ; return NewS; -} +} +// The reason this is done is because if a couple of contigs have a gap in them (because of illumina problem not haplotype) +// we won't collapse them on the first round without trimming these ends string TrimLowCoverageEnds(string S, string& quals, string& depth, int cutoff) { bool base = false; string NewS = ""; @@ -564,10 +630,7 @@ string AdjustBases(string sequence, string qual) { NewString += sequence.c_str()[i]; } } - - if (NewString != sequence) { - return NewString; - } + return NewString; } bool replace(std::string& str, const std::string& from, const std::string& to) { @@ -593,7 +656,7 @@ string FlipStrands(string strand) { } return NewStrand; } -void compresStrand(string S, int& F, int& R) { +void compressStrand(string S, int& F, int& R) { for (int i = 0; i < S.size(); i++) { if (S.c_str()[i] == '+') F++; @@ -603,104 +666,100 @@ void compresStrand(string S, int& F, int& R) { return; } +bool parse_args(int argc, char* argv[], OverlapArgs& args) { + + // todo: test if this is correct number logic + if (argc < 10) { + cout << argc << " arguments provided, but at least 10 are required.\n"; + for (int i = 0; i < argc; i++) { + cout << "Arg " << i << ": " << argv[i] << endl; + } + cout << "Usage: " << argv[0] << " " + " " + " [--verbose]\n"; + return false; + } + + args.FastqIn = argv[1]; + args.MinPercent = stof(argv[2]); + args.MinOverlap = strtol(argv[3], nullptr, 0); + args.MinCoverage = strtol(argv[4], nullptr, 0); + args.NameStub = argv[5]; + args.hashLength = strtol(argv[6], nullptr, 0); + args.ACT = strtol(argv[7], nullptr, 0); + args.OverlapStub = argv[8]; + args.TrimLCcuttoff = strtol(argv[9], nullptr, 0); + args.Threads = strtol(argv[10], nullptr, 0); + + cout << "There were at least 10 args" << endl; + return true; +} + int main(int argc, char* argv[]) { - int SearchHash = 30; - int ACT = 0; - float MinPercent; - int MinOverlap; - int MinCoverage; - cout << "you gave " << argc << " Arguments" << endl; - - if (argc != 11) { - cout << "ERROR, wrong numbe of arguemnts\nCall is: FASTQ, MinPercent, " - "MinOverlap, MinCoverage, ReportStub, SearchHashSize, ACT, OutFile " - "LCendTrimEpth Threads" - << endl; - return 0; + + OverlapArgs args; + if (!parse_args(argc, argv, args)) { + cout << "Error overlap parsing arguments. Please check the usage." << endl; + return 1; // Error in argument parsing } + long int Buffer = 100; + // long int Buffer = 100 * args.Threads; - THIS LEADS TO NON-DETERMINISM + // Check & open file streams ifstream fastq; - fastq.open(argv[1]); - - if (fastq.is_open()) { - cout << "Parent File open - " << argv[1] << endl; - } // cout << "##File Opend\n"; - else { - cout << "Error, ParentHashFile could not be opened"; - return 0; + fastq.open(args.FastqIn.c_str()); + if (!fastq.is_open()) { + cout << "Error, Fastq file could not be opened - " << args.FastqIn << endl; + return -1; } - //TODO: Factor out temps and cast to string - string temp = argv[2]; - MinPercent = atof(temp.c_str()); - temp = argv[3]; - MinOverlap = atoi(temp.c_str()); - temp = argv[4]; - MinCoverage = atoi(temp.c_str()); - temp = argv[6]; - SearchHash = atoi(temp.c_str()); - temp = argv[7]; - ACT = atoi(temp.c_str()); - temp = argv[9]; - int TrimLCcuttoff = atoi(temp.c_str()); - temp = argv[10]; - int Threads = atoi(temp.c_str()); - int Buffer = 100 * Threads; ofstream report; std::stringstream ss; - string FirstPassFile = argv[1]; - ss << argv[8] << ".fastq"; + string FirstPassFile = args.FastqIn; + ss << args.OverlapStub << ".fastq"; FirstPassFile = ss.str(); report.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile + if (!report.is_open()) { + cout << "Error, Mut-Output file could not be opened - " << FirstPassFile << endl; - return 0; + return -1; } - ofstream Depreport; + ofstream DepReport; FirstPassFile += "d"; - Depreport.open(FirstPassFile.c_str()); - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile + DepReport.open(FirstPassFile.c_str()); + if (!report.is_open()) { + cout << "Error, Mut-Output depth file could not be opened - " << FirstPassFile << endl; - return 0; + return -1; } ofstream good; FirstPassFile = ss.str(); FirstPassFile += "good.fastq"; good.open(FirstPassFile.c_str()); - - if (good.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile + if (!good.is_open()) { + cout << "Error, Mut-Output good file could not be opened - " << FirstPassFile << endl; - return 0; + return -1; } ofstream bad; FirstPassFile = ss.str(); FirstPassFile += "bad.fastq"; bad.open(FirstPassFile.c_str()); - - if (bad.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile + if (!bad.is_open()) { + cout << "Error, Mut-Output bad file could not be opened - " << FirstPassFile << endl; return 0; } string line; - vector sequenes; // = new vector; - vector qual; //= new vector; - vector depth; // = new vector; - vector strand; - std::unordered_map> Hashes; - std::unordered_map Hashesize; + vector sequenes; // The array of full-length sequences extracted from the input fastq file + vector qual; // An array of the per-nucleotide qualities corresponding to the sequences + vector depth; // An array of the per-nucleotide kmer-depths corresponding to the sequences + vector strand; // An array of the strands each sequence is located on + std::unordered_map> Hashes; // The hash table of kmer hashes to indices of sequences containing that kmer int lines = -1; int goodlines = 0; int dup = 0; @@ -711,9 +770,11 @@ int main(int argc, char* argv[]) { string L5; string L6; int Rejects = 0; - string Fastqd = argv[1]; + string Fastqd = args.FastqIn; size_t found = Fastqd.find(".fastqd"); + // Read in entire fastq file, 6 lines at a time + // If we're reading in a fastq+depth file, we simply trim off the low coverage ends before starting to process the reads if (found != string::npos) { int counter = 0; cout << "ATTENTION - Fastq+depth input detected, reading in FASTQD file \n"; @@ -743,12 +804,11 @@ int main(int argc, char* argv[]) { } } - //Multiple = false; if (Multiple == true) { - L2 = TrimLowCoverageEnds(L2, L4, depths, TrimLCcuttoff); + L2 = TrimLowCoverageEnds(L2, L4, depths, args.TrimLCcuttoff); } - if (L2.size() > SearchHash + 1) { + if (L2.size() > args.hashLength + 1) { lines++; sequenes.push_back(L2); qual.push_back(L4); @@ -760,6 +820,8 @@ int main(int argc, char* argv[]) { bad << L1 << endl << L2 << endl << L3 << endl << L4 << endl; } } + // If we have a fastq file, we (should be) checking for duplicates, trimming Ns, and adjustung + // bases based on quality values before processing reads } else { vector DupCheck; cout << "Reading in raw fastq \n"; @@ -789,33 +851,37 @@ int main(int argc, char* argv[]) { bool found = false; bool RunDupCheck = true; - if (RunDupCheck) { - -#pragma omp parallel for num_threads(Threads) shared(DupCheck, L2, found) - for (int i = 0; i < DupCheck.size(); i++) { - if (L2.size() == DupCheck[i].size()) { - bool AllBasesMatch = true; - - for (int k = 0; k < L2.size(); k++) { - if (L2.c_str()[k] == 'N' or DupCheck[i].c_str()[k] == 'N') { - } else if (L2.c_str()[k] == DupCheck[i].c_str()[k]) { - } else { - AllBasesMatch = false; - break; - } - } - - if (AllBasesMatch) { - #pragma omp critical (found) - { found = true; } - } - } - } - - if ((double)Ns / (double)L2.size() < 0.20) { - DupCheck.push_back(L2); - } - } + // if (RunDupCheck) { + + // // BUG FIX NEEDED + // // NOTE: this is currently NEVER run because nothing added to DupCheck until we've already run the loop + // #pragma omp parallel for num_threads(args.Threads) shared(DupCheck, L2, found) + // for (int i = 0; i < DupCheck.size(); i++) { + // if (L2.size() == DupCheck[i].size()) { + // bool AllBasesMatch = true; + + // for (int k = 0; k < L2.size(); k++) { + // if (L2.c_str()[k] == 'N' or DupCheck[i].c_str()[k] == 'N') { + // } else if (L2.c_str()[k] == DupCheck[i].c_str()[k]) { + // } else { + // AllBasesMatch = false; + // break; + // } + // } + + // if (AllBasesMatch) { + // #pragma omp critical (found) + // { + // found = true; + // } + // } + // } + // } + + // if ((double)Ns / (double)L2.size() < 0.20) { + // DupCheck.push_back(L2); + // } + // } if (found == false) { L2 = AdjustBases(L2, L4); @@ -845,16 +911,20 @@ int main(int argc, char* argv[]) { DupCheck.clear(); } + good.close(); bad.close(); cout << "done reading " << endl; - int NumReads = sequenes.size(); + int NumReads = sequenes.size(); cout << "\nDone reading in \n Read in a total of " << lines << " and rejected " << Rejects << " with " << dup << " duplicate reads detected for a total of " << goodlines << "good reads" << endl; - RebuildHashTable(sequenes, 0, SearchHash, Hashes, Threads, Hashesize); + + // First kmer table build after reading in all of the fastq/d reads + RebuildHashTable(sequenes, 0, args.hashLength, Hashes, args.Threads); + clock_t St, Et; int FoundMatch = 0; struct timeval start, end; @@ -867,11 +937,13 @@ int main(int argc, char* argv[]) { double AverageRPos = 0.0; double AverageRSanity = 0.0; + // Outer loop iterating through every sequence in chunks of Buffer size for (std::vector::size_type b = 0; b < sequenes.size(); b += Buffer) { LinesSinceLastBuild += Buffer; - if (LinesSinceLastBuild > 1000000) { - RebuildHashTable(sequenes, b, SearchHash, Hashes, Threads, Hashesize); + // Rebuild hash table every million lines + if (LinesSinceLastBuild > 1000000) { + RebuildHashTable(sequenes, b, args.hashLength, Hashes, args.Threads); LinesSinceLastBuild = 0; } @@ -879,7 +951,7 @@ int main(int argc, char* argv[]) { vector ToAddPos; map> Forwards; map> Revs; - int max = b + Buffer; + int max = b + Buffer; // todo: check off by one errors here if (max > sequenes.size()) { max = sequenes.size(); @@ -889,8 +961,8 @@ int main(int argc, char* argv[]) { cout << "Bulding list to align" << endl; } - -#pragma omp parallel for num_threads(Threads) shared(Hashes, Forwards) + // For each sequence in chunk, prepare list of potential alignment matches by comparing kmers + #pragma omp parallel for num_threads(args.Threads) shared(Hashes, Forwards) for (int i = b; i < max; i++) { string A = sequenes[i]; @@ -898,7 +970,7 @@ int main(int argc, char* argv[]) { bool sanityLimit = false; int NumPos = 0; int NumSanity = 0; - PrepairSearchList(A, i, Hashes, SearchHash, ACT, Forwards, posLimit,sanityLimit, NumPos, NumSanity, Hashesize); + PrepareSearchList(A, i, Hashes, args.hashLength, args.ACT, Forwards, posLimit, sanityLimit, NumPos, NumSanity); if (posLimit) { NumberHitPosLimit++; } @@ -909,7 +981,7 @@ int main(int argc, char* argv[]) { AverageFSanity = ((AverageFSanity * (double)b) + (double)NumSanity) /((double)b + 1.0); } -#pragma omp parallel for num_threads(Threads) shared(Hashes, Revs) + #pragma omp parallel for num_threads(args.Threads) shared(Hashes, Revs) for (int i = b; i < max; i++) { string A = Util::RevComp(sequenes[i]); @@ -917,7 +989,7 @@ int main(int argc, char* argv[]) { bool sanityLimit = false; int NumPos = 0; int NumSanity = 0; - PrepairSearchList(A, i, Hashes, SearchHash, ACT, Revs, posLimit,sanityLimit, NumPos, NumSanity, Hashesize); + PrepareSearchList(A, i, Hashes, args.hashLength, args.ACT, Revs, posLimit,sanityLimit, NumPos, NumSanity); if (posLimit) { NumberHitPosLimit++; } @@ -932,6 +1004,7 @@ int main(int argc, char* argv[]) { cout << "Done Bulding List" << endl; } + // Serially iterate through this chunk of sequences for (int i = b; i < max; i++) { string A, Aqual, Adep, Astr; A = sequenes[i]; @@ -964,13 +1037,15 @@ int main(int argc, char* argv[]) { << " AvI= " << (AverageRSanity + AverageFSanity) / 2.0 << "\r"; } - int booya =Align3(sequenes, A, Aqual, i, k, bestIndex, MinPercent, PerfectMatch, MinOverlap, Forwards[i], Threads, NumReads); + // Align the current sequence with the possible options in Forwards + int bestScore = Align3(sequenes, A, Aqual, i, k, bestIndex, args.MinPercent, PerfectMatch, args.MinOverlap, Forwards[i], args.Threads, NumReads); if (FullOut) { - cout << "best forward score is " << booya << " k is " << k + cout << "best forward score is " << bestScore << " k is " << k << " index = " << bestIndex << endl; } + // If we don't have a perfect match, align the current sequence with the possible options in Revs if (!(PerfectMatch)) { string revA = Util::RevComp(A); string revAqual = Util::RevQual(Aqual); @@ -983,19 +1058,21 @@ int main(int argc, char* argv[]) { cout << "Checking Reverse\n"; } - int revbooya = Align3(sequenes, revA, revAqual, i, revk, revbestIndex, MinPercent, PerfectMatch, MinOverlap, Revs[i], Threads, NumReads); + int revBestScore = Align3(sequenes, revA, revAqual, i, revk, revbestIndex, args.MinPercent, PerfectMatch, args.MinOverlap, Revs[i], args.Threads, NumReads); + if (FullOut) { - cout << "best reverse score is " << revbooya << " k is " << revk + cout << "best reverse score is " << revBestScore << " k is " << revk << " index = " << revbestIndex << endl; } - if (revbooya > booya) { + // TODO: here is one part where we need to keep revBestScore AND bestScore if they have equal alignment scores + if (revBestScore > bestScore) { A = revA; Aqual = revAqual; Adep = revAdep; Astr = revAstr; k = revk; - booya = revbooya; + bestScore = revBestScore; bestIndex = revbestIndex; } } else { @@ -1004,7 +1081,8 @@ int main(int argc, char* argv[]) { } } - if (booya < MinOverlap) { + // Check that we meet our minimum overlap requirement + if (bestScore < args.MinOverlap) { if (FullOut) { cout << "No good match found, skipping" << endl; } @@ -1021,8 +1099,8 @@ int main(int argc, char* argv[]) { cout << "found match at " << k << endl; for (int z = 0; z < k; z++) { - cout << "+"; - } + cout << "+"; + } cout << A << endl << B << endl; @@ -1038,12 +1116,12 @@ int main(int argc, char* argv[]) { cout << A << endl; for (int z = 0; z < abs(k); z++) { - cout << "-"; - } + cout << "-"; + } cout << B << endl; for (int z = 0; z < abs(k); z++) { - cout << "-"; - } + cout << "-"; + } for (int z = 0; z < Bdep.size(); z++) { int bam = Bdep.c_str()[z]; cout << bam; @@ -1053,14 +1131,10 @@ int main(int argc, char* argv[]) { } } - string combined = - ColapsContigs(A, B, k, Aqual, Bqual, Adep, Bdep, Astr, Bstr); - + // Collapse the sequences for the best match - again TODO: will need to make this work for multiple equal matches + string combined = ColapsContigs(A, B, k, Aqual, Bqual, Adep, Bdep, Astr, Bstr); if (Bqual.size() != combined.size()) { - cout << "ERRRORRR " - "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" - "^^^^" - << endl; + cerr << "Error: something went wrong combining sequences into contigs" << endl; } qual[bestIndex] = Bqual; @@ -1069,47 +1143,47 @@ int main(int argc, char* argv[]) { strand[bestIndex] = Bstr; sequenes[i] = "moved"; -#pragma omp parallel for num_threads(Threads) shared(Hashes) - for (int j = 0; j < A.size() - SearchHash; j++) { - string hash = A.substr(j, SearchHash); - size_t found = hash.find('N'); - - if (found == std::string::npos) { - bool found = false; - int k = 0; - - for (k = 0; k < Hashes[Util::HashToLong(hash)].size(); k++) { - if (Hashes[Util::HashToLong(hash)][k] == bestIndex) { - found = true; - break; - } - } - - if (found = false) { - #pragma omp critical (Hashes) - { - Hashes[Util::HashToLong(hash)].push_back(bestIndex); - } - } - found = false; - - for (k = 0; - k < Hashes[Util::HashToLong(Util::RevComp(hash))].size(); - k++) { - if (Hashes[Util::HashToLong(Util::RevComp(hash))][k] == bestIndex) { - found = true; - break; - } - } - - if (found = false) { - #pragma omp critical (Hashes) - { - Hashes[Util::HashToLong(Util::RevComp(hash))].push_back(bestIndex); - } - } - } - } + // Update hash table Hashes with updated collapsed info + // We might have new hashes here from combined sequence + // #pragma omp parallel for num_threads(1) shared(Hashes) + // for (int j = 0; j < combined.size() - args.hashLength; j++) { + // string hash = combined.substr(j, args.hashLength); + // size_t foundIdx = hash.find('N'); + // TODO: change this back, this was correct logic + + // if (foundIdx == std::string::npos) { + // unsigned long forwardHash = Util::HashToLong(hash); + // unsigned long reverseHash = Util::HashToLong(Util::RevComp(hash)); + + // #pragma omp critical(updateHash) + // { + // bool foundForwardMatch = false; + // vector& forwardList = Hashes[forwardHash]; + // for (int k = 0; k < forwardList.size(); k++) { + // if (forwardList[k] == bestIndex) { + // foundForwardMatch = true; + // break; + // } + // } + // if (!foundForwardMatch) { + // Hashes[forwardHash].push_back(bestIndex); + // } + + + // bool foundReverseMatch = false; + // vector& reverseList = Hashes[reverseHash]; + // for (int k = 0; k < reverseList.size(); k++) { + // if (reverseList[k] == bestIndex) { + // foundReverseMatch = true; + // break; + // } + // } + // if (!foundReverseMatch) { + // Hashes[reverseHash].push_back(bestIndex); + // } + // } + // } + // } if (FullOut) { cout << combined << endl; @@ -1129,6 +1203,9 @@ int main(int argc, char* argv[]) { cout << "\nRESULTS\n"; int count = 0; + // Iterate through each sequence from fastq in order of receipt + // If the sequence is not "moved" and has sufficient length and coverage, write it to the report files + // I don't think the index here should change between runs, since the sequences array is serially populated for (int i = 0; i < sequenes.size(); i++) { if (sequenes[i] != "moved" && sequenes[i].size() >= 95) { @@ -1142,37 +1219,36 @@ int main(int argc, char* argv[]) { } } - if (maxDep >= MinCoverage) { + if (maxDep >= args.MinCoverage) { count++; int F = 0; int R = 0; - compresStrand(strand[i], F, R); - //report << "@NODE_" << i << "_L=" << sequenes[i].size() << "_D=" << maxDep << endl; - report << "@NODE_" << argv[6] << "_" << i << "_L" << sequenes[i].size()<< "_D" << maxDep << ":" << F << ":" << R << ":" << endl; + compressStrand(strand[i], F, R); + report << "@NODE_" << args.hashLength << "_" << i << "_L" << sequenes[i].size()<< "_D" << maxDep << ":" << F << ":" << R << ":" << endl; report << sequenes[i] << endl; report << "+" << endl; report << qual[i] << endl; - Depreport << "@NODE_" << argv[6] << "_" << i << "_L" << sequenes[i].size()<< "_D" << maxDep << ":" << F << ":" << R << ":" << endl; - Depreport << sequenes[i] << endl; - Depreport << "+" << endl; - Depreport << qual[i] << endl; - Depreport << strand[i] << endl; + DepReport << "@NODE_" << args.hashLength << "_" << i << "_L" << sequenes[i].size()<< "_D" << maxDep << ":" << F << ":" << R << ":" << endl; + DepReport << sequenes[i] << endl; + DepReport << "+" << endl; + DepReport << qual[i] << endl; + DepReport << strand[i] << endl; unsigned char C = depth[i].c_str()[0]; - int booya = C; - Depreport << booya; + int bestScore = C; + DepReport << bestScore; for (int w = 1; w < depth[i].size(); w++) { C = depth[i].c_str()[w]; - booya = C; - Depreport << ' ' << booya; + bestScore = C; + DepReport << ' ' << bestScore; } - Depreport << endl; + DepReport << endl; } } } cout << "Wrote " << count << " sequences" << endl; report.close(); - Depreport.close(); + DepReport.close(); } diff --git a/src/OverlapRegion.cpp b/src/OverlapRegion.cpp index 489883db..7e2c446b 100644 --- a/src/OverlapRegion.cpp +++ b/src/OverlapRegion.cpp @@ -35,7 +35,7 @@ int Align3(vector& sequenes, vector& quals, string Ap,string Aqp int bestScore = 0; int NumReads = sequenes.size(); int start = Ai + 1; - int end = sequenes.size(); + int end = sequenes.size(); // todo: instead of all sequences here, only do next 5 reads #pragma omp parallel for shared(index, overlap, bestScore) num_threads(Threads) for (int j = start; j < end; j++) @@ -45,27 +45,21 @@ int Align3(vector& sequenes, vector& quals, string Ap,string Aqp int LocalBestScore = 0; int LocalIndex = -1; int LocalOverlap = 0; + bool LocalPerfectMatch = false; string A; - int Alen; string Aq; - //#pragma omp critical - { - A = Ap; - Aq = Aqp; - } - Alen = A.length(); + A = Ap; + Aq = Aqp; + int Alength = A.length(); + string B; string Bq; + B = sequenes[j]; + Bq = quals[j]; int Blength = -1; - int Alength = Alen; - int k; - //#pragma omp critical - { - B = sequenes[j]; - Bq = quals[j]; - } Blength = B.length(); + int window = -1; int longest = -1; bool Asmaller = true; @@ -80,6 +74,7 @@ int Align3(vector& sequenes, vector& quals, string Ap,string Aqp longest = Alength; } + int k; int MM = window - (window * minPercent); int Acount = 0; int Bcount = 0; @@ -99,7 +94,7 @@ int Align3(vector& sequenes, vector& quals, string Ap,string Aqp score = -1; break; } - } //end of for loop (k=0) + } if (Asmaller) { Acount++; @@ -125,13 +120,13 @@ int Align3(vector& sequenes, vector& quals, string Ap,string Aqp } if (score == window) { - PerfectMatch = true; + LocalPerfectMatch = true; break; } } - } // end of top level for loop (i=0) + } - if (PerfectMatch == false) { + if (LocalPerfectMatch == false) { for (int i = window - 1; i >= MinOverlap; i--) { if (verbose) { @@ -173,8 +168,8 @@ int Align3(vector& sequenes, vector& quals, string Ap,string Aqp break; } } - } // end of top level if loop - } // end of for loop + } + } for (int i = window - 1; i >= MinOverlap; i--) { @@ -220,10 +215,15 @@ int Align3(vector& sequenes, vector& quals, string Ap,string Aqp #pragma omp critical(updateCounts) { - if (bestScore < LocalBestScore) { - bestScore = LocalBestScore; - index = LocalIndex; - overlap = LocalOverlap; + if (bestScore < LocalBestScore || + (bestScore == LocalBestScore && LocalIndex < index)) { // Tie-breaker to ensure consistent results + bestScore = LocalBestScore; + index = LocalIndex; + overlap = LocalOverlap; + } + // Only want to update this logic if we have found a perfect match + if (LocalPerfectMatch) { + PerfectMatch = true; } } } diff --git a/src/OverlapRegion.small.cpp b/src/OverlapRegion.small.cpp deleted file mode 100644 index eefeaf0b..00000000 --- a/src/OverlapRegion.small.cpp +++ /dev/null @@ -1,927 +0,0 @@ -/*By ANDREW FARRELL - * OverlapRegion.cpp - * -------------------------------------------------- - * Assembles k-mers containing variation into contigs - * that represent the variant sequence - * -------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Util.h" - -using namespace std; - -bool FullOut = false; - -int Align3(vector& sequenes, vector& quals, string Ap,string Aqp, int Ai, int& overlap, int& index, float minPercentpassed,bool& PerfectMatch, int MinOverlapPassed, int Threads) { - int QualityOffset = 33; //=64; - int MinQual = 20; - bool verbose = false; - int bestScore = 0; - int NumReads = sequenes.size(); - int start = Ai + 1; - int end = start+100 ; //sequenes.size(); - if (end > sequenes.size()) - { - end = sequenes.size(); - } - #pragma omp parallel for shared(index, overlap, bestScore) num_threads(Threads) - for (int j = start; j < end; j++) - { - int MinOverlap = MinOverlapPassed; - float minPercent = minPercentpassed; - int LocalBestScore = 0; - int LocalIndex = -1; - int LocalOverlap = 0; - - string A; - int Alen; - string Aq; - //#pragma omp critical - { - A = Ap; - Aq = Aqp; - } - Alen = A.length(); - string B; - string Bq; - int Blength = -1; - int Alength = Alen; - int k; - //#pragma omp critical - { - B = sequenes[j]; - Bq = quals[j]; - } - Blength = B.length(); - int window = -1; - int longest = -1; - bool Asmaller = true; - - if (Blength > Alength) { - window = Alength; - longest = Blength; - Asmaller = false; - } else { - Asmaller = true; - window = Blength; - longest = Alength; - } - - int MM = window - (window * minPercent); - int Acount = 0; - int Bcount = 0; - - for (int i = 0; i <= longest - window; i++) { - float score = 0; - for (k = 0; k < window; k++) { - if (A.c_str()[k + Acount] == B.c_str()[k + Bcount]) - { - if (B.c_str()[k + Bcount] != 'N' && (int)Aq.c_str()[k + Acount] > 5 && (int)Bq.c_str()[k + Bcount] > 5) - { - score++; - } - } - - if ((k - score) > MM) { - score = -1; - break; - } - } //end of for loop (k=0) - - if (Asmaller) { - Acount++; - } else { - Bcount++; - } - - if (verbose) { - cout << " Score = " << score << endl; - } - - float percent = score / (window); - if (percent >= minPercent) { - - if (LocalBestScore < score) { - LocalBestScore = score; - LocalIndex = j; - if (Asmaller) { - LocalOverlap = i * -1; - } else { - LocalOverlap = i; - } - } - - if (score == window) { - PerfectMatch = true; - break; - } - } - } // end of top level for loop (i=0) - - if (PerfectMatch == false) { - for (int i = window - 1; i >= MinOverlap; i--) { - - if (verbose) { - cout << "i = " << i << endl; - } - - float score = 0; - - for (k = 0; k <= i; k++) { - - if (verbose) {cout << " k = " << k << " so A = " << Alength - i + k<< " /\\ B = " << 0 + k << endl;} - if (verbose) { cout << " A >> " << A.c_str()[Alength - i + k - 1] << "="<< B.c_str()[0 + k] << " << B" << endl;} - - if (A.c_str()[Alength - i + k - 1] == B.c_str()[0 + k]) { - if (B.c_str()[0 + k] != 'N' && (int)Aq.c_str()[Alength - i + k - 1] > 5 &&(int)Bq.c_str()[0 + k] > 5) - { - score++; - } - } - - if ((k - score) > MM) { - score = -1; - break; - } - } - - if (verbose) { cout << " Score = " << score << endl;} - - float percent = score / (k); - - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = i - Alength + 1; - if (score == i) { - break; - } - } - } // end of top level if loop - } // end of for loop - - for (int i = window - 1; i >= MinOverlap; i--) { - - if (verbose) { - cout << "i = " << i << endl; - } - - float score = 0; - for (k = 0; k <= i; k++) { - - if (B.c_str()[Blength - i + k - 1] == A.c_str()[0 + k]) { - if (A.c_str()[0 + k] != 'N' && (int)Aq.c_str()[0 + k] > 5 &&(int)Bq.c_str()[Blength - i + k - 1] > 5) - { - score++; - } - } - - if ((k - score) > MM) { - score = -1; - break; - } - } - - if (verbose) { - cout << " Score = " << score << endl; - } - - float percent = score / (k); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = Blength - i - 1; - if (score == i) { - break; - } - } - } - } - } - -#pragma omp critical(updateCounts) - { - if (bestScore < LocalBestScore) { - bestScore = LocalBestScore; - index = LocalIndex; - overlap = LocalOverlap; - } - } - } - return bestScore; -} - -string ColapsContigs(string A, string B, int k, string Aq, string& Bq, string& Ad, string& Bd, string& As, string& Bs) -{ - bool verbose = false; - - if (verbose) {cout << "Combining; \n" << A << endl << B << endl;} - - int Asize = A.length(); - int Bsize = B.length(); - int Aoffset = 0; - int Boffset = 0; - int window; - string newString = ""; - string newQual = ""; - string newDepth = ""; - - if (k > 0) { - Aoffset = k; - } else { - Boffset = abs(k); - } - - if (verbose) { cout << "K = " << k << " so Aofset = " << Aoffset<< " and Boffset = " << Boffset << endl;} - - for (int i = 0; i < Asize + Bsize; i++) - { - char Abase = 'Z'; - char Bbase = 'Z'; - char Aqual = '!'; - char Bqual = '!'; - unsigned char Adep = 0; - unsigned char Bdep = 0; - - if (((i - Aoffset) >= 0) && ((i - Aoffset) < A.length())) { - Abase = A.c_str()[i - Aoffset]; - Aqual = Aq.c_str()[i - Aoffset]; - Adep = Ad.c_str()[i - Aoffset]; - } else { - Abase = 'Z'; - Aqual = '!'; - Adep = 0; - } - - if (i - Boffset >= 0 && i - Boffset < B.length()) { - Bbase = B.c_str()[i - Boffset]; - Bqual = Bq.c_str()[i - Boffset]; - Bdep = Bd.c_str()[i - Boffset]; - } else { - Bbase = 'Z'; - Bqual = '!'; - Bdep = 0; - } - if (verbose) { cout << "I = " << i << " Bi = " << i - Boffset << " Ai = " << i - Aoffset << " thus " << Abase << "-" << Bbase << endl; } - - if (Abase == Bbase && Abase != 'Z') - { - newString += Abase; - if (Aqual >= Bqual) - { - newQual += Aqual; - } - else - { - newQual += Bqual; - } - if ((int)Adep + (int)Bdep < 250) - { - newDepth += (Adep + Bdep); - } - else - { - newDepth += 250; - } - - } - else if (Abase == 'Z' && Bbase != 'Z') - { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } - else if (Abase != 'Z' && Bbase == 'Z') - { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } - else if (Abase != 'Z' && Bbase != 'Z') - { - if (Abase == 'N' && Bbase != 'N') - { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } - else if (Abase != 'N' && Bbase == 'N') - { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } - else if (Aqual >= Bqual) - { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } - else - { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } - - } - else if (Abase == 'Z' && Bbase == 'Z') - { - Bq = newQual; - Bd = newDepth; - break; - } - } - Bs += As; - Bq = newQual; - Bd = newDepth; - return newString; -} - -string TrimNends(string S, string& qual) { - bool base = false; - string NewS = ""; - string NewQ = ""; - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } else if (S.c_str()[i] != 'A' && S.c_str()[i] != 'C' && - S.c_str()[i] != 'G' && S.c_str()[i] != 'T') { - } else { - base = true; - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } - } - qual = NewQ; - return NewS; -} - -string TrimLowCoverageEnds(string S, string& quals, string& depth, int cutoff) { - bool base = false; - string NewS = ""; - string NewD = ""; - string NewQ = ""; - - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } else { - } - } - - if (NewS.size() > 1) { - S = NewS; - depth = NewD; - quals = NewQ; - base = false; - NewS = ""; - NewD = ""; - NewQ = ""; - for (int i = 0; i < S.size(); i++) { - if (base) { - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } - } - } - depth = NewD; - quals = NewQ; - return NewS; -} - -string AdjustBases(string sequence, string qual) { - int MinQ = 10; - int QualOffset = 32; - string NewString = ""; - - for (int i = 0; i < sequence.length(); i++) { - //cout << qual.c_str()[i]-QualOffset << " " ; - if (qual.c_str()[i] - QualOffset < MinQ) { - NewString += 'N'; - } else { - NewString += sequence.c_str()[i]; - } - } - - if (NewString != sequence) { - return NewString; - } -} - -bool replace(std::string& str, const std::string& from, const std::string& to) { - size_t start_pos = str.find(from); - if (start_pos == std::string::npos) { - return false; - } - str.replace(start_pos, from.length(), to); - return true; -} - -bool validateFASTQD(string& L1, string& L2, string& L3, string& L4, string& L5, - string& L6) { - if (L1.c_str()[0] != '@') { - cout << "error header problems - " << L1 << endl; - return false; - } - if (L2.size() != L4.size()) { - cout << "error sequence and qual problems - \n" << L2 << endl - << L4 << endl; - return false; - } - vector temp = Util::Split(L6, ' '); - if (temp.size() != L2.size()) { - cout << "error counts problems - " << L2.size() << " != " << temp.size() - << endl; - return false; - } - return true; -} - -string FlipStrands(string strand) { - string NewStrand = ""; - for (int i = 0; i < strand.size(); i++) { - if (strand.c_str()[i] == '+') - NewStrand += "-"; - else if (strand.c_str()[i] == '-') - NewStrand += "+"; - else if (strand.c_str()[i] == '.') - NewStrand += "."; - } - return NewStrand; -} - -void compresStrand(string S, int& F, int& R) { - for (int i = 0; i < S.size(); i++) { - if (S.c_str()[i] == '+') - F++; - else if (S.c_str()[i] == '-') - R++; - } - return; -} - -int main(int argc, char* argv[]) { - float MinPercent; - int MinOverlap; - int MinCoverage; - cout << "you gave " << argc << " Arguments" << endl; - if (argc != 9) { - cout << "ERROR, wrong numbe of arguemnts\nCall is: FASTQ, MinPercent, " - "MinOverlap, MinCoverage, ReportStub, NodeStub LCcutoff Threads" - << endl - << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] - << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] - << "\n FileStub = " << argv[5] << "\n NodeStub = " << argv[6] - << endl; - return 0; - } - - cout << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] << "\n FileStub = " << argv[5] - << "\n NodeStub = " << argv[6] << "\n LCcutoff = " << argv[7] - << "\n Threads = " << argv[8] << endl; - - ifstream fastq; - fastq.open(argv[1]); - if (fastq.is_open()) { - cout << "Parent File open - " << argv[1] << endl; - } else { - cout << "Error, ParentHashFile could not be opened"; - return 0; - } - - string temp = argv[2]; - MinPercent = atof(temp.c_str()); - temp = argv[3]; - MinOverlap = atoi(temp.c_str()); - temp = argv[4]; - MinCoverage = atoi(temp.c_str()); - temp = argv[7]; - int LCcutoff = atoi(temp.c_str()); - temp = argv[8]; - int Threads = atoi(temp.c_str()); - ofstream report; - string FirstPassFile = argv[1]; - std::stringstream ss; - ss << argv[5] << ".fastq"; - FirstPassFile = ss.str(); - report.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile - << endl; - return 0; - } - - ofstream Depreport; - FirstPassFile += "d"; - Depreport.open(FirstPassFile.c_str()); - string f = FirstPassFile+ "boom"; - //ofstream tempO; - //tempO.open(f); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile - << endl; - return 0; - } - - string line; - std::vector sequenes; - std::vector Osequenes; - std::vector qual; - std::vector Oqual; - std::vector depth; - std::vector Odepth; - std::vector strand; - std::vector used; - std::vector multi; - int lines = -1; - string L1; - string L2; - string L3; - string L4; - string L5; - string L6; - unsigned long LongHash; - int Rejects = 0; - int MinReadLength = 90; - string Fastqd = argv[1]; - size_t found = Fastqd.find(".fastqd"); - - if (found != string::npos) { - int counter = -1; - cout << "ATTENTION - Fastq+depth input detected, reading in FASTQD file \n"; - - while (getline(fastq, L1)) - { - getline(fastq, L2); - getline(fastq, L3); - getline(fastq, L4); - getline(fastq, L5); - getline(fastq, L6); - string depths = ""; - int ReadSize = L2.size(); - - if (validateFASTQD(L1, L2, L3, L4, L5, L6)) - { - bool Multiple = false; - std::vector temp = Util::Split(L6, ' '); - - for (std::vector::size_type i = 0; i < temp.size(); i++) - { - int e = atoi(temp[i].c_str()); - unsigned char C = e; - depths += C; - if ((int)C > 1) { - Multiple = true; - } - } - string oseq= L2; - string oq = L4; - string od = depths; - if (Multiple == true) - { - L2 = TrimLowCoverageEnds(L2, L4, depths, LCcutoff); - } - - if (L2.size() > MinReadLength) - { - lines++; - sequenes.push_back(L2); - qual.push_back(L4); - depth.push_back(depths); - strand.push_back(L5); - ReadSize = L2.size(); - Osequenes.push_back(oseq); - Oqual.push_back(oq); - Odepth.push_back(od); - if (Multiple) - multi.push_back(1); - else - multi.push_back(0); - - used.push_back(0); - - //tempO << L1 << endl; - //tempO << L2 << endl; - //tempO << L3 << endl; - //tempO << L4 << endl; - //tempO << L5 << endl; - - //unsigned char C = depths.c_str()[0]; - //int booya = C; - //tempO << booya; - //for (int w = 1; w < depths.size(); w++) { - // C = depths.c_str()[w]; - // booya = C; - // tempO << " " << booya; - //} - //tempO << endl; - } else { - Rejects++; - } - } - else - { - cout << "ERROR in FASTQD file \n " << L1 << "\n " << L2 << "\n " << L3 << "\n " << L4 << "\n " << L5 << "\n " << L6 << endl; - return 1; - } - } //end of while - } - else - { - cout << "Reading in raw fastq \n"; - int counter = 0; - while (getline(fastq, L1)) { - counter++; - if (counter % 100 == 1) { - cout << "Read in " << counter << " lines and rejected " << Rejects - << " reads\r"; - } - getline(fastq, L2); - getline(fastq, L3); - getline(fastq, L4); - int ReadSize = L2.size(); - L2 = TrimNends(L2, L4); - - if ((double)L2.size() / (double)ReadSize > .6 and - L2.size() > MinReadLength) { - ReadSize = L2.size(); - lines++; - sequenes.push_back(L2); - qual.push_back(L4); - strand.push_back("+"); - string depths = ""; - unsigned char C = 1; - - for (int i = 0; i < L2.length(); i++) { - depths += C; - } - - depth.push_back(depths); - - } else { - Rejects++; - } - } - } - tempO.close(); - cout << endl; - int NumReads = sequenes.size(); - cout << "\nDone reading in \n Read in a total of " << NumReads + Rejects - << " and rejected " << Rejects << endl; - clock_t St, Et; - float Dt; - struct timeval start, end; - gettimeofday(&start, NULL); - int FoundMatch = 0; - St = clock(); - - for (std::vector::size_type i = 0; i < sequenes.size(); i++) { - string A = sequenes[i]; - string Aqual = qual[i]; - string Adep = depth[i]; - string Astr = strand[i]; - - if (FullOut) {cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<**************************************************************>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << endl;} - Et = clock(); - - if ((int)i % 10 < 1) - { - gettimeofday(&end, NULL); - float Dt = end.tv_sec - start.tv_sec; - cout << "aligning " << i << " of " << NumReads << ", \% done = " << ((double)i / (double)NumReads) * 100.00 << ", TotalTime= " << Dt << " , second per read = " << Dt / i << ", \% finding match = " << ((double)FoundMatch / (double)i) * 100.00 << "\r"; - } - - if (FullOut) { - Dt = ((double)(Et - St)) / CLOCKS_PER_SEC; - cout << "aligning " << i << " of " << NumReads << "\% done = " << ((double)i / (double)NumReads) * 100.00 << ", TotalTime= " << Dt << " , second per read = " << Dt / i << ", \% finding match = " << ((double)FoundMatch / (double)i) * 100.00 << endl << A << endl; - for (int z = 0; z < Adep.length(); z++) { - int bam = Adep.c_str()[z]; - cout << bam; - } - cout << endl; - } - - int k = -1; - int bestIndex = -1; - bool PerfectMatch = false; - int booya = Align3(sequenes, qual, A, Aqual, i, k, bestIndex, MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) { cout << "best forward score is " << booya << " k is " << k << endl;} - - if (!(PerfectMatch)) - { - string revA = Util::RevComp(A); - string revAqual = Util::RevQual(Aqual); - string revAdep = Util::RevQual(Adep); - string revAstr = FlipStrands(Astr); - int revk = -1; - int revbestIndex = -1; - int revbooya =Align3(sequenes, qual, revA, revAqual, i, revk, revbestIndex, MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) {cout << "best reverse score is " << revbooya << " k is " << revk << endl; } - - if (revbooya > booya) { - A = revA; - Aqual = revAqual; - Adep = revAdep; - Astr = revAstr; - k = revk; - booya = revbooya; - bestIndex = revbestIndex; - } - } else { - if (FullOut) { cout << "Perfect Match Found, Skipping Referse Search" << endl; } - } - - if (booya < MinOverlap) { - if (FullOut) { cout << "No good match found, skipping" << endl;} - } - else - { - FoundMatch++; - string B = sequenes[bestIndex]; - string Bqual = qual[bestIndex]; - string Bdep = depth[bestIndex]; - string Bstr = strand[bestIndex]; - if (k > 0) - { - if (FullOut) - { - cout << "found match at " << k << endl; - for (int z = 0; z < k; z++) - {cout << "+";} - cout << A << endl << B << endl; - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - cout << endl; - } - } - else - { - if (FullOut) - { - cout << "found match at " << k << endl; - cout << A << endl; - - for (int z = 0; z < abs(k); z++) { - cout << "-"; - } - - cout << B << endl; - - for (int z = 0; z < abs(k); z++) - { - cout << "-"; - } - - for (int z = 0; z < Bdep.length(); z++) - { - int bam = Bdep.c_str()[z]; - cout << bam; - } - cout << endl; - } - } //end of if/else statement - - if (i == bestIndex) {cout << "ERROR ____________________ SAME READS " << endl;} - - if (A.size() != Adep.size() && B.size() != Bdep.size()) - { - cout << " ERRPR somethis the wrong size\n A= " << A.size() - << " Ad = " << Adep.size() << " B= " << B.size() - << " Bd = " << Bdep.size() << endl; - } - - string combined =ColapsContigs(A, B, k, Aqual, Bqual, Adep, Bdep, Astr, Bstr); - - if (combined.size() != Bdep.size()) { - cout << " ERRPR combined is the wrong size\n C= " << combined.size() - << " Bd = " << Bdep.size() << endl; - } - - sequenes[bestIndex] = combined; - qual[bestIndex] = Bqual; - depth[bestIndex] = Bdep; - strand[bestIndex] = Bstr; - sequenes[i] = "moved"; - - if (FullOut) - { - cout << combined << endl; - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - } - } - } // end of for loop (std::vector) - - cout << "\n\nRESULTS\n"; - int count = 0; - - for (int i = 0; i < sequenes.size(); i++) { - - if (FullOut) { - cout << ">>>>" << sequenes[i] << endl; - } - - if (sequenes[i] != "moved" && sequenes[i].size() >= 95) { - string rDep = depth[i]; - int maxDep = -1; - - for (int z = 0; z < rDep.size(); z++) { - unsigned char bam = rDep.c_str()[z]; - - if ((int)bam > maxDep) { - maxDep = (int)bam; - } - } - - if (maxDep >= MinCoverage) { - if (sequenes[i].size() != qual[i].size() && - qual[i].size() != depth[i].size()) { - cout << "ERROR, read " - << "@NODE_" << argv[6] << "_" << i << "_L" << sequenes[i].size() - << "_D" << maxDep - << " Has the wrong size, Seq = " << sequenes[i].size() - << " Qual = " << qual[i].size() << " Dep = " << depth[i].size() - << endl; - } - count++; - int F = 0; - int R = 0; - compresStrand(strand[i], F, R); - report << "@NODE_" << argv[6] << "_" << i << "_L" << sequenes[i].size()<< "_D" << maxDep << ":" << F << ":" << R << ":" << endl; - report << sequenes[i] << endl; - report << "+" << endl; - report << qual[i] << endl; - - Depreport << "@NODE_" << argv[6] << "_" << i << "_L" - << sequenes[i].size() << "_D" << maxDep << ":" << F << ":" - << R << ":" << endl; - Depreport << sequenes[i] << endl; - Depreport << "+" << endl; - Depreport << qual[i] << endl; - Depreport << strand[i] << endl; - unsigned char C = depth[i].c_str()[0]; - int booya = C; - Depreport << booya; - - for (int w = 1; w < depth[i].size(); w++) { - C = depth[i].c_str()[w]; - booya = C; - Depreport << " " << booya; - } - - Depreport << endl; - } - } - } - cout << "\nWrote " << count << " sequences" << endl; - report.close(); -} diff --git a/src/OverlapSam.HashFirst.cpp b/src/OverlapSam.HashFirst.cpp deleted file mode 100644 index 73b80e69..00000000 --- a/src/OverlapSam.HashFirst.cpp +++ /dev/null @@ -1,1116 +0,0 @@ -/*By ANDREW FARRELL - * OverlapSam.cpp - * -------------------------------------------------- - * Assembles k-mers containing variation into contigs - * that represent the variant sequence - * -------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "Util.h" - -using namespace std; -unordered_map Mutations; -int HashSize = -1; -bool FullOut = false; -unordered_map DupCheck; -int Align3(vector& sequenes, vector& quals, vector& strand, string phase, string Ap, string Aqp, int Ai, int& overlap, int& index, float minPercentpassed, bool& PerfectMatch, int MinOverlapPassed, int Threads) -{ - int QualityOffset = 33; //=64; - int MinQual = 20; - bool verbose = false; - int bestScore = 0; - int NumReads = sequenes.size(); - int start = Ai + 1; - int end = start + 10; - if (end > sequenes.size()) - { - end = sequenes.size(); - } - - #pragma omp parallel for shared(Ap, Aqp, index, overlap, bestScore) num_threads(Threads) - for (int j = start; j < end; j++) - { - bool run = false; - - size_t found = strand[j].find("."); - - if (phase == "wh" && found == string::npos) - {run = true;} - if (phase == "nh" && found != string::npos) - {run = true;} - if (phase == "all") - {run = true;} - - - if (run) - { - int MinOverlap = MinOverlapPassed; - float minPercent = minPercentpassed; - int LocalBestScore = 0; - int LocalIndex = -1; - int LocalOverlap = 0; - string A; - int Alen; - string Aq; - //#pragma omp critical - { - A = Ap; - Alen = A.length(); - Aq = Aqp; - } - string B; - string Bq; - int Blength = -1; - int Alength = Alen; - int k; - - //#pragma omp critical - { - B = sequenes[j]; - Bq = quals[j]; - } - Blength = B.length(); - int window = -1; - int longest = -1; - bool Asmaller = true; - - if (Blength > Alength) - { - window = Alength; - longest = Blength; - Asmaller = false; - } - else - { - window = Blength; - longest = Alength; - Asmaller = true; - } - - int MM = window - (window * minPercent); - int Acount = 0; - int Bcount = 0; - - for (int i = 0; i <= longest - window; i++) - { - float score = 0; - //first check where the reads completely overlap - for (k = 0; k < window; k++) - { - if (A.c_str()[k + Acount] == B.c_str()[k + Bcount]) - { - if (B.c_str()[k + Bcount] != 'N' && (int)Aq.c_str()[k + Acount] > 5 && (int)Bq.c_str()[k + Bcount] > 5) - { - score++; - } - } - if ((k - score) > MM) - { - score = -1; - break; - } - } - - if (Asmaller) - { - Acount++; - } else { - Bcount++; - } - - if (verbose) - { - cout << " Score = " << score << endl; - } - - float percent = score / (window); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - if (Asmaller) - { - LocalOverlap = i * -1; - } else { - LocalOverlap = i; - } - } - if (score == window) { - PerfectMatch = true; - break; - } - } - } - - if (PerfectMatch == false) - { - for (int i = window - 1; i >= MinOverlap; i--) - { - if (verbose) {cout << "i = " << i << endl;} - - float score = 0; - for (k = 0; k <= i; k++) - { - if (verbose) {cout << " k = " << k << " so A = " << Alength - i + k<< " /\\ B = " << 0 + k << endl;} - if (verbose) {cout << " A >> " << A.c_str()[Alength - i + k - 1] << "="<< B.c_str()[0 + k] << " << B" << endl;} - - if (A.c_str()[Alength - i + k - 1] == B.c_str()[0 + k]) - { - if (B.c_str()[0 + k] != 'N' && (int)Aq.c_str()[Alength - i + k - 1] > 5 &&(int)Bq.c_str()[0 + k] > 5) - { - score++; - } - } - if ((k - score) > MM) { - score = -1; - break; - } - } - if (verbose) {cout << " Score = " << score << endl;} - - float percent = score / (k); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = i - Alength + 1; - if (score == i) - { - break; - } - } - } - } - - for (int i = window - 1; i >= MinOverlap; i--) - { - if (verbose) { cout << "i = " << i << endl;} - float score = 0; - for (k = 0; k <= i; k++) { - if (B.c_str()[Blength - i + k - 1] == A.c_str()[0 + k]) - { - if (A.c_str()[0 + k] != 'N' && (int)Aq.c_str()[0 + k] > 5 && (int)Bq.c_str()[Blength - i + k - 1] > 5) - { - score++; - } - } - if ((k - score) > MM) { - score = -1; - break; - } - } - - if (verbose) {cout << " Score = " << score << endl;} - - float percent = score / (k); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = Blength - i - 1; - if (score == i) - { - break; - } - } - } - } - } - #pragma omp critical(updateCounts) - { - if (bestScore < LocalBestScore) { - bestScore = LocalBestScore; - index = LocalIndex; - overlap = LocalOverlap; - } - } - } - } - return bestScore; -} - -string ColapsContigs(string A, string B, int k, string Aq, string& Bq, - string& Ad, string& Bd, string& As, string& Bs) { - bool verbose = false; - if (verbose) { - cout << "Combinding; \n" << A << endl << B << endl; - } - - int Asize = A.length(); - int Bsize = B.length(); - - int Aoffset = 0; - int Boffset = 0; - int window; - string newString = ""; - string newQual = ""; - string newDepth = ""; - - if (k > 0) { - Aoffset = k; - } else { - Boffset = abs(k); - } - - if (verbose) { - cout << "K = " << k << " so Aofset = " << Aoffset - << " and Boffset = " << Boffset << endl; - } - - for (int i = 0; i < Asize + Bsize; i++) { - char Abase = 'Z'; - char Bbase = 'Z'; - char Aqual = '!'; - char Bqual = '!'; - unsigned char Adep = 0; - unsigned char Bdep = 0; - - if (((i - Aoffset) >= 0) && ((i - Aoffset) < A.length())) { - Abase = A.c_str()[i - Aoffset]; - Aqual = Aq.c_str()[i - Aoffset]; - Adep = Ad.c_str()[i - Aoffset]; - } else { - Abase = 'Z'; - Aqual = '!'; - Adep = 0; - } - - if (i - Boffset >= 0 && i - Boffset < B.length()) { - Bbase = B.c_str()[i - Boffset]; - Bqual = Bq.c_str()[i - Boffset]; - Bdep = Bd.c_str()[i - Boffset]; - } else { - Bbase = 'Z'; - Bqual = '!'; - Bdep = 0; - } - - if (verbose) { - cout << "I = " << i << " Bi = " << i - Boffset << " Ai = " << i - Aoffset - << " thus " << Abase << "-" << Bbase << endl; - } - - if (Abase == Bbase && Abase != 'Z') { - newString += Abase; - - if (Aqual >= Bqual) { - newQual += Aqual; - } else { - newQual += Bqual; - } - - if ((int)Adep + (int)Bdep < 250) { - newDepth += (Adep + Bdep); - } else { - newDepth += 250; - } - - } else if (Abase == 'Z' && Bbase != 'Z') { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } else if (Abase != 'Z' && Bbase == 'Z') { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else if (Abase != 'Z' && Bbase != 'Z') { - - if (Abase == 'N' && Bbase != 'N') { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } else if (Abase != 'N' && Bbase == 'N') { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else if (Aqual >= Bqual) { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } - - } else if (Abase == 'Z' && Bbase == 'Z') { - Bq = newQual; - Bd = newDepth; - break; - } - } - Bq = newQual; - Bd = newDepth; - Bs += As; - return newString; -} - -string TrimNends(string S, string& qual) { - bool base = false; - string NewS = ""; - string NewQ = ""; - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } else if (S.c_str()[i] != 'A' && S.c_str()[i] != 'C' && - S.c_str()[i] != 'G' && S.c_str()[i] != 'T') { - } else { - base = true; - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } - } - qual = NewQ; - return NewS; -} - -string TrimLowCoverageEnds(string S, string& quals, string& depth, int cutoff) { - bool base = false; - string NewS = ""; - string NewD = ""; - string NewQ = ""; - - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } - } - - if (NewS.size() > 1) { - S = NewS; - depth = NewD; - quals = NewQ; - base = false; - NewS = ""; - NewD = ""; - NewQ = ""; - - for (int i = 0; i < S.size(); i++) { - if (base) { - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } - } - } - depth = NewD; - quals = NewQ; - return NewS; -} - -string AdjustBases(string sequence, string qual) { - int MinQ = 10; - int QualOffset = 32; - string NewString = ""; - for (int i = 0; i < sequence.length(); i++) { - if (qual.c_str()[i] - QualOffset < MinQ) { - NewString += 'N'; - } else { - NewString += sequence.c_str()[i]; - } - } - - if (NewString != sequence) { - return NewString; - } -} - -bool replace(std::string& str, const std::string& from, const std::string& to) { - size_t start_pos = str.find(from); - if (start_pos == std::string::npos) { - return false; - } - str.replace(start_pos, from.length(), to); - return true; -} - -bool validateFASTQD(string& L1, string& L2, string& L3, string& L4, string& L5, - string& L6) { - if (L1.c_str()[0] != '@') { - cout << "error header problems - " << L1 << endl; - return false; - } - if (L2.size() != L4.size()) { - cout << "error sequence and qual problems - \n" << L2 << endl - << L4 << endl; - return false; - } - vector temp = Util::Split(L6, ' '); - if (temp.size() != L2.size()) { - cout << "error counts problems - " << L2.size() << " != " << temp.size() - << endl; - return false; - } - return true; -} - -bool IsBitSet(int num, int bit) { return 1 == ((num >> bit) & 1); } - -int GetReadOrientation(int flag) { - bool is_set = IsBitSet(flag, 4); - cout << "flag is " << flag << endl; - cout << "orientation is " << is_set << endl; - return is_set; -} - -string FlipStrands(string strand) { - string NewStrand = ""; - for (int i = 0; i < strand.size(); i++) { - if (strand.c_str()[i] == '+') - NewStrand += "-"; - else if (strand.c_str()[i] == '-') - NewStrand += "+"; - else if(strand.c_str()[i] == '.') - NewStrand += "."; - } - return NewStrand; -} - -void compresStrand(string S, int& F, int& R) { - for (int i = 0; i < S.size(); i++) { - if (S.c_str()[i] == '+') - F++; - else if (S.c_str()[i] == '-') - R++; - } - return; -} -int CountHashes(string seq) -{ - int count=0; - for (int i = 0; i < seq.size()-HashSize; i++) - { - string hash = seq.substr(i, HashSize); - size_t found = hash.find("N"); - if (found == string::npos) - { - if(Mutations.count(Util::HashToLong( hash)) > 0) - {count++;} - } - } - return count; -} -int NumLowQbases(string qual, int min) -{ - int count = 0; - for (int i =0; i < qual.size(); i++) - { - if( int(qual.c_str()[i]) - 33 < min) - count++; - } - return count; -} -int main(int argc, char* argv[]) { - float MinPercent; - int MinOverlap; - int MinCoverage; - cout << "you gave " << argc << " Arguments" << endl; - if (argc != 10) { - cout << "ERROR, wrong numbe of arguemnts\nCall is: SAM, MinPercent, " - "MinOverlap, MinCoverage, ReportStub, NodeStub LCcutoff Threads" - << endl - << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] - << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] - << "\n FileStub = " << argv[5] - << "\n NodeStub = " << argv[6] - << "\n MinCov = " << argv[7] - << "\n HashPath = " << argv[8] - << "\n Threads = " << argv[9] - << endl; - return 0; - } - cout << "YAY,right numbe of arguemnts\nCall is: SAM, MinPercent, " - "MinOverlap, MinCoverage, ReportStub, NodeStub LCcutoff Threads" - << endl - << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] - << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] - << "\n FileStub = " << argv[5] - << "\n NodeStub = " << argv[6] - << "\n MinCovTrimCov = " << argv[7] - << "\n HashPath = " << argv[8] - << "\n Threads = " << argv[9] - << endl; - - ifstream fastq; - fastq.open(argv[1]); - if (fastq.is_open()) { - cout << "File open - " << argv[1] << endl; - } else { - cout << "Error, ParentHashFile could not be opened"; - return 0; - } - - string temp = argv[2]; - MinPercent = atof(temp.c_str()); - temp = argv[3]; - MinOverlap = atoi(temp.c_str()); - temp = argv[4]; - MinCoverage = atoi(temp.c_str()); - temp = argv[7]; - int LCcutoff = atoi(temp.c_str()); - string HashPath = argv[8]; - temp = argv[9]; - int Threads = atoi(temp.c_str()); - ofstream report; - string FirstPassFile = argv[1]; - std::stringstream ss; - ss << argv[5] << ".fastq"; - FirstPassFile = ss.str(); - report.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile << endl; - return 0; - } - - ofstream Depreport; - FirstPassFile += "d"; - Depreport.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile << endl; - return 0; - } - - string line; - std::vector sequenes; - std::vector qual; - std::vector depth; - std::vector strand; - std::vector Unsequenes; - std::vector Unqual; - std::vector Undepth; - std::vector Unstrand; - int lines = -1; - string L1; - string L2; - string L3; - string L4; - string L5; - string L6; - unsigned long LongHash; - int Rejects = 0; - string Fastqd = argv[1]; - cout << "Reading in SAM \n"; - int counter = 0; - int unalignedCounter = 0; - int goodreads = 0; - int lowMapQual = 0; - int other = 0; - cout << "reading in hash list" << endl; - ifstream MutHashFile; - MutHashFile.open(HashPath); - if (MutHashFile.is_open()) { - cout << "Parent File open - " << argv[1] << endl; - } // cout << "##File Opend\n"; - else { - cout << "Error, ParentHashFile could not be opened"; - return 0; - } - - - while (getline(MutHashFile, L1)) { - vector temp; - temp = Util::Split(L1, '\t'); - - if (temp.size() == 2) { - unsigned long b = Util::HashToLong(temp[0]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[0])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - HashSize = temp[0].size(); - } else if (temp.size() == 4) { - unsigned long b = Util::HashToLong(temp[3]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[3])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - HashSize = temp[3].size(); - } - if (temp.size() == 1) { - temp = Util::Split(L1, ' '); - unsigned long b = Util::HashToLong(temp[0]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[0])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - HashSize = temp[0].size(); - } - } - - if (HashSize == -1) - { - cout << "ERROR Hash Size could not be determined by the HashFile" << endl; - return -1; - } - cout << "HashSize = " << HashSize << endl; - - while (getline(fastq, L1)) { - counter++; - //cout << L1 << endl; - if (counter % 100 == 1) { - cout << "Read in " << counter << " reads, with " << goodreads << " aligned reads, " << unalignedCounter<< " unaligned reads, " << lowMapQual << "low map qual and " << other <<" other with rejected " << Rejects - << " reads\r"; - } - - vector temp = Util::Split(L1, '\t'); - int ReadSize = temp[10].size(); - bool b[16]; - int v = atoi(temp[1].c_str()); - - //TODO: understand this syntax - for (int j = 0; j < 16; ++j) - { - b[j] = 0 != (v & (1 << j)); - } - //if (DupCheck.count(temp[9]) > 0) - //{ - // cout << "skipping exact match sequence " << L1 << endl; - //} - //else - { - int lowq = NumLowQbases(temp[10], 20); - DupCheck[temp[9]] == true; - if (b[8] or b[11] or b[10] or temp[9].length() < 100 or lowq > 50) - { - //cout << "rejected" << endl; - //cout << L1 << endl; - Rejects++; - } - else if ( b[2] )//or atoi(temp[4].c_str())<5) - { - if (b[2]) - unalignedCounter++; - else if (atoi(temp[4].c_str())<5) - lowMapQual++; - else - other++; - string L4 = temp[10]; - string L2 = temp[9]; ////////sequence////////// - L2 = TrimNends(L2, L4); - int hashes = CountHashes(L2); - //cout << "poorly mapped read " << L1 << endl; - //cout << "with Hash = " << hashes << endl; - if ((double)L2.size() / (double)ReadSize > .6) - { - ReadSize = L2.size(); - lines++; - Unsequenes.push_back(L2); - Unqual.push_back(L4); - if (hashes > 0) - { - if (b[0]== 0) - { - Unstrand.push_back("."); - } - else if (b[4] == 0) - { - Unstrand.push_back("+"); - } - else if (b[4] == 1) - { - Unstrand.push_back("-"); - } - } - else - Unstrand.push_back("."); - - string depths = ""; - unsigned char C = 1; - - for (int i = 0; i < L2.length(); i++) - { - depths += C; - } - - Undepth.push_back(depths); - - } - else - { - Rejects++; - } - - } - else - { - goodreads++; - //cout << "good alignment" << endl; - string L4 = temp[10]; - string L2 = temp[9]; - L2 = TrimNends(L2, L4); - int hashes = CountHashes(L2); - - //cout << "Hash = " << hashes << endl; - if ((double)L2.size() / (double)ReadSize > .6) - { - ReadSize = L2.size(); - lines++; - sequenes.push_back(L2); - qual.push_back(L4); - string depths = ""; - - if (hashes > 0) - { - if (b[0]== 0) - { - strand.push_back("."); - } - else if (b[4] == 0) - { - strand.push_back("+"); - } - else if (b[4] == 1) - { - strand.push_back("-"); - } - } - else - strand.push_back("."); - - unsigned char C = 1; - - for (int i = 0; i < L2.length(); i++) - { - depths += C; - } - - depth.push_back(depths); - - } - else - { - Rejects++; - } - } - } - } - - cout << endl; - int NumReads = sequenes.size(); - cout << "\nDone reading in \n Read in a total of " << NumReads + Rejects - << " and rejected " << Rejects << endl; - clock_t St, Et; - float Dt; - - struct timeval start, end; - gettimeofday(&start, NULL); - int FoundMatch = 0; - St = clock(); - - for (std::vector::size_type i = 0; i < sequenes.size(); i++) - { - - string A = sequenes[i]; - string Aqual = qual[i]; - string Adep = depth[i]; - string Astr = strand[i]; - size_t found = Astr.find("."); - if (found == string::npos) - { - if (FullOut) { - cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<**************************************************************>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << endl; - } - - Et = clock(); - - if ((int)i % 10 < 1){ - gettimeofday(&end, NULL); - float Dt = end.tv_sec - start.tv_sec; - cout << "aligning " << i << " of " << NumReads << ", \% done = " << ((double)i / (double)NumReads) * 100.00<< ", TotalTime= " << Dt << " , second per read = " << Dt / i<< ", \% finding match = "<< ((double)FoundMatch / (double)i) * 100.00 << "\r"; - } - - if (FullOut) { - Dt = ((double)(Et - St)) / CLOCKS_PER_SEC; - cout << "aligning " << i << " of " << NumReads - << "\% done = " << ((double)i / (double)NumReads) * 100.00 - << ", TotalTime= " << Dt << " , second per read = " << Dt / i - << ", \% finding match = " - << ((double)FoundMatch / (double)i) * 100.00 << endl - << A << endl; - - for (int z = 0; z < Adep.length(); z++) { - int bam = Adep.c_str()[z]; - cout << bam; - } - cout << endl; - } - - int k = -1; - int bestIndex = -1; - bool PerfectMatch = false; - int booya = Align3(sequenes, qual, strand, "wh", A, Aqual, i, k, bestIndex, MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) { - cout << "best forward score is " << booya << " k is " << k << endl; - } - - if (!(PerfectMatch)) { - string revA = Util::RevComp(A); - string revAqual = Util::RevQual(Aqual); - string revAdep = Util::RevQual(Adep); - string revAstr = FlipStrands(Astr); - int revk = -1; - int revbestIndex = -1; - int revbooya = Align3(sequenes, qual, strand, "wh", revA, revAqual, i, revk, revbestIndex, - - MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) { - cout << "best reverse score is " << revbooya << " k is " << revk - << endl; - } - - if (revbooya > booya) { - A = revA; - Aqual = revAqual; - Adep = revAdep; - Astr = revAstr; - k = revk; - booya = revbooya; - bestIndex = revbestIndex; - } - - } else { - if (FullOut) { - cout << "Perfect Match Found, Skipping Referse Search" << endl; - } - } - - if (booya < MinOverlap) { - if (FullOut) { - cout << "No good match found, skipping" << endl; - } - } else { - FoundMatch++; - string B = sequenes[bestIndex]; - string Bqual = qual[bestIndex]; - string Bdep = depth[bestIndex]; - string Bstr = strand[bestIndex]; - - if (k > 0) { - - if (FullOut) { - cout << "found match at " << k << endl; - - for (int z = 0; z < k; z++) { - cout << "+"; - } - - cout << A << endl << B << endl; - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - - cout << endl; - } - } else { - if (FullOut) { - cout << "found match at " << k << endl; - cout << A << endl; - - for (int z = 0; z < abs(k); z++) { - cout << "-"; - } - - cout << B << endl; - - for (int z = 0; z < abs(k); z++) { - cout << "-"; - } - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - - cout << endl; - } - } - - if (i == bestIndex) { - cout << "ERROR ____________________ SAME READS " << endl; - } - if (A.size() != Adep.size() && B.size() != Bdep.size()) { - cout << " ERRPR somethis the wrong size\n A= " << A.size() - << " Ad = " << Adep.size() << " B= " << B.size() - << " Bd = " << Bdep.size() << endl; - } - - string combined = - ColapsContigs(A, B, k, Aqual, Bqual, Adep, Bdep, Astr, Bstr); - - if (combined.size() != Bdep.size()) { - cout << " ERRPR combined is the wrong size\n C= " << combined.size() - << " Bd = " << Bdep.size() << endl; - } - - sequenes[bestIndex] = combined; - qual[bestIndex] = Bqual; - depth[bestIndex] = Bdep; - strand[bestIndex] = Bstr; - sequenes[i] = "moved"; - - if (FullOut) { - cout << combined << endl; - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - } - } - } - } - - cout << "\n\nRESULTS\n"; - int count = 0; - for (int i = 0; i < sequenes.size(); i++) { - - if (FullOut) { - cout << ">>>>" << sequenes[i] << endl; - } - - if (sequenes[i] != "moved" && sequenes[i].size() >= 95) { - string rDep = depth[i]; - int maxDep = -1; - - for (int z = 0; z < rDep.size(); z++) { - unsigned char bam = rDep.c_str()[z]; - if ((int)bam > maxDep) { - maxDep = (int)bam; - } - } - - if (maxDep >= MinCoverage && maxDep >= 2) { - - if (sequenes[i].size() != qual[i].size() && qual[i].size() != depth[i].size()) { - cout << "ERROR, read " - << "@NODE_" << argv[6] << "_" << i << "_L=" << sequenes[i].size() - << "_D=" << maxDep - << " Has the wrong size, Seq = " << sequenes[i].size() - << " Qual = " << qual[i].size() << " Dep = " << depth[i].size() - << endl; - } - - count++; - int F = 0; - int R = 0; - compresStrand(strand[i], F, R); - report << "@NODE_" << argv[6] << "_" << i << "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; - report << sequenes[i] << endl; - report << "+" << endl; - report << qual[i] << endl; - - Depreport << "@NODE_" << argv[6] << "_" << i<< "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; - Depreport << sequenes[i] << endl; - Depreport << "+" << endl; - Depreport << qual[i] << endl; - Depreport << strand[i] << endl; - unsigned char C = depth[i].c_str()[0]; - int booya = C; - Depreport << booya; - - for (int w = 1; w < depth[i].size(); w++) { - C = depth[i].c_str()[w]; - booya = C; - Depreport << " " << booya; - } - - Depreport << endl; - } - } - } - if (MinCoverage <= 1 ) - { - for (int i = 0; i < Unsequenes.size(); i++) { - - if (FullOut) { - cout << ">>>>" << Unsequenes[i] << endl; - } - - if (Unsequenes[i] != "moved" && Unsequenes[i].size() >= 95) { - int maxDep = -1; - - if (Unsequenes[i].size() != Unqual[i].size() && - Unqual[i].size() != Undepth[i].size()) { - cout << "ERROR, read " - << "@NODE_" << argv[6] << "_" << i << "_L=" << Unsequenes[i].size() - << "_D=" << maxDep - << " Has the wrong size, Seq = " << Unsequenes[i].size() - << " Qual = " << Unqual[i].size() << " Dep = " << Undepth[i].size() - << endl; - } - - count++; - report << "@NODE_" << argv[6] << "_" << i << "_L=" << Unsequenes[i].size() - << "_D" << maxDep << endl; - report << Unsequenes[i] << endl; - report << "+" << endl; - report << Unqual[i] << endl; - - Depreport << "@NODE_" << argv[6] << "_" << i - << "_L=" << Unsequenes[i].size() << "_D" << maxDep << endl; - Depreport << Unsequenes[i] << endl; - Depreport << "+" << endl; - Depreport << Unqual[i] << endl; - Depreport << Unstrand[i] << endl; - unsigned char C = Undepth[i].c_str()[0]; - int booya = C; - Depreport << booya; - - for (int w = 1; w < Undepth[i].size(); w++) { - C = Undepth[i].c_str()[w]; - booya = C; - Depreport << " " << booya; - } - - Depreport << endl; - } - } - } - else - cout << "min coverage = " << MinCoverage << " skipping Unaligned sequences" << endl; - cout << "\nWrote " << count << " sequences" << endl; - report.close(); -} diff --git a/src/OverlapSam.cpp b/src/OverlapSam.cpp index bce472c5..30456bd7 100644 --- a/src/OverlapSam.cpp +++ b/src/OverlapSam.cpp @@ -26,62 +26,70 @@ #include "Util.h" using namespace std; -unordered_map Mutations; +unordered_map Mutations; // All unique kmers (F + R) that get filtered into sequences/unsequences int HashSize = -1; bool FullOut = false; unordered_map DupCheck; + +// Performs three overlaps and returns the score from the best one +// First a complete overlap, then a partial at the 3' end of A and 5' end of B, then a partial at the 5' end of A and 3' end of B +// Score is simply +1 for each base that matches and has a qual > 5 on both strands (and is not N) int Align3(vector& sequenes, vector& quals, string Ap, string Aqp, int Ai, int& overlap, int& index, float minPercentpassed, bool& PerfectMatch, int MinOverlapPassed, int Threads) { - int QualityOffset = 33; //=64; + int QualityOffset = 33; int MinQual = 20; bool verbose = false; int bestScore = 0; int NumReads = sequenes.size(); int start = Ai + 1; - int end = start + 10; + int end = start + 10; + if (end > sequenes.size()) { end = sequenes.size(); } - if (FullOut == true ) {cout << "staring alignemtn from " << start << " to " << end<< endl;} + if (FullOut == true ) {cout << "staring alignment from " << start << " to " << end<< endl;} + + // Ap = sequence + // Aqp = quality of that sequence + // overlap = k argument + // minPercentagePassed = MinPercent (fixed at 0.99) + // minOverlapPassed = MinOverlap (fixed at 25) #pragma omp parallel for shared(Ap, Aqp, index, overlap, bestScore) num_threads(Threads) for (int j = start; j < end; j++) { - int MinOverlap = MinOverlapPassed; - float minPercent = minPercentpassed; + int MinOverlap = MinOverlapPassed; // 25 + float minPercent = minPercentpassed; // 0.99 int LocalBestScore = 0; int LocalIndex = -1; int LocalOverlap = 0; + bool LocalPerfectMatch = false; string A; int Alen; string Aq; - //#pragma omp critical - { - A = Ap; - Alen = A.length(); - Aq = Aqp; - } + A = Ap; + Alen = A.length(); + Aq = Aqp; + string B; string Bq; int Blength = -1; int Alength = Alen; int k; - - //#pragma omp critical - { - B = sequenes[j]; - Bq = quals[j]; - } + B = sequenes[j]; + Bq = quals[j]; + Blength = B.length(); int window = -1; int longest = -1; bool Asmaller = true; + // Set window to the smaller of the sequence lengths if (Blength > Alength) { window = Alength; longest = Blength; - Asmaller = false; + Asmaller = false; // This logic seems to be backwards - SJG } else { @@ -90,7 +98,7 @@ int Align3(vector& sequenes, vector& quals, string Ap, string Aq Asmaller = true; } - int MM = window - (window * minPercent); + int MM = window - (window * minPercent); // Base pair length allowed to mismatch int Acount = 0; int Bcount = 0; @@ -107,6 +115,7 @@ int Align3(vector& sequenes, vector& quals, string Ap, string Aq score++; } } + // Break out of loop if we've hit mismatch limit if ((k - score) > MM) { score = -1; @@ -114,8 +123,8 @@ int Align3(vector& sequenes, vector& quals, string Ap, string Aq } } - if (Asmaller) - { + // Nothing is done with these variables - can get rid of + if (Asmaller) { Acount++; } else { Bcount++; @@ -126,14 +135,17 @@ int Align3(vector& sequenes, vector& quals, string Ap, string Aq cout << " Score = " << score << endl; } + // Normalize score based on window size float percent = score / (window); if (percent >= minPercent) { - if (FullOut == true ) {cout << percent << " = " << score << " / " << window << endl;} + if (FullOut == true ) {cout << percent << " = " << score << " / " << window << endl;} if (LocalBestScore < score) { LocalBestScore = score; LocalIndex = j; + + // TODO: unsure of what this means - SJG if (Asmaller) { LocalOverlap = i * -1; @@ -141,15 +153,17 @@ int Align3(vector& sequenes, vector& quals, string Ap, string Aq LocalOverlap = i; } } + // Note: as soon as we find a perfect match we take the first one + // Could this affect STRs or long repeats? - SJG if (score == window) { - PerfectMatch = true; + LocalPerfectMatch = true; break; } } } - - if (PerfectMatch == false) + if (LocalPerfectMatch == false) { + // Check for overlap at end of A and start of B for (int i = window - 1; i >= MinOverlap; i--) { if (verbose) {cout << "i = " << i << endl;} @@ -191,6 +205,7 @@ int Align3(vector& sequenes, vector& quals, string Ap, string Aq } } + // Check for overlap at end of B and start of A for (int i = window - 1; i >= MinOverlap; i--) { if (verbose) { cout << "i = " << i << endl;} @@ -214,7 +229,7 @@ int Align3(vector& sequenes, vector& quals, string Ap, string Aq float percent = score / (k); if (percent >= minPercent) { - if (FullOut == true ) {cout << "percentthird = " << percent << " = " << score << " / " << k << endl;} + if (FullOut == true ) {cout << "percentthird = " << percent << " = " << score << " / " << k << endl;} if (LocalBestScore < score) { LocalBestScore = score; @@ -230,16 +245,26 @@ int Align3(vector& sequenes, vector& quals, string Ap, string Aq } #pragma omp critical(updateCounts) { - if (bestScore < LocalBestScore) { + if (bestScore < LocalBestScore || + (bestScore == LocalBestScore && LocalIndex < index)) { // Tie-breaker to ensure consistent results bestScore = LocalBestScore; index = LocalIndex; overlap = LocalOverlap; } + // Only want to update this logic if we have found a perfect match + if (LocalPerfectMatch) { + PerfectMatch = true; + } } } return bestScore; } +// Collapses reads A and B into a single string +// Takes the best base (i.e. the only base if only one is present) and not an N if possible +// Takes the higher of the two quality scores associated with the non-Z and non-N base +// Combines the depth for the reads to a maximum of 250 +// Returns the new combined base string, and updates pointers for quality, depth, and coverage string ColapsContigs(string A, string B, int k, string Aq, string& Bq, string& Ad, string& Bd, string& As, string& Bs) { bool verbose = false; @@ -310,6 +335,7 @@ string ColapsContigs(string A, string B, int k, string Aq, string& Bq, newQual += Bqual; } + // TODO: where is this depth value used in the future and is 250 a good hard number? if ((int)Adep + (int)Bdep < 250) { newDepth += (Adep + Bdep); } else { @@ -356,6 +382,7 @@ string ColapsContigs(string A, string B, int k, string Aq, string& Bq, return newString; } +// Trims Ns off the ends of the read string TrimNends(string S, string& qual) { bool base = false; string NewS = ""; @@ -531,6 +558,8 @@ void compresStrand(string S, int& F, int& R) { } return; } +// Takes in sequence, creates kmers, and filters for only those without Ns in them +// Asks how many of the filtered kmers occur in the mutation hash, and returns that number int CountHashes(string seq) { int count=0; @@ -587,7 +616,7 @@ int main(int argc, char* argv[]) { << "\n FileStub = " << argv[5] << "\n NodeStub = " << argv[6] << "\n MinCovTrimCov = " << argv[7] - << "\n HashPath = " << argv[8] + << "\n HashPath = " << argv[8] // This is .HashList (e.g. seq count) << "\n Threads = " << argv[9] << endl; @@ -614,6 +643,9 @@ int main(int argc, char* argv[]) { ofstream report; string FirstPassFile = argv[1]; std::stringstream ss; + + // Output file for sequences that successfully overlap + // TempOverlap/{namestub}.sam ss << argv[5] << ".fastq"; FirstPassFile = ss.str(); report.open(FirstPassFile.c_str()); @@ -624,6 +656,7 @@ int main(int argc, char* argv[]) { return 0; } + // Also writes a depth inclusive fastq that is named TempOverlap/{namestub}.fastqd ofstream Depreport; FirstPassFile += "d"; Depreport.open(FirstPassFile.c_str()); @@ -671,6 +704,7 @@ int main(int argc, char* argv[]) { } + // Remake Mutations hash table with forward and reverse unique kmers while (getline(MutHashFile, L1)) { vector temp; /* temp = Util::Split(L1, '\t'); @@ -705,6 +739,12 @@ int main(int argc, char* argv[]) { } cout << "HashSize = " << HashSize << endl; + // Iterate through fastq lines and check to see if they're long enough after removing end Ns, + // and that they pass bit flag checks + // If they do, add to sequenes vector, if not add to unsequenes vector + // Also tallies good and bad reads + // Note: this could be parallelized - each read is evaluated independently + // Just need to make sure that arrays are kept in relative order while (getline(fastq, L1)) { counter++; //cout << L1 << endl; @@ -712,53 +752,77 @@ int main(int argc, char* argv[]) { cout << "Read in " << counter << " reads, with " << goodreads << " aligned reads, " << unalignedCounter<< " unaligned reads, " << lowMapQual << "low map qual and " << other <<" other with rejected " << Rejects << " reads\r"; } + + // Split fields from line vector temp = Util::Split(L1, '\t'); + + // Replace any low quality bases with N temp[9] = ReplaceLowQBase(temp[9],temp[10], 10); + //temp[9] = TrimKends(temp[9], temp[10], 15); int ReadSize = temp[10].size(); + + // Extract flag frim first SAM column and convert to binary bool b[16]; int v = atoi(temp[1].c_str()); - - //TODO: understand this syntax for (int j = 0; j < 16; ++j) { b[j] = 0 != (v & (1 << j)); } + //if (DupCheck.count(temp[9]) > 0) //{ // cout << "skipping exact match sequence " << L1 << endl; //} //else + { int lowq = NumLowQbases(temp[10], 20); int length=temp[10].length(); DupCheck[temp[9]] == true; + + // Reject read if: + // Secondary alignment (bit 256) + // Supplementary alignment (bit 2048) + // PCR or optical duplicate (bit 1024) + // Read length < 50 + // Low quality bases > 33% of read if (b[8] or b[11] or b[10] or temp[9].length() < 50 or ((double) lowq / (double) length > 0.33)) { //cout << "rejected" << endl; //cout << L1 << endl; Rejects++; } - else if (b[2])//or atoi(temp[4].c_str())<5) + else if (b[2]) { + // If segment unmapped (bit 4) if (b[2]) unalignedCounter++; + // If READ mapping quality < 5 else if (atoi(temp[4].c_str())<5) lowMapQual++; else other++; - string L4 = temp[10]; - string L2 = temp[9]; ////////sequence////////// + string L4 = temp[10]; // Base Qualities + string L2 = temp[9]; // Sequence + + // Trim Ns off the ends of the read L2 = TrimNends(L2, L4); + // Count how many non-N hashes are in the read int hashes = CountHashes(L2); - //cout << "poorly mapped read " << L1 << endl; - //cout << "with Hash = " << hashes << endl; + + // If the trimmed sequence is > 60% of the original read size if ((double)L2.size() / (double)ReadSize > .6) { ReadSize = L2.size(); lines++; Unsequenes.push_back(L2); Unqual.push_back(L4); + + // If we do have hashes matching this read, + // check the bit masks if read has "multiple segments in sequencing" + // or if "SEQ is being reverse complemented" + // TODO: I don't know what these conditions mean, from SAM specs if (hashes > 0) { if (b[0]== 0) @@ -863,6 +927,7 @@ int main(int argc, char* argv[]) { int FoundMatch = 0; St = clock(); + // Iterate through sequences, try to align each with Align3 for (std::vector::size_type i = 0; i < sequenes.size(); i++) { string A = sequenes[i]; @@ -901,6 +966,7 @@ int main(int argc, char* argv[]) { int k = -1; int bestIndex = -1; bool PerfectMatch = false; + // Booya is best score found for forward strand int booya = Align3(sequenes, qual, A, Aqual, i, k, bestIndex, MinPercent, PerfectMatch, MinOverlap, Threads); if (FullOut) { cout << "best forward score is " << booya << " k is " << k << endl; @@ -913,7 +979,8 @@ int main(int argc, char* argv[]) { string revAstr = FlipStrands(Astr); int revk = -1; int revbestIndex = -1; - int revbooya = + int revbooya = -1; + // Now find best score for reverse strand Align3(sequenes, qual, revA, revAqual, i, revk, revbestIndex, MinPercent, PerfectMatch, MinOverlap, Threads); if (FullOut) { cout << "best reverse score is " << revbooya << " k is " << revk @@ -932,7 +999,7 @@ int main(int argc, char* argv[]) { } else { if (FullOut) { - cout << "Perfect Match Found, Skipping Referse Search" << endl; + cout << "Perfect Match Found, Skipping Reverse Search" << endl; } } @@ -953,8 +1020,8 @@ int main(int argc, char* argv[]) { cout << "found match at " << k << endl; for (int z = 0; z < k; z++) { - cout << "+"; - } + cout << "+"; + } cout << A << endl << B << endl; @@ -971,14 +1038,14 @@ int main(int argc, char* argv[]) { cout << A << endl; for (int z = 0; z < abs(k); z++) { - cout << "-"; - } + cout << "-"; + } cout << B << endl; for (int z = 0; z < abs(k); z++) { - cout << "-"; - } + cout << "-"; + } for (int z = 0; z < Bdep.length(); z++) { int bam = Bdep.c_str()[z]; @@ -998,14 +1065,14 @@ int main(int argc, char* argv[]) { << " Bd = " << Bdep.size() << endl; } - string combined = - ColapsContigs(A, B, k, Aqual, Bqual, Adep, Bdep, Astr, Bstr); + string combined = ColapsContigs(A, B, k, Aqual, Bqual, Adep, Bdep, Astr, Bstr); if (combined.size() != Bdep.size()) { cout << " ERRPR combined is the wrong size\n C= " << combined.size() << " Bd = " << Bdep.size() << endl; } + // Update the sequences, quality, depth, and strand vectors with the new combined sequence sequenes[bestIndex] = combined; qual[bestIndex] = Bqual; depth[bestIndex] = Bdep; @@ -1032,10 +1099,12 @@ int main(int argc, char* argv[]) { cout << ">>>>" << sequenes[i] << endl; } + // Iterate through combined sequences if (sequenes[i] != "moved" && sequenes[i].size() >= 95) { string rDep = depth[i]; int maxDep = -1; + // Find the max depth of the read for (int z = 0; z < rDep.size(); z++) { unsigned char bam = rDep.c_str()[z]; if ((int)bam > maxDep) { @@ -1043,6 +1112,7 @@ int main(int argc, char* argv[]) { } } + // Check that our max depth is greater than 3 (hard coded for now) if (maxDep >= MinCoverage /*&& maxDep >= 2*/) { if (sequenes[i].size() != qual[i].size() && qual[i].size() != depth[i].size()) { @@ -1057,21 +1127,26 @@ int main(int argc, char* argv[]) { count++; int F = 0; int R = 0; + // Compress strand to make unique index for fastq file compresStrand(strand[i], F, R); + + // Write out to fastq report << "@NODE_" << argv[6] << "_" << i << "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; report << sequenes[i] << endl; report << "+" << endl; report << qual[i] << endl; + // Write out to depth fastq Depreport << "@NODE_" << argv[6] << "_" << i<< "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; Depreport << sequenes[i] << endl; Depreport << "+" << endl; Depreport << qual[i] << endl; Depreport << strand[i] << endl; + + // Write out depth of each base unsigned char C = depth[i].c_str()[0]; int booya = C; Depreport << booya; - for (int w = 1; w < depth[i].size(); w++) { C = depth[i].c_str()[w]; booya = C; diff --git a/src/OverlapSam.cpp.save b/src/OverlapSam.cpp.save deleted file mode 100644 index 1cdb938a..00000000 --- a/src/OverlapSam.cpp.save +++ /dev/null @@ -1,1133 +0,0 @@ -/*By ANDREW FARRELL - * OverlapSam.cpp - * -------------------------------------------------- - * Assembles k-mers containing variation into contigs - * that represent the variant sequence - * -------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "Util.h" - -using namespace std; -unordered_map Mutations; -int HashSize = -1; -bool FullOut = true; -unordered_map DupCheck; -int Align3(vector& sequenes, vector& quals, string Ap, string Aqp, int Ai, int& overlap, int& index, float minPercentpassed, bool& PerfectMatch, int MinOverlapPassed, int Threads) -{ - int QualityOffset = 33; //=64; - int MinQual = 20; - bool verbose = false; - int bestScore = 0; - int NumReads = sequenes.size(); - int start = Ai + 1; - int end = start + 3; - if (end > sequenes.size()) - { - end = sequenes.size(); - } - - #pragma omp parallel for shared(Ap, Aqp, index, overlap, bestScore) num_threads(Threads) - for (int j = start; j < end; j++) - { - int MinOverlap = MinOverlapPassed; - float minPercent = minPercentpassed; - int LocalBestScore = 0; - int LocalIndex = -1; - int LocalOverlap = 0; - string A; - int Alen; - string Aq; - //#pragma omp critical - { - A = Ap; - Alen = A.length(); - Aq = Aqp; - } - string B; - string Bq; - int Blength = -1; - int Alength = Alen; - int k; - - //#pragma omp critical - { - B = sequenes[j]; - Bq = quals[j]; - } - Blength = B.length(); - int window = -1; - int longest = -1; - bool Asmaller = true; - - if (Blength > Alength) - { - window = Alength; - longest = Blength; - Asmaller = false; - } - else - { - window = Blength; - longest = Alength; - Asmaller = true; - } - - int MM = window - (window * minPercent); - int Acount = 0; - int Bcount = 0; - - for (int i = 0; i <= longest - window; i++) - { - float score = 0; - //first check where the reads completely overlap - for (k = 0; k < window; k++) - { - if (A.c_str()[k + Acount] == B.c_str()[k + Bcount]) - { - if (B.c_str()[k + Bcount] != 'N' && (int)Aq.c_str()[k + Acount] > 5 && (int)Bq.c_str()[k + Bcount] > 5) - { - score++; - } - } - if ((k - score) > MM) - { - score = -1; - break; - } - } - - if (Asmaller) - { - Acount++; - } else { - Bcount++; - } - - if (verbose) - { - cout << " Score = " << score << endl; - } - - float percent = score / (window); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - if (Asmaller) - { - LocalOverlap = i * -1; - } else { - LocalOverlap = i; - } - } - if (score == window) { - PerfectMatch = true; - break; - } - } - } - - if (PerfectMatch == false) - { - for (int i = window - 1; i >= MinOverlap; i--) - { - if (verbose) {cout << "i = " << i << endl;} - - float score = 0; - for (k = 0; k <= i; k++) - { - if (verbose) {cout << " k = " << k << " so A = " << Alength - i + k<< " /\\ B = " << 0 + k << endl;} - if (verbose) {cout << " A >> " << A.c_str()[Alength - i + k - 1] << "="<< B.c_str()[0 + k] << " << B" << endl;} - - if (A.c_str()[Alength - i + k - 1] == B.c_str()[0 + k]) - { - if (B.c_str()[0 + k] != 'N' && (int)Aq.c_str()[Alength - i + k - 1] > 5 &&(int)Bq.c_str()[0 + k] > 5) - { - score++; - } - } - if ((k - score) > MM) { - score = -1; - break; - } - } - if (verbose) {cout << " Score = " << score << endl;} - - float percent = score / (k); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = i - Alength + 1; - if (score == i) - { - break; - } - } - } - } - - for (int i = window - 1; i >= MinOverlap; i--) - { - if (verbose) { cout << "i = " << i << endl;} - float score = 0; - for (k = 0; k <= i; k++) { - if (B.c_str()[Blength - i + k - 1] == A.c_str()[0 + k]) - { - if (A.c_str()[0 + k] != 'N' && (int)Aq.c_str()[0 + k] > 5 && (int)Bq.c_str()[Blength - i + k - 1] > 5) - { - score++; - } - } - if ((k - score) > MM) { - score = -1; - break; - } - } - - if (verbose) {cout << " Score = " << score << endl;} - - float percent = score / (k); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = Blength - i - 1; - if (score == i) - { - break; - } - } - } - } - } - #pragma omp critical(updateCounts) - { - if (bestScore < LocalBestScore) { - bestScore = LocalBestScore; - index = LocalIndex; - overlap = LocalOverlap; - } - } - } - return bestScore; -} - -string ColapsContigs(string A, string B, int k, string Aq, string& Bq, - string& Ad, string& Bd, string& As, string& Bs) { - bool verbose = false; - if (verbose) { - cout << "Combinding; \n" << A << endl << B << endl; - } - - int Asize = A.length(); - int Bsize = B.length(); - - int Aoffset = 0; - int Boffset = 0; - int window; - string newString = ""; - string newQual = ""; - string newDepth = ""; - - if (k > 0) { - Aoffset = k; - } else { - Boffset = abs(k); - } - - if (verbose) { - cout << "K = " << k << " so Aofset = " << Aoffset - << " and Boffset = " << Boffset << endl; - } - - for (int i = 0; i < Asize + Bsize; i++) { - char Abase = 'Z'; - char Bbase = 'Z'; - char Aqual = '!'; - char Bqual = '!'; - unsigned char Adep = 0; - unsigned char Bdep = 0; - - if (((i - Aoffset) >= 0) && ((i - Aoffset) < A.length())) { - Abase = A.c_str()[i - Aoffset]; - Aqual = Aq.c_str()[i - Aoffset]; - Adep = Ad.c_str()[i - Aoffset]; - } else { - Abase = 'Z'; - Aqual = '!'; - Adep = 0; - } - - if (i - Boffset >= 0 && i - Boffset < B.length()) { - Bbase = B.c_str()[i - Boffset]; - Bqual = Bq.c_str()[i - Boffset]; - Bdep = Bd.c_str()[i - Boffset]; - } else { - Bbase = 'Z'; - Bqual = '!'; - Bdep = 0; - } - - if (verbose) { - cout << "I = " << i << " Bi = " << i - Boffset << " Ai = " << i - Aoffset - << " thus " << Abase << "-" << Bbase << endl; - } - - if (Abase == Bbase && Abase != 'Z') { - newString += Abase; - - if (Aqual >= Bqual) { - newQual += Aqual; - } else { - newQual += Bqual; - } - - if ((int)Adep + (int)Bdep < 250) { - newDepth += (Adep + Bdep); - } else { - newDepth += 250; - } - - } else if (Abase == 'Z' && Bbase != 'Z') { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } else if (Abase != 'Z' && Bbase == 'Z') { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else if (Abase != 'Z' && Bbase != 'Z') { - - if (Abase == 'N' && Bbase != 'N') { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } else if (Abase != 'N' && Bbase == 'N') { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else if (Aqual >= Bqual) { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } - - } else if (Abase == 'Z' && Bbase == 'Z') { - Bq = newQual; - Bd = newDepth; - break; - } - } - Bq = newQual; - Bd = newDepth; - Bs += As; - return newString; -} - -string TrimNends(string S, string& qual) { - bool base = false; - string NewS = ""; - string NewQ = ""; - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } else if (S.c_str()[i] != 'A' && S.c_str()[i] != 'C' && - S.c_str()[i] != 'G' && S.c_str()[i] != 'T') { - } else { - base = true; - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } - } - qual = NewQ; - return NewS; -} -string ReplaceLowQBase(string S, string qual, int min) { - string NewS = ""; - for (int i = 0; i < S.size() ; i++) { - if ( int(qual.c_str()[i]) - 33 < min) - {NewS = NewS + 'N' ;} - else - {NewS = NewS + S.c_str()[i] ;} - } - return NewS; -} -string TrimKends(string S, string& qual, int TrimLen) { - string NewS = ""; - string NewQ = ""; - if (S.size()-TrimLen-TrimLen > 0) - { - for (int i = TrimLen; i < S.size()-TrimLen ; i++) { - // cout << "i = " << i << endl; - NewS = NewS + S.c_str()[i] ; - NewQ = NewQ + qual.c_str()[i]; - } - // cout << "TRIM CEHCK\n" << S << "\n" << " " << NewS << "\n" << qual << "\n " << NewQ << endl; - } - else - { - cout << "Warning read is shorter than the clipping length, just returning the read" << endl; - } - qual = NewQ; - return NewS; -} - -string TrimLowCoverageEnds(string S, string& quals, string& depth, int cutoff) { - bool base = false; - string NewS = ""; - string NewD = ""; - string NewQ = ""; - - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } - } - - if (NewS.size() > 1) { - S = NewS; - depth = NewD; - quals = NewQ; - base = false; - NewS = ""; - NewD = ""; - NewQ = ""; - - for (int i = 0; i < S.size(); i++) { - if (base) { - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } - } - } - depth = NewD; - quals = NewQ; - return NewS; -} - -string AdjustBases(string sequence, string qual) { - int MinQ = 10; - int QualOffset = 32; - string NewString = ""; - for (int i = 0; i < sequence.length(); i++) { - if (qual.c_str()[i] - QualOffset < MinQ) { - NewString += 'N'; - } else { - NewString += sequence.c_str()[i]; - } - } - - if (NewString != sequence) { - return NewString; - } -} - -bool replace(std::string& str, const std::string& from, const std::string& to) { - size_t start_pos = str.find(from); - if (start_pos == std::string::npos) { - return false; - } - str.replace(start_pos, from.length(), to); - return true; -} - -bool validateFASTQD(string& L1, string& L2, string& L3, string& L4, string& L5, - string& L6) { - if (L1.c_str()[0] != '@') { - cout << "error header problems - " << L1 << endl; - return false; - } - if (L2.size() != L4.size()) { - cout << "error sequence and qual problems - \n" << L2 << endl - << L4 << endl; - return false; - } - vector temp = Util::Split(L6, ' '); - if (temp.size() != L2.size()) { - cout << "error counts problems - " << L2.size() << " != " << temp.size() - << endl; - return false; - } - return true; -} - -bool IsBitSet(int num, int bit) { return 1 == ((num >> bit) & 1); } - -int GetReadOrientation(int flag) { - bool is_set = IsBitSet(flag, 4); - cout << "flag is " << flag << endl; - cout << "orientation is " << is_set << endl; - return is_set; -} - -string FlipStrands(string strand) { - string NewStrand = ""; - for (int i = 0; i < strand.size(); i++) { - if (strand.c_str()[i] == '+') - NewStrand += "-"; - else if (strand.c_str()[i] == '-') - NewStrand += "+"; - else if(strand.c_str()[i] == '.') - NewStrand += "."; - } - return NewStrand; -} - -void compresStrand(string S, int& F, int& R) { - for (int i = 0; i < S.size(); i++) { - if (S.c_str()[i] == '+') - F++; - else if (S.c_str()[i] == '-') - R++; - } - return; -} -int CountHashes(string seq) -{ - int count=0; - for (int i = 0; i < seq.size()-HashSize; i++) - { - string hash = seq.substr(i, HashSize); - size_t found = hash.find("N"); - if (found == string::npos) - { - if(Mutations.count(Util::HashToLong( hash)) > 0) - {count++;} - } - } - return count; -} -int NumLowQbases(string qual, int min) -{ - int count = 0; - for (int i =0; i < qual.size(); i++) - { - if( int(qual.c_str()[i]) - 33 < min) - count++; - } - return count; -} -int main(int argc, char* argv[]) { - float MinPercent; - int MinOverlap; - int MinCoverage; - cout << "you gave " << argc << " Arguments" << endl; - if (argc != 10) { - cout << "ERROR, wrong numbe of arguemnts\nCall is: SAM, MinPercent, " - "MinOverlap, MinCoverage, ReportStub, NodeStub LCcutoff Threads" - << endl - << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] - << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] - << "\n FileStub = " << argv[5] - << "\n NodeStub = " << argv[6] - << "\n MinCov = " << argv[7] - << "\n HashPath = " << argv[8] - << "\n Threads = " << argv[9] - << endl; - return 0; - } - cout << "YAY,right numbe of arguemnts\nCall is: SAM, MinPercent, " - "MinOverlap, MinCoverage, ReportStub, NodeStub LCcutoff Threads" - << endl - << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] - << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] - << "\n FileStub = " << argv[5] - << "\n NodeStub = " << argv[6] - << "\n MinCovTrimCov = " << argv[7] - << "\n HashPath = " << argv[8] - << "\n Threads = " << argv[9] - << endl; - - ifstream fastq; - fastq.open(argv[1]); - if (fastq.is_open()) { - cout << "File open - " << argv[1] << endl; - } else { - cout << "Error, ParentHashFile could not be opened"; - return 0; - } - - string temp = argv[2]; - MinPercent = atof(temp.c_str()); - temp = argv[3]; - MinOverlap = atoi(temp.c_str()); - temp = argv[4]; - MinCoverage = atoi(temp.c_str()); - temp = argv[7]; - int LCcutoff = atoi(temp.c_str()); - string HashPath = argv[8]; - temp = argv[9]; - int Threads = atoi(temp.c_str()); - ofstream report; - string FirstPassFile = argv[1]; - std::stringstream ss; - ss << argv[5] << ".fastq"; - FirstPassFile = ss.str(); - report.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile << endl; - return 0; - } - - ofstream Depreport; - FirstPassFile += "d"; - Depreport.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile << endl; - return 0; - } - - string line; - std::vector sequenes; - std::vector qual; - std::vector depth; - std::vector strand; - std::vector Unsequenes; - std::vector Unqual; - std::vector Undepth; - std::vector Unstrand; - int lines = -1; - string L1; - string L2; - string L3; - string L4; - string L5; - string L6; - unsigned long LongHash; - int Rejects = 0; - string Fastqd = argv[1]; - cout << "Reading in SAM \n"; - int counter = 0; - int unalignedCounter = 0; - int goodreads = 0; - int lowMapQual = 0; - int other = 0; - cout << "reading in hash list" << endl; - ifstream MutHashFile; - MutHashFile.open(HashPath); - if (MutHashFile.is_open()) { - cout << "Parent File open - " << argv[1] << endl; - } // cout << "##File Opend\n"; - else { - cout << "Error, ParentHashFile could not be opened"; - return 0; - } - - - while (getline(MutHashFile, L1)) { - vector temp; - /* temp = Util::Split(L1, '\t'); - - if (temp.size() == 2) { - unsigned long b = Util::HashToLong(temp[0]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[0])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - HashSize = temp[0].size(); - } else if (temp.size() == 4) { - unsigned long b = Util::HashToLong(temp[3]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[3])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - HashSize = temp[3].size(); - } - if (temp.size() == 1) {*/ - temp = Util::Split(L1, ' '); - unsigned long b = Util::HashToLong(temp[0]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[0])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - HashSize = temp[0].size(); - //} - } - - if (HashSize == -1) - { - cout << "ERROR Hash Size could not be determined by the HashFile" << endl; - return -1; - } - cout << "HashSize = " << HashSize << endl; - - while (getline(fastq, L1)) { - counter++; - //cout << L1 << endl; - if (counter % 100 == 1) { - cout << "Read in " << counter << " reads, with " << goodreads << " aligned reads, " << unalignedCounter<< " unaligned reads, " << lowMapQual << "low map qual and " << other <<" other with rejected " << Rejects - << " reads\r"; - } - vector temp = Util::Split(L1, '\t'); - temp[9] = ReplaceLowQBase(temp[9],temp[10], 36); - temp[9] = TrimKends(temp[9], temp[10], 15); - int ReadSize = temp[10].size(); - bool b[16]; - int v = atoi(temp[1].c_str()); - - //TODO: understand this syntax - for (int j = 0; j < 16; ++j) - { - b[j] = 0 != (v & (1 << j)); - } - //if (DupCheck.count(temp[9]) > 0) - //{ - // cout << "skipping exact match sequence " << L1 << endl; - //} - //else - { - int lowq = NumLowQbases(temp[10], 20); - int length=temp[10].length(); - DupCheck[temp[9]] == true; - if (b[8] or b[11] or b[10] or temp[9].length() < 50 or ((double) lowq / (double) length > 0.33)) - { - //cout << "rejected" << endl; - //cout << L1 << endl; - Rejects++; - } - else if (b[2])//or atoi(temp[4].c_str())<5) - { - if (b[2]) - unalignedCounter++; - else if (atoi(temp[4].c_str())<5) - lowMapQual++; - else - other++; - string L4 = temp[10]; - string L2 = temp[9]; ////////sequence////////// - L2 = TrimNends(L2, L4); - int hashes = CountHashes(L2); - //cout << "poorly mapped read " << L1 << endl; - //cout << "with Hash = " << hashes << endl; - if ((double)L2.size() / (double)ReadSize > .6) - { - ReadSize = L2.size(); - lines++; - Unsequenes.push_back(L2); - Unqual.push_back(L4); - if (hashes > 0) - { - if (b[0]== 0) - { - Unstrand.push_back("."); - } - else if (b[4] == 0) - { - Unstrand.push_back("+"); - } - else if (b[4] == 1) - { - Unstrand.push_back("-"); - } - } - else - Unstrand.push_back("."); - - string depths = ""; - unsigned char C = 1; - - for (int i = 0; i < L2.length(); i++) - { - depths += C; - } - - Undepth.push_back(depths); - - } - else - { - Rejects++; - } - - } - else - { - goodreads++; - //cout << "good alignment" << endl; - string L4 = temp[10]; - string L2 = temp[9]; - L2 = TrimNends(L2, L4); - int hashes = CountHashes(L2); - - //cout << "Hash = " << hashes << endl; - //if (hashes > 0) - //{ - if ((double)L2.size() / (double)ReadSize > .6) - { - ReadSize = L2.size(); - lines++; - sequenes.push_back(L2); - qual.push_back(L4); - string depths = ""; - - if (hashes > 0) - { - if (b[0]== 0) - { - strand.push_back("."); - } - else if (b[4] == 0) - { - strand.push_back("+"); - } - else if (b[4] == 1) - { - strand.push_back("-"); - } - } - else - strand.push_back("."); - - unsigned char C = 1; - - for (int i = 0; i < L2.length(); i++) - { - depths += C; - } - - depth.push_back(depths); - - } - else - { - Rejects++; - } - //} - } - } - } - - cout << endl; - int NumReads = sequenes.size(); - cout << "\nDone reading in \n Read in a total of " << NumReads + Rejects - << " and rejected " << Rejects << endl; - clock_t St, Et; - float Dt; - - struct timeval start, end; - gettimeofday(&start, NULL); - int FoundMatch = 0; - St = clock(); - - for (std::vector::size_type i = 0; i < sequenes.size(); i++) - { - string A = sequenes[i]; - string Aqual = qual[i]; - string Adep = depth[i]; - string Astr = strand[i]; - - if (FullOut) { - cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<**************************************************************>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << endl; - } - - Et = clock(); - - if ((int)i % 10 < 1){ - gettimeofday(&end, NULL); - float Dt = end.tv_sec - start.tv_sec; - cout << "aligning " << i << " of " << NumReads << ", \% done = " << ((double)i / (double)NumReads) * 100.00<< ", TotalTime= " << Dt << " , second per read = " << Dt / i<< ", \% finding match = "<< ((double)FoundMatch / (double)i) * 100.00 << "\r"; - } - - if (FullOut) { - Dt = ((double)(Et - St)) / CLOCKS_PER_SEC; - cout << "aligning " << i << " of " << NumReads - << "\% done = " << ((double)i / (double)NumReads) * 100.00 - << ", TotalTime= " << Dt << " , second per read = " << Dt / i - << ", \% finding match = " - << ((double)FoundMatch / (double)i) * 100.00 << endl - << A << endl; - - for (int z = 0; z < Adep.length(); z++) { - int bam = Adep.c_str()[z]; - cout << bam; - } - cout << endl; - } - - int k = -1; - int bestIndex = -1; - bool PerfectMatch = false; - int booya = Align3(sequenes, qual, A, Aqual, i, k, bestIndex, MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) { - cout << "best forward score is " << booya << " k is " << k << endl; - } - - if (!(PerfectMatch)) { - string revA = Util::RevComp(A); - string revAqual = Util::RevQual(Aqual); - string revAdep = Util::RevQual(Adep); - string revAstr = FlipStrands(Astr); - int revk = -1; - int revbestIndex = -1; - int revbooya = - Align3(sequenes, qual, revA, revAqual, i, revk, revbestIndex, - - MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) { - cout << "best reverse score is " << revbooya << " k is " << revk - << endl; - } - - if (revbooya > booya) { - A = revA; - Aqual = revAqual; - Adep = revAdep; - Astr = revAstr; - k = revk; - booya = revbooya; - bestIndex = revbestIndex; - } - - } else { - if (FullOut) { - cout << "Perfect Match Found, Skipping Referse Search" << endl; - } - } - - if (booya < MinOverlap) { - if (FullOut) { - cout << "No good match found, skipping" << endl; - } - } else { - FoundMatch++; - string B = sequenes[bestIndex]; - string Bqual = qual[bestIndex]; - string Bdep = depth[bestIndex]; - string Bstr = strand[bestIndex]; - - if (k > 0) { - - if (FullOut) { - cout << "found match at " << k << endl; - - for (int z = 0; z < k; z++) { - cout << "+"; - } - - cout << A << endl << B << endl; - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - - cout << endl; - } - } else { - if (FullOut) { - cout << "found match at " << k << endl; - cout << A << endl; - - for (int z = 0; z < abs(k); z++) { - cout << "-"; - } - - cout << B << endl; - - for (int z = 0; z < abs(k); z++) { - cout << "-"; - } - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - - cout << endl; - } - } - - if (i == bestIndex) { - cout << "ERROR ____________________ SAME READS " << endl; - } - if (A.size() != Adep.size() && B.size() != Bdep.size()) { - cout << " ERRPR somethis the wrong size\n A= " << A.size() - << " Ad = " << Adep.size() << " B= " << B.size() - << " Bd = " << Bdep.size() << endl; - } - - string combined = - ColapsContigs(A, B, k, Aqual, Bqual, Adep, Bdep, Astr, Bstr); - - if (combined.size() != Bdep.size()) { - cout << " ERRPR combined is the wrong size\n C= " << combined.size() - << " Bd = " << Bdep.size() << endl; - } - - sequenes[bestIndex] = combined; - qual[bestIndex] = Bqual; - depth[bestIndex] = Bdep; - strand[bestIndex] = Bstr; - sequenes[i] = "moved"; - - if (FullOut) { - cout << combined << endl; - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - } - } - } - - cout << "\n\nRESULTS\n"; - int count = 0; - cout << "sequenes size = " << sequenes.size() << endl; - for (int i = 0; i < sequenes.size(); i++) { - - if (FullOut) { - cout << ">>>>" << sequenes[i] << endl; - } - - if (sequenes[i] != "moved" && sequenes[i].size() >= 95) { - string rDep = depth[i]; - int maxDep = -1; - - for (int z = 0; z < rDep.size(); z++) { - unsigned char bam = rDep.c_str()[z]; - if ((int)bam > maxDep) { - maxDep = (int)bam; - } - } - - if (maxDep >= MinCoverage /*&& maxDep >= 2*/) { - - if (sequenes[i].size() != qual[i].size() && qual[i].size() != depth[i].size()) { - cout << "ERROR, read " - << "@NODE_" << argv[6] << "_" << i << "_L=" << sequenes[i].size() - << "_D=" << maxDep - << " Has the wrong size, Seq = " << sequenes[i].size() - << " Qual = " << qual[i].size() << " Dep = " << depth[i].size() - << endl; - } - - count++; - int F = 0; - int R = 0; - compresStrand(strand[i], F, R); - report << "@NODE_" << argv[6] << "_" << i << "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; - report << sequenes[i] << endl; - report << "+" << endl; - report << qual[i] << endl; - - Depreport << "@NODE_" << argv[6] << "_" << i<< "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; - Depreport << sequenes[i] << endl; - Depreport << "+" << endl; - Depreport << qual[i] << endl; - Depreport << strand[i] << endl; - unsigned char C = depth[i].c_str()[0]; - int booya = C; - Depreport << booya; - - for (int w = 1; w < depth[i].size(); w++) { - C = depth[i].c_str()[w]; - booya = C; - Depreport << " " << booya; - } - - Depreport << endl; - } - } - } - if (MinCoverage <= 1 ) - { - for (int i = 0; i < Unsequenes.size(); i++) { - - if (FullOut) { - cout << ">>>>" << Unsequenes[i] << endl; - } - - if (Unsequenes[i] != "moved" && Unsequenes[i].size() >= 95) { - int maxDep = -1; - - if (Unsequenes[i].size() != Unqual[i].size() && - Unqual[i].size() != Undepth[i].size()) { - cout << "ERROR, read " - << "@NODE_" << argv[6] << "_" << i << "_L=" << Unsequenes[i].size() - << "_D=" << maxDep - << " Has the wrong size, Seq = " << Unsequenes[i].size() - << " Qual = " << Unqual[i].size() << " Dep = " << Undepth[i].size() - << endl; - } - - count++; - report << "@NODE_" << argv[6] << "_" << i << "_L=" << Unsequenes[i].size() - << "_D" << maxDep << endl; - report << Unsequenes[i] << endl; - report << "+" << endl; - report << Unqual[i] << endl; - - Depreport << "@NODE_" << argv[6] << "_" << i - << "_L=" << Unsequenes[i].size() << "_D" << maxDep << endl; - Depreport << Unsequenes[i] << endl; - Depreport << "+" << endl; - Depreport << Unqual[i] << endl; - Depreport << Unstrand[i] << endl; - unsigned char C = Undepth[i].c_str()[0]; - int booya = C; - Depreport << booya; - - for (int w = 1; w < Undepth[i].size(); w++) { - C = Undepth[i].c_str()[w]; - booya = C; - Depreport << " " << booya; - } - - Depreport << endl; - } - } - } - else - cout << "min coverage = " << MinCoverage << " skipping Unaligned sequences" << endl; - cout << "\nWrote " << count << " sequences" << endl; - report.close(); -} diff --git a/src/OverlapSam.save.cpp b/src/OverlapSam.save.cpp deleted file mode 100644 index aa5eaa03..00000000 --- a/src/OverlapSam.save.cpp +++ /dev/null @@ -1,975 +0,0 @@ -/*By ANDREW FARRELL - * OverlapSam.cpp - * -------------------------------------------------- - * Assembles k-mers containing variation into contigs - * that represent the variant sequence - * -------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "Util.h" - -using namespace std; - -bool FullOut = false; -unordered_map DupCheck; -int Align3(vector& sequenes, vector& quals, string Ap, string Aqp, int Ai, int& overlap, int& index, float minPercentpassed, bool& PerfectMatch, int MinOverlapPassed, int Threads) -{ - int QualityOffset = 33; //=64; - int MinQual = 20; - bool verbose = false; - int bestScore = 0; - int NumReads = sequenes.size(); - int start = Ai + 1; - int end = start + 100; - if (end > sequenes.size()) - { - end = sequenes.size(); - } - - #pragma omp parallel for shared(Ap, Aqp, index, overlap, bestScore) num_threads(Threads) - for (int j = start; j < end; j++) - { - int MinOverlap = MinOverlapPassed; - float minPercent = minPercentpassed; - int LocalBestScore = 0; - int LocalIndex = -1; - int LocalOverlap = 0; - string A; - int Alen; - string Aq; - //#pragma omp critical - { - A = Ap; - Alen = A.length(); - Aq = Aqp; - } - string B; - string Bq; - int Blength = -1; - int Alength = Alen; - int k; - - //#pragma omp critical - { - B = sequenes[j]; - Bq = quals[j]; - } - Blength = B.length(); - int window = -1; - int longest = -1; - bool Asmaller = true; - - if (Blength > Alength) - { - window = Alength; - longest = Blength; - Asmaller = false; - } - else - { - window = Blength; - longest = Alength; - Asmaller = true; - } - - int MM = window - (window * minPercent); - int Acount = 0; - int Bcount = 0; - - for (int i = 0; i <= longest - window; i++) - { - float score = 0; - //first check where the reads completely overlap - for (k = 0; k < window; k++) - { - if (A.c_str()[k + Acount] == B.c_str()[k + Bcount]) - { - if (B.c_str()[k + Bcount] != 'N' && (int)Aq.c_str()[k + Acount] > 5 && (int)Bq.c_str()[k + Bcount] > 5) - { - score++; - } - } - if ((k - score) > MM) - { - score = -1; - break; - } - } - - if (Asmaller) - { - Acount++; - } else { - Bcount++; - } - - if (verbose) - { - cout << " Score = " << score << endl; - } - - float percent = score / (window); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - if (Asmaller) - { - LocalOverlap = i * -1; - } else { - LocalOverlap = i; - } - } - if (score == window) { - PerfectMatch = true; - break; - } - } - } - - if (PerfectMatch == false) - { - for (int i = window - 1; i >= MinOverlap; i--) - { - if (verbose) {cout << "i = " << i << endl;} - - float score = 0; - for (k = 0; k <= i; k++) - { - if (verbose) {cout << " k = " << k << " so A = " << Alength - i + k<< " /\\ B = " << 0 + k << endl;} - if (verbose) {cout << " A >> " << A.c_str()[Alength - i + k - 1] << "="<< B.c_str()[0 + k] << " << B" << endl;} - - if (A.c_str()[Alength - i + k - 1] == B.c_str()[0 + k]) - { - if (B.c_str()[0 + k] != 'N' && (int)Aq.c_str()[Alength - i + k - 1] > 5 &&(int)Bq.c_str()[0 + k] > 5) - { - score++; - } - } - if ((k - score) > MM) { - score = -1; - break; - } - } - if (verbose) {cout << " Score = " << score << endl;} - - float percent = score / (k); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = i - Alength + 1; - if (score == i) - { - break; - } - } - } - } - - for (int i = window - 1; i >= MinOverlap; i--) - { - if (verbose) { cout << "i = " << i << endl;} - float score = 0; - for (k = 0; k <= i; k++) { - if (B.c_str()[Blength - i + k - 1] == A.c_str()[0 + k]) - { - if (A.c_str()[0 + k] != 'N' && (int)Aq.c_str()[0 + k] > 5 && (int)Bq.c_str()[Blength - i + k - 1] > 5) - { - score++; - } - } - if ((k - score) > MM) { - score = -1; - break; - } - } - - if (verbose) {cout << " Score = " << score << endl;} - - float percent = score / (k); - if (percent >= minPercent) - { - if (LocalBestScore < score) - { - LocalBestScore = score; - LocalIndex = j; - LocalOverlap = Blength - i - 1; - if (score == i) - { - break; - } - } - } - } - } - #pragma omp critical(updateCounts) - { - if (bestScore < LocalBestScore) { - bestScore = LocalBestScore; - index = LocalIndex; - overlap = LocalOverlap; - } - } - } - return bestScore; -} - -string ColapsContigs(string A, string B, int k, string Aq, string& Bq, - string& Ad, string& Bd, string& As, string& Bs) { - bool verbose = false; - if (verbose) { - cout << "Combinding; \n" << A << endl << B << endl; - } - - int Asize = A.length(); - int Bsize = B.length(); - - int Aoffset = 0; - int Boffset = 0; - int window; - string newString = ""; - string newQual = ""; - string newDepth = ""; - - if (k > 0) { - Aoffset = k; - } else { - Boffset = abs(k); - } - - if (verbose) { - cout << "K = " << k << " so Aofset = " << Aoffset - << " and Boffset = " << Boffset << endl; - } - - for (int i = 0; i < Asize + Bsize; i++) { - char Abase = 'Z'; - char Bbase = 'Z'; - char Aqual = '!'; - char Bqual = '!'; - unsigned char Adep = 0; - unsigned char Bdep = 0; - - if (((i - Aoffset) >= 0) && ((i - Aoffset) < A.length())) { - Abase = A.c_str()[i - Aoffset]; - Aqual = Aq.c_str()[i - Aoffset]; - Adep = Ad.c_str()[i - Aoffset]; - } else { - Abase = 'Z'; - Aqual = '!'; - Adep = 0; - } - - if (i - Boffset >= 0 && i - Boffset < B.length()) { - Bbase = B.c_str()[i - Boffset]; - Bqual = Bq.c_str()[i - Boffset]; - Bdep = Bd.c_str()[i - Boffset]; - } else { - Bbase = 'Z'; - Bqual = '!'; - Bdep = 0; - } - - if (verbose) { - cout << "I = " << i << " Bi = " << i - Boffset << " Ai = " << i - Aoffset - << " thus " << Abase << "-" << Bbase << endl; - } - - if (Abase == Bbase && Abase != 'Z') { - newString += Abase; - - if (Aqual >= Bqual) { - newQual += Aqual; - } else { - newQual += Bqual; - } - - if ((int)Adep + (int)Bdep < 250) { - newDepth += (Adep + Bdep); - } else { - newDepth += 250; - } - - } else if (Abase == 'Z' && Bbase != 'Z') { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } else if (Abase != 'Z' && Bbase == 'Z') { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else if (Abase != 'Z' && Bbase != 'Z') { - - if (Abase == 'N' && Bbase != 'N') { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } else if (Abase != 'N' && Bbase == 'N') { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else if (Aqual >= Bqual) { - newString += Abase; - newQual += Aqual; - newDepth += Adep; - } else { - newString += Bbase; - newQual += Bqual; - newDepth += Bdep; - } - - } else if (Abase == 'Z' && Bbase == 'Z') { - Bq = newQual; - Bd = newDepth; - break; - } - } - Bq = newQual; - Bd = newDepth; - Bs += As; - return newString; -} - -string TrimNends(string S, string& qual) { - bool base = false; - string NewS = ""; - string NewQ = ""; - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } else if (S.c_str()[i] != 'A' && S.c_str()[i] != 'C' && - S.c_str()[i] != 'G' && S.c_str()[i] != 'T') { - } else { - base = true; - NewS = S.c_str()[i] + NewS; - NewQ = qual.c_str()[i] + NewQ; - } - } - qual = NewQ; - return NewS; -} - -string TrimLowCoverageEnds(string S, string& quals, string& depth, int cutoff) { - bool base = false; - string NewS = ""; - string NewD = ""; - string NewQ = ""; - - for (int i = S.size() - 1; i >= 0; i--) { - if (base) { - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = S.c_str()[i] + NewS; - NewD = depth.c_str()[i] + NewD; - NewQ = quals.c_str()[i] + NewQ; - } - } - - if (NewS.size() > 1) { - S = NewS; - depth = NewD; - quals = NewQ; - base = false; - NewS = ""; - NewD = ""; - NewQ = ""; - - for (int i = 0; i < S.size(); i++) { - if (base) { - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } else if ((int)depth.c_str()[i] > cutoff) { - base = true; - NewS = NewS + S.c_str()[i]; - NewD = NewD + depth.c_str()[i]; - NewQ = NewQ + quals.c_str()[i]; - } - } - } - depth = NewD; - quals = NewQ; - return NewS; -} - -string AdjustBases(string sequence, string qual) { - int MinQ = 10; - int QualOffset = 32; - string NewString = ""; - for (int i = 0; i < sequence.length(); i++) { - if (qual.c_str()[i] - QualOffset < MinQ) { - NewString += 'N'; - } else { - NewString += sequence.c_str()[i]; - } - } - - if (NewString != sequence) { - return NewString; - } -} - -bool replace(std::string& str, const std::string& from, const std::string& to) { - size_t start_pos = str.find(from); - if (start_pos == std::string::npos) { - return false; - } - str.replace(start_pos, from.length(), to); - return true; -} - -bool validateFASTQD(string& L1, string& L2, string& L3, string& L4, string& L5, - string& L6) { - if (L1.c_str()[0] != '@') { - cout << "error header problems - " << L1 << endl; - return false; - } - if (L2.size() != L4.size()) { - cout << "error sequence and qual problems - \n" << L2 << endl - << L4 << endl; - return false; - } - vector temp = Util::Split(L6, ' '); - if (temp.size() != L2.size()) { - cout << "error counts problems - " << L2.size() << " != " << temp.size() - << endl; - return false; - } - return true; -} - -bool IsBitSet(int num, int bit) { return 1 == ((num >> bit) & 1); } - -int GetReadOrientation(int flag) { - bool is_set = IsBitSet(flag, 4); - cout << "flag is " << flag << endl; - cout << "orientation is " << is_set << endl; - return is_set; -} - -string FlipStrands(string strand) { - string NewStrand = ""; - for (int i = 0; i < strand.size(); i++) { - if (strand.c_str()[i] == '+') - NewStrand += "-"; - else if (strand.c_str()[i] == '-') - NewStrand += "+"; - } - return NewStrand; -} - -void compresStrand(string S, int& F, int& R) { - for (int i = 0; i < S.size(); i++) { - if (S.c_str()[i] == '+') - F++; - else - R++; - } - return; -} -int main(int argc, char* argv[]) { - float MinPercent; - int MinOverlap; - int MinCoverage; - cout << "you gave " << argc << " Arguments" << endl; - if (argc != 9) { - cout << "ERROR, wrong numbe of arguemnts\nCall is: SAM, MinPercent, " - "MinOverlap, MinCoverage, ReportStub, NodeStub LCcutoff Threads" - << endl - << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] - << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] - << "\n FileStub = " << argv[5] << "\n NodeStub = " << argv[6] - << endl; - return 0; - } - - cout << " You Gave\n File = " << argv[1] - << "\n MinPercent = " << argv[2] << "\n MinOVerlap = " << argv[3] - << "\n MinCoverage = " << argv[4] << "\n FileStub = " << argv[5] - << "\n NodeStub = " << argv[6] << "\n LCcutoff = " << argv[7] - << "\n Threads = " << argv[8] << endl; - - ifstream fastq; - fastq.open(argv[1]); - if (fastq.is_open()) { - cout << "Parent File open - " << argv[1] << endl; - } else { - cout << "Error, ParentHashFile could not be opened"; - return 0; - } - - string temp = argv[2]; - MinPercent = atof(temp.c_str()); - temp = argv[3]; - MinOverlap = atoi(temp.c_str()); - temp = argv[4]; - MinCoverage = atoi(temp.c_str()); - temp = argv[7]; - int LCcutoff = atoi(temp.c_str()); - temp = argv[8]; - int Threads = atoi(temp.c_str()); - ofstream report; - string FirstPassFile = argv[1]; - std::stringstream ss; - ss << argv[5] << ".fastq"; - FirstPassFile = ss.str(); - report.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile - << endl; - return 0; - } - - ofstream Depreport; - FirstPassFile += "d"; - Depreport.open(FirstPassFile.c_str()); - - if (report.is_open()) { - } else { - cout << "ERROR, Mut-Output file could not be opened - " << FirstPassFile - << endl; - return 0; - } - - string line; - std::vector sequenes; - std::vector qual; - std::vector depth; - std::vector strand; - std::vector Unsequenes; - std::vector Unqual; - std::vector Undepth; - std::vector Unstrand; - int lines = -1; - string L1; - string L2; - string L3; - string L4; - string L5; - string L6; - unsigned long LongHash; - int Rejects = 0; - string Fastqd = argv[1]; - cout << "Reading in SAM \n"; - int counter = 0; - - while (getline(fastq, L1)) { - counter++; - - if (counter % 100 == 1) { - cout << "Read in " << counter << " lines and rejected " << Rejects - << " reads\r"; - } - - vector temp = Util::Split(L1, '\t'); - int ReadSize = temp[10].size(); - bool b[16]; - int v = atoi(temp[1].c_str()); - - //TODO: understand this syntax - for (int j = 0; j < 16; ++j) - { - b[j] = 0 != (v & (1 << j)); - } - if (DupCheck.count(temp[9]) > 0) - { - cout << "skipping exact match sequence " << L1 << endl; - } - else - { - DupCheck[temp[9]] == true; - if (b[8] or b[11] or b[10] or temp[10].length() < 100) - { - Rejects++; - } - else if (b[2] and atoi(temp[4].c_str())>5) - { - string L4 = temp[10]; - string L2 = temp[9]; - L2 = TrimNends(L2, L4); - - if ((double)L2.size() / (double)ReadSize > .6) - { - ReadSize = L2.size(); - lines++; - Unsequenes.push_back(L2); - Unqual.push_back(L4); - - if (b[4] == 0) - { - Unstrand.push_back("+"); - } - else if (b[4] == 1) - { - Unstrand.push_back("-"); - } - - string depths = ""; - unsigned char C = 1; - - for (int i = 0; i < L2.length(); i++) - { - depths += C; - } - - Undepth.push_back(depths); - - } - else - { - Rejects++; - } - - } - else - { - string L4 = temp[10]; - string L2 = temp[9]; - L2 = TrimNends(L2, L4); - - if ((double)L2.size() / (double)ReadSize > .6) - { - ReadSize = L2.size(); - lines++; - sequenes.push_back(L2); - qual.push_back(L4); - string depths = ""; - - if (b[4] == 0) - { - strand.push_back("+"); - } - else if (b[4] == 1) - { - strand.push_back("-"); - } - - unsigned char C = 1; - - for (int i = 0; i < L2.length(); i++) - { - depths += C; - } - - depth.push_back(depths); - - } - else - { - Rejects++; - } - } - } - } - - cout << endl; - int NumReads = sequenes.size(); - cout << "\nDone reading in \n Read in a total of " << NumReads + Rejects - << " and rejected " << Rejects << endl; - clock_t St, Et; - float Dt; - - struct timeval start, end; - gettimeofday(&start, NULL); - int FoundMatch = 0; - St = clock(); - - for (std::vector::size_type i = 0; i < sequenes.size(); i++) - { - string A = sequenes[i]; - string Aqual = qual[i]; - string Adep = depth[i]; - string Astr = strand[i]; - - if (FullOut) { - cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<**************************************************************>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << endl; - } - - Et = clock(); - - if ((int)i % 10 < 1){ - gettimeofday(&end, NULL); - float Dt = end.tv_sec - start.tv_sec; - cout << "aligning " << i << " of " << NumReads << ", \% done = " << ((double)i / (double)NumReads) * 100.00<< ", TotalTime= " << Dt << " , second per read = " << Dt / i<< ", \% finding match = "<< ((double)FoundMatch / (double)i) * 100.00 << "\r"; - } - - if (FullOut) { - Dt = ((double)(Et - St)) / CLOCKS_PER_SEC; - cout << "aligning " << i << " of " << NumReads - << "\% done = " << ((double)i / (double)NumReads) * 100.00 - << ", TotalTime= " << Dt << " , second per read = " << Dt / i - << ", \% finding match = " - << ((double)FoundMatch / (double)i) * 100.00 << endl - << A << endl; - - for (int z = 0; z < Adep.length(); z++) { - int bam = Adep.c_str()[z]; - cout << bam; - } - cout << endl; - } - - int k = -1; - int bestIndex = -1; - bool PerfectMatch = false; - int booya = Align3(sequenes, qual, A, Aqual, i, k, bestIndex, MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) { - cout << "best forward score is " << booya << " k is " << k << endl; - } - - if (!(PerfectMatch)) { - string revA = Util::RevComp(A); - string revAqual = Util::RevQual(Aqual); - string revAdep = Util::RevQual(Adep); - string revAstr = FlipStrands(Astr); - int revk = -1; - int revbestIndex = -1; - int revbooya = - Align3(sequenes, qual, revA, revAqual, i, revk, revbestIndex, - - MinPercent, PerfectMatch, MinOverlap, Threads); - if (FullOut) { - cout << "best reverse score is " << revbooya << " k is " << revk - << endl; - } - - if (revbooya > booya) { - A = revA; - Aqual = revAqual; - Adep = revAdep; - Astr = revAstr; - k = revk; - booya = revbooya; - bestIndex = revbestIndex; - } - - } else { - if (FullOut) { - cout << "Perfect Match Found, Skipping Referse Search" << endl; - } - } - - if (booya < MinOverlap) { - if (FullOut) { - cout << "No good match found, skipping" << endl; - } - } else { - FoundMatch++; - string B = sequenes[bestIndex]; - string Bqual = qual[bestIndex]; - string Bdep = depth[bestIndex]; - string Bstr = strand[bestIndex]; - - if (k > 0) { - - if (FullOut) { - cout << "found match at " << k << endl; - - for (int z = 0; z < k; z++) { - cout << "+"; - } - - cout << A << endl << B << endl; - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - - cout << endl; - } - } else { - if (FullOut) { - cout << "found match at " << k << endl; - cout << A << endl; - - for (int z = 0; z < abs(k); z++) { - cout << "-"; - } - - cout << B << endl; - - for (int z = 0; z < abs(k); z++) { - cout << "-"; - } - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - - cout << endl; - } - } - - if (i == bestIndex) { - cout << "ERROR ____________________ SAME READS " << endl; - } - if (A.size() != Adep.size() && B.size() != Bdep.size()) { - cout << " ERRPR somethis the wrong size\n A= " << A.size() - << " Ad = " << Adep.size() << " B= " << B.size() - << " Bd = " << Bdep.size() << endl; - } - - string combined = - ColapsContigs(A, B, k, Aqual, Bqual, Adep, Bdep, Astr, Bstr); - - if (combined.size() != Bdep.size()) { - cout << " ERRPR combined is the wrong size\n C= " << combined.size() - << " Bd = " << Bdep.size() << endl; - } - - sequenes[bestIndex] = combined; - qual[bestIndex] = Bqual; - depth[bestIndex] = Bdep; - strand[bestIndex] = Bstr; - sequenes[i] = "moved"; - - if (FullOut) { - cout << combined << endl; - - for (int z = 0; z < Bdep.length(); z++) { - int bam = Bdep.c_str()[z]; - cout << bam; - } - } - } - } - - cout << "\n\nRESULTS\n"; - int count = 0; - for (int i = 0; i < sequenes.size(); i++) { - - if (FullOut) { - cout << ">>>>" << sequenes[i] << endl; - } - - if (sequenes[i] != "moved" && sequenes[i].size() >= 95) { - string rDep = depth[i]; - int maxDep = -1; - - for (int z = 0; z < rDep.size(); z++) { - unsigned char bam = rDep.c_str()[z]; - if ((int)bam > maxDep) { - maxDep = (int)bam; - } - } - - if (maxDep >= MinCoverage) { - - if (sequenes[i].size() != qual[i].size() && qual[i].size() != depth[i].size()) { - cout << "ERROR, read " - << "@NODE_" << argv[6] << "_" << i << "_L=" << sequenes[i].size() - << "_D=" << maxDep - << " Has the wrong size, Seq = " << sequenes[i].size() - << " Qual = " << qual[i].size() << " Dep = " << depth[i].size() - << endl; - } - - count++; - int F = 0; - int R = 0; - compresStrand(strand[i], F, R); - report << "@NODE_" << argv[6] << "_" << i << "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; - report << sequenes[i] << endl; - report << "+" << endl; - report << qual[i] << endl; - - Depreport << "@NODE_" << argv[6] << "_" << i<< "_L=" << sequenes[i].size() << "_D=" << maxDep << ":" << F << ":" << R << ":" << endl; - Depreport << sequenes[i] << endl; - Depreport << "+" << endl; - Depreport << qual[i] << endl; - Depreport << strand[i] << endl; - unsigned char C = depth[i].c_str()[0]; - int booya = C; - Depreport << booya; - - for (int w = 1; w < depth[i].size(); w++) { - C = depth[i].c_str()[w]; - booya = C; - Depreport << " " << booya; - } - - Depreport << endl; - } - } - } - - for (int i = 0; i < Unsequenes.size(); i++) { - - if (FullOut) { - cout << ">>>>" << Unsequenes[i] << endl; - } - - if (Unsequenes[i] != "moved" && Unsequenes[i].size() >= 95) { - int maxDep = -1; - - if (Unsequenes[i].size() != Unqual[i].size() && - Unqual[i].size() != Undepth[i].size()) { - cout << "ERROR, read " - << "@NODE_" << argv[6] << "_" << i << "_L=" << Unsequenes[i].size() - << "_D=" << maxDep - << " Has the wrong size, Seq = " << Unsequenes[i].size() - << " Qual = " << Unqual[i].size() << " Dep = " << Undepth[i].size() - << endl; - } - - count++; - report << "@NODE_" << argv[6] << "_" << i << "_L=" << Unsequenes[i].size() - << "_D" << maxDep << endl; - report << Unsequenes[i] << endl; - report << "+" << endl; - report << Unqual[i] << endl; - - Depreport << "@NODE_" << argv[6] << "_" << i - << "_L=" << Unsequenes[i].size() << "_D" << maxDep << endl; - Depreport << Unsequenes[i] << endl; - Depreport << "+" << endl; - Depreport << Unqual[i] << endl; - Depreport << Unstrand[i] << endl; - unsigned char C = Undepth[i].c_str()[0]; - int booya = C; - Depreport << booya; - - for (int w = 1; w < Undepth[i].size(); w++) { - C = Undepth[i].c_str()[w]; - booya = C; - Depreport << " " << booya; - } - - Depreport << endl; - } - } - cout << "\nWrote " << count << " sequences" << endl; - report.close(); -} diff --git a/src/PassThroughSamCheck.cpp b/src/PassThroughSamCheck.cpp index 88ab3917..e5feb1bb 100644 --- a/src/PassThroughSamCheck.cpp +++ b/src/PassThroughSamCheck.cpp @@ -2,6 +2,11 @@ * * it needs to be run in two sptes, first the build, then the filter * * it is split up to allow distribution to a cluster */ +/* I think this takes in a sam file, pulls out the necessary fields, and pipes it out. It doesn't seem to be +"checking" anything in particular. I'm guessing this exists to ensure that the hand-written perl script to +create a sam from a fastq file worked correctly, and also to accomodate some sort of parallelism associated +with chromosomes, but haven't seen any in code yet. */ + #include #include @@ -15,144 +20,142 @@ #include #include - using namespace std; - +using namespace std; -const vector Split(const string& line, const char delim) { +const vector Split(const string &line, const char delim) +{ vector tokens; stringstream lineStream(line); string token; - while ( getline(lineStream, token, delim) ) + while (getline(lineStream, token, delim)) tokens.push_back(token); return tokens; } -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { - ifstream SamIn; - SamIn.open ("/dev/stdin"); + ifstream SamIn; + SamIn.open("/dev/stdin"); ofstream ChrOut; - ChrOut.open (argv[1]); + ChrOut.open(argv[1]); if (ChrOut.is_open()) - {} + { + } else - { - cout << "ERROR, Output file could not be opened -" << argv[1] << endl; - return 0; - } + { + cout << "ERROR, Output file could not be opened -" << argv[1] << endl; + return 0; + } - string L1; string current = "notachr"; - //string chr = ""; - + // string chr = ""; while (getline(SamIn, L1)) + { + // string name = ""; + int i = 0; + + const char *L1_array = L1.c_str(); + int start = i; + const char *tmpName = L1_array + i; + while (L1_array[i] != '\t') { - //string name = ""; - int i = 0; - - const char* L1_array = L1.c_str(); - int start =i; - const char* tmpName = L1_array + i ; - while (L1_array[i] != '\t') - { - //name+=L1_array[i]; - ++i; - } - int lenName = i-start; + // name+=L1_array[i]; ++i; - //string flag = ""; - while (L1_array[i] != '\t') - { - ++i; - } + } + int lenName = i - start; + ++i; + // string flag = ""; + while (L1_array[i] != '\t') + { ++i; - //string chr = ""; - start = i; - const char* tmpChr = L1_array + i ; - while (L1_array[i] != '\t') - { - //chr+=L1_array[i]; - ++i; - } - int lenChr = i-start; + } + ++i; + // string chr = ""; + start = i; + const char *tmpChr = L1_array + i; + while (L1_array[i] != '\t') + { + // chr+=L1_array[i]; ++i; - //string pos = ""; - while (L1_array[i] != '\t') - { - ++i; - } + } + int lenChr = i - start; + ++i; + // string pos = ""; + while (L1_array[i] != '\t') + { + ++i; + } + ++i; + // string something = ""; + while (L1_array[i] != '\t') + { ++i; - //string something = ""; - while (L1_array[i] != '\t') - { - ++i; - } + } + ++i; + // string cigar = ""; + while (L1_array[i] != '\t') + { ++i; - //string cigar = ""; - while (L1_array[i] != '\t') - { - ++i; - } + } + ++i; + // string something2 = ""; + while (L1_array[i] != '\t') + { ++i; - //string something2 = ""; - while (L1_array[i] != '\t') - { - ++i; - } + } + ++i; + // string something3= ""; + while (L1_array[i] != '\t') + { ++i; - //string something3= ""; - while (L1_array[i] != '\t') - { - ++i; - } + } + ++i; + // string something4= ""; + while (L1_array[i] != '\t') + { ++i; - //string something4= ""; - while (L1_array[i] != '\t') - { - ++i; - } + } + ++i; + // string seq = ""; + start = i; + const char *tmpSeq = L1_array + i; + while (L1_array[i] != '\t') + { + // seq += L1_array[i]; ++i; - //string seq = ""; - start = i; - const char* tmpSeq=L1_array + i ; - while (L1_array[i] != '\t') - { - //seq += L1_array[i]; - ++i; - } - int lenSeq = i-start; + } + int lenSeq = i - start; + ++i; + // string qual = ""; + start = i; + const char *tmpQual = L1_array + i; + while (L1_array[i] != '\t') + { + // qual += L1_array[i]; ++i; - //string qual = ""; - start = i; - const char* tmpQual = L1_array + i ; - while (L1_array[i] != '\t') - { - // qual += L1_array[i]; - ++i; - } - int lenQual = i - start; - + } + int lenQual = i - start; + + if (strncmp(tmpChr, current.c_str(), lenChr) != 0 or lenChr != current.size()) + { + ChrOut << current << endl; - - if (strncmp( tmpChr, current.c_str(), lenChr) != 0 or lenChr != current.size() ) - { - ChrOut << current << endl; - - current = string(tmpChr, lenChr); - } - //cout << "@" << name << endl << seq << endl << "+" << endl << qual << endl; - cout.write("@", 1); - cout.write(tmpName, lenName); - cout << endl; - cout.write(tmpSeq, lenSeq); - cout << endl << "+" << endl; - cout.write(tmpQual, lenQual); - cout << endl; + current = string(tmpChr, lenChr); } + // cout << "@" << name << endl << seq << endl << "+" << endl << qual << endl; + cout.write("@", 1); + cout.write(tmpName, lenName); + cout << endl; + cout.write(tmpSeq, lenSeq); + cout << endl + << "+" << endl; + cout.write(tmpQual, lenQual); + cout << endl; + } ChrOut << current << endl; SamIn.close(); - return 0; + return 0; } diff --git a/src/PassThroughSamCheck.stranded.cpp b/src/PassThroughSamCheck.stranded.cpp index ddcc765c..d2051f12 100644 --- a/src/PassThroughSamCheck.stranded.cpp +++ b/src/PassThroughSamCheck.stranded.cpp @@ -45,10 +45,12 @@ int main (int argc, char *argv[]) return 0; } - ofstream mate1; - string m1n = argv[2]; - m1n = m1n + ".mate1.fastq"; - mate1.open (m1n); + // ofstream mate1; + // string m1n = argv[2]; + // m1n = m1n + ".mate1.fastq"; + // mate1.open (m1n); + ofstream mate1(argv[2]); + mate1.setf(std::ios::unitbuf); // Force flush after every insertion if (mate1.is_open()) {} else @@ -57,10 +59,12 @@ int main (int argc, char *argv[]) return 0; } - ofstream mate2; - string m2n = argv[2]; - m2n = m2n + ".mate2.fastq"; - mate2.open (m2n); + // ofstream mate2; + // string m2n = argv[2]; + // m2n = m2n + ".mate2.fastq"; + // mate2.open (m2n); + ofstream mate2(argv[3]); + mate2.setf(std::ios::unitbuf); if (mate2.is_open()) {} else diff --git a/src/PassThroughSamCheck.stranded.se.cpp b/src/PassThroughSamCheck.stranded.se.cpp deleted file mode 100644 index d6bac3d0..00000000 --- a/src/PassThroughSamCheck.stranded.se.cpp +++ /dev/null @@ -1,206 +0,0 @@ - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - - -const vector Split(const string& line, const char delim) { - vector tokens; - stringstream lineStream(line); - string token; - while ( getline(lineStream, token, delim) ) - tokens.push_back(token); - return tokens; -} - -int main (int argc, char *argv[]) -{ - ifstream SamIn; - SamIn.open ("/dev/stdin"); - - ofstream ChrOut; - ChrOut.open (argv[1]); - if (ChrOut.is_open()) - {} - else - { - cout << "ERROR, Output file could not be opened -" << argv[1] << endl; - return 0; - } - - - string L1; - string current = "notachr"; - //string chr = ""; - - - while (getline(SamIn, L1)) - { - //string name = ""; - int i = 0; - - const char* L1_array = L1.c_str(); - int start =i; - const char* tmpName = L1_array + i ; - //field 1 - while (L1_array[i] != '\t') - { - //name+=L1_array[i]; - ++i; - } - int lenName = i-start; - ++i; - //string flag = ""; - //field 2 - int flagStart = i; - while (L1_array[i] != '\t') - { - ++i; - } - int flagEnd = i; - ++i; - //string chr = ""; - start = i; - const char* tmpChr = L1_array + i ; - //field 3 - while (L1_array[i] != '\t') - { - //chr+=L1_array[i]; - ++i; - } - int lenChr = i-start; - ++i; - //string pos = ""; - //field 4 - while (L1_array[i] != '\t') - { - ++i; - } - ++i; - //string something = ""; - //field 5 - while (L1_array[i] != '\t') - { - ++i; - } - ++i; - //string cigar = ""; - //field 6 - while (L1_array[i] != '\t') - { - ++i; - } - ++i; - //string something2 = ""; - //field 7 - while (L1_array[i] != '\t') - { - ++i; - } - ++i; - //string something3= ""; - //field 8 - while (L1_array[i] != '\t') - { - ++i; - } - ++i; - //string something4= ""; - //field 9 - while (L1_array[i] != '\t') - { - ++i; - } - ++i; - //string seq = ""; - start = i; - int seqStart = i; - const char* tmpSeq=L1_array + i ; - //field 10 - while (L1_array[i] != '\t') - { - //seq += L1_array[i]; - ++i; - } - int seqEnd = i; - int lenSeq = i-start; - ++i; - //string qual = ""; - start = i; - int qualStart = i; - const char* tmpQual = L1_array + i ; - //field 11 - while (L1_array[i] != '\t') - { - // qual += L1_array[i]; - ++i; - } - int qualEnd = i; - int lenQual = i - start; - - - - if (strncmp( tmpChr, current.c_str(), lenChr) != 0 or lenChr != current.size() ) - { - ChrOut << current << endl; - - current = string(tmpChr, lenChr); - } - //cout << "@" << name << endl << seq << endl << "+" << endl << qual << endl; - - string flagstring = ""; - - for (int i = flagStart; i< flagEnd; i++) - { - flagstring+=L1_array[i]; - } - - //int v = atoi(flagstring.c_str()); // flag to dissect - //int strand = 0 != (v & (1 << 4)); - if ( 0 != (atoi(flagstring.c_str()) & (1 << 4))){ - cout.write("@", 1); - cout.write(tmpName, lenName); - cout << endl; - for (int j =seqEnd-1; j>=seqStart; j--){ - switch (L1_array[j]){ - case 'A' : cout << 'T'; break; - case 'C' : cout << 'G'; break; - case 'G' : cout << 'C'; break; - case 'T' : cout << 'A'; break; - case 'N' : cout << 'N'; break; - } - } - cout << endl; - cout << "+" << endl; - for (int j =qualEnd-1; j>=qualStart; j--){ - cout << L1_array[j]; - } - cout << endl; - } - else - { - cout.write("@", 1); - cout.write(tmpName, lenName); - cout << endl; - cout.write(tmpSeq, lenSeq); - cout << endl << "+" << endl; - cout.write(tmpQual, lenQual); - cout << endl; - } - } - ChrOut << current << endl; - SamIn.close(); - return 0; -} diff --git a/src/RUFUS.CheckHashFilter.cpp b/src/RUFUS.CheckHashFilter.cpp deleted file mode 100644 index 357b429c..00000000 --- a/src/RUFUS.CheckHashFilter.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/*By ANDREW FARRELL - * RUFUS.CheckHashFilter.cpp - * TODO: describe funciton of file - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Util.h" - -using namespace std; - -int main(int argc, char *argv[]) { -cout << "Call is PreBuiltMutHash Mutant.fq firstpassfile hashsize MinQ " - "HashCountThreshold window threads " - << endl; - double vm, rss, MAXvm, MAXrss; - MAXvm = 0; - MAXrss = 0; - Util::process_mem_usage(vm, rss, MAXvm, MAXrss); - cout << "VM: " << vm << "; RSS: " << rss << endl; - - int BufferSize = 1000; - - cout << "Paramaters are:\n PreBuiltMutHash = " << argv[1] - << "\n Mutant.fq = " << argv[2] << "\n out stub = " << argv[3] - << "\n HashSize = " << argv[4] << "\n MinQ = " << argv[5] - << "\n HashCountThreshold = " << argv[6] << "\n Window = " << argv[7] - << "\n Threads = " << argv[8] << endl; - // Read in file passed to the program on the command line - - string temp = argv[4]; - int HashSize = atoi(temp.c_str()); - temp = argv[5]; - int MinQ = atoi(temp.c_str()); - temp = argv[6]; - int HashCountThreshold = atoi(temp.c_str()); - temp = argv[7]; - int Window = atoi(temp.c_str()); - temp = argv[8]; - int Threads = atoi(temp.c_str()); - ifstream MutHashFile; - MutHashFile.open(argv[1]); - if (MutHashFile.is_open()) { - cout << "Parent File open - " << argv[1] << endl; - } // cout << "##File Opend\n"; - else { - cout << "Error, ParentHashFile could not be opened"; - return 0; - } - - string filename = argv[2]; - ifstream MutFile; - if (filename == "stdin") { - cout << "MutFile is STDIN" << endl; - MutFile.open("/dev/stdin"); - } else { - cout << "MutFile is " << argv[2] << endl; - MutFile.open(argv[2]); - } - if (MutFile.is_open()) { - cout << "##File Opend\n"; - } else { - cout << "Error, MutFile could not be opened"; - return 0; - } - - ofstream MutOutFile; - string FirstPassFile = argv[3]; - FirstPassFile += ".Mutations.fastq"; - MutOutFile.open(FirstPassFile.c_str()); - - if (MutOutFile.is_open()) { - } else { - cout << "ERROR, Output file could not be opened -" << argv[3] << endl; - return 0; - } - - string line; - unordered_map Mutations; - cout << "Reading in pre-built hash talbe\n"; - int lines = 0; - string L1; - string L2; - string L3; - string L4; - unsigned long LongHash; - bool notdone = true; - cout << "starting " << endl; - cout << " Reading in MutHashFile" << endl; - - while (getline(MutHashFile, L1)) { - vector temp; - temp = Util::Split(L1, '\t'); - cout << temp[0] << " and " << temp[1] << endl; - - if (temp.size() == 2 && temp[0].size() == HashSize) { - unsigned long b = Util::HashToLong(temp[0].c_str()); - int c = atoi(temp[1].c_str()); - Mutations.insert(pair(b, c)); - } - } - - MutHashFile.close(); - cout << "\nDone Hash Files\n"; - cout << " Mutations Hash size is " << (int)Mutations.size() << endl; - int who = RUSAGE_SELF; - struct rusage usage; - int b = getrusage(RUSAGE_SELF, &usage); - cout << "I am using " << usage.ru_maxrss << endl; - cout << "VM: " << vm << "; RSS: " << rss << "; maxVM: " << MAXvm - << "; maxRSS: " << MAXrss << endl; - cout << "Starting Search " << endl; - clock_t St, Et; - St = clock(); - int found = 0; - lines = 0; - - while (getline(MutFile, L1)) { - lines++; - getline(MutFile, L2); - getline(MutFile, L3); - getline(MutFile, L4); - vector Buffer; - Buffer.push_back(L1); - Buffer.push_back(L2); - Buffer.push_back(L3); - Buffer.push_back(L4); - - if (lines % 10000 > 1 && (lines % (10000 + Threads) < Threads)) { - Et = clock(); - float Dt = ((double)(Et - St)) * CLOCKS_PER_SEC; - cout << "Read in " << lines << " lines: Found " << found - << " Reads per sec = " << (float)lines / (float)Dt << " \r"; - } - - int stackCount = 0; - - while (Buffer.size() < Threads * 4 && getline(MutFile, L1)) { - lines++; - getline(MutFile, L2); - getline(MutFile, L3); - getline(MutFile, L4); - Buffer.push_back(L1); - Buffer.push_back(L2); - Buffer.push_back(L3); - Buffer.push_back(L4); - } - -#pragma omp parallel for shared(MutOutFile) num_threads(Threads) - for (int BuffCount = 0; BuffCount < Buffer.size(); BuffCount += 4) { - string B1, B2, B3, B4; - vector positions; -#pragma omp critical(update) - { - B1 = Buffer[BuffCount]; - B2 = Buffer[BuffCount + 1]; - B3 = Buffer[BuffCount + 2]; - B4 = Buffer[BuffCount + 3]; - } - - int rejected = 0; - int MutHashesFound = 0; - cout << "working on " << B1 << "\n" << B2 << endl; - - for (int i = 0; i < B2.length() - HashSize; i++) { - cout << B2.c_str()[i] << "\t"; - string hash = B2.substr(i, HashSize); - cout << hash << "\t"; - string Qhash = B4.substr(i, HashSize); - bool good = true; - - for (int j = 0; j < HashSize; j++) { - int B = hash.c_str()[j]; - - if (B == 78) { - good = false; - cout << "N skipping frin " << i << " to " << i + j << endl; - i = i + j; - break; - } else { - B = Qhash.c_str()[j]; - if (((int)B - 33) < MinQ) { - good = false; - cout << "Low q = " << (int)B - 33 << " skipping frin " << i - << " to " << i + j << endl; - i = i + j; - break; - } - } - } - - if (good) { - unsigned long LongHash = Util::HashToLong(hash); - - if (Mutations.count(LongHash) > 0) { - MutHashesFound++; - positions.push_back(i); - cout << "found " << LongHash << "\t" - << Util::LongToHash(LongHash, 25) << "\t" - << Mutations[LongHash]; - } else if (Mutations.count(Util::HashToLong(Util::RevComp(hash))) > - 0) { - MutHashesFound++; - positions.push_back(i); - cout << "found " << LongHash << "\t" - << Util::LongToHash(Util::HashToLong(Util::RevComp(hash)), 25) - << "\t" << Mutations[Util::HashToLong(Util::RevComp(hash))]; - } - } else { - rejected++; - } - cout << endl; - } - cout << endl; - if (MutHashesFound >= HashCountThreshold and - rejected < (B2.length() / 2)) { - - for (int i = 0; i MaxCounter) { - MaxCounter = counter; - } - } - - if (MaxCounter >= HashCountThreshold) { - cout << " kept - " << MaxCounter << endl; -#pragma omp critical(MutWrite) - { - MutOutFile << B1 << ":MH" << MutHashesFound << endl - << B2 << endl - << B3 << endl - << B4 << endl; - } - found++; - } - } - } - } -cout << "\nDone\n"; - -MutFile.close(); -MutOutFile.close(); - -cout << "\nreally done\n"; -} diff --git a/src/RUFUS.Filter.2.cpp b/src/RUFUS.Filter.2.cpp deleted file mode 100644 index 8b9efd59..00000000 --- a/src/RUFUS.Filter.2.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/*By ANDREW FARRELL - * RUFUS.CheckHashFilter.cpp - * TODO: describe funciton of file - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Util.h" - -using namespace std; -unsigned long HashToLongLocal( const char* hash, int& len) -{ - bitset<64> HashBits; - //#pragma omp parellel for - for(int i=0; i Mutations; - cout << "Reading in pre-built hash talbe\n"; - int lines = 0; - string L1; - string L2; - string L3; - string L4; - unsigned long LongHash; - bool notdone = true; - cout << "starting " << endl; - cout << " Reading in MutHashFile" << endl; - - while (getline(MutHashFile, L1)) { - vector temp; - temp = Util::Split(L1, '\t'); - - if (temp.size() == 2) { - unsigned long b = Util::HashToLong(temp[0]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[0])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - } else if (temp.size() == 4) { - unsigned long b = Util::HashToLong(temp[3]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[3])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - } - if (temp.size() == 1) { - temp = Util::Split(L1, ' '); - unsigned long b = Util::HashToLong(temp[0]); - unsigned long revb = Util::HashToLong(Util::RevComp(temp[0])); - Mutations.insert(pair(b, 0)); - Mutations.insert(pair(revb, 0)); - } - } - - MutHashFile.close(); - cout << "\nDone Hash Files\n"; - cout << " Mutations Hash size is " << (int)Mutations.size() << endl; - int who = RUSAGE_SELF; - struct rusage usage; - int b = getrusage(RUSAGE_SELF, &usage); - cout << "I am using " << usage.ru_maxrss << endl; - - cout << "VM: " << vm << "; RSS: " << rss << "; maxVM: " << MAXvm - << "; maxRSS: " << MAXrss << endl; - cout << "Starting Search " << endl; - clock_t St, Et; - St = clock(); - int found = 0; - lines = 0; - string Buffer[2400]; - - while (getline(MutFile, L1)) { - lines++; - Buffer[0] = L1; - getline(MutFile, Buffer[1]); - getline(MutFile, Buffer[2]); - getline(MutFile, Buffer[3]); - - if (lines % 10000 > 1 && (lines % (10000 + Threads) < Threads)) { - Et = clock(); - float Dt = ((double)(Et - St)) * CLOCKS_PER_SEC; - cout << "Read in " << lines << " lines: Found " << found - << " Reads per sec = " << (float)lines / (float)Dt << " \r"; - } - - int pos = 4; - - while (getline(MutFile, Buffer[pos])) { - pos++; - if (pos == BufferSize) { - break; - } - } -#pragma omp parallel for shared(MutOutFile) num_threads(Threads) - for (int BuffCount = 0; BuffCount < pos; BuffCount += 4) - { - const char* qual=Buffer[BuffCount + 3].c_str(); - const char* seq=Buffer[BuffCount + 1].c_str(); - int MutHashesFound = 0; - int streak = 0; - for (int i = 0; i < Buffer[BuffCount + 1].length() ; i++) { - if (qual[i] < (char) MinQC){ //(((int)Buffer[BuffCount + 3].c_str()[i] - 33) < MinQ){ /// or (int)Buffer[BuffCount + 1].c_str()[i] == 78) { - streak = 0; - } - else - streak++; - if (streak > hm1 ) - { - const char* hash = seq+i-hm1; - //cout << "i = " << i << " streek = " << streak << " hash - " << string(hash, HashSize)<< endl; - if (Mutations.count(HashToLongLocal(hash, HashSize )) > 0) { - MutHashesFound++; - } - } - } - if (MutHashesFound > 0) - { - #pragma omp critical(MutWrite) - { - MutOutFile << Buffer[BuffCount] << ":MH" << MutHashesFound << endl - << Buffer[BuffCount + 1] << endl - << Buffer[BuffCount + 2] << endl - << Buffer[BuffCount + 3] << endl; - found++; - } - } - } - } - MutFile.close(); - MutOutFile.close(); - cout << "\nDone running RUFUS.Filter.cpp\n"; -} diff --git a/src/RUFUS.Filter.cpp b/src/RUFUS.Filter.cpp index 59c2e050..a5be939e 100644 --- a/src/RUFUS.Filter.cpp +++ b/src/RUFUS.Filter.cpp @@ -1,6 +1,6 @@ /*By ANDREW FARRELL * RUFUS.CheckHashFilter.cpp - * TODO: describe funciton of file + * TODO: describe function of file */ #include @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) int BufferSize = 240; - cout << "Paramaters are:\n PreBuiltMutHash = " << argv[1] + cout << "Parameters are:\n PreBuiltMutHash = " << argv[1] << "\n Mutant.mate1.fq = " << argv[2] << "\n Mutant.mate2.fq = " << argv[3] << "\n out stub = " << argv[4] @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) // Read in file passed to the program on the command line string temp = argv[5]; - int HashSize = atoi(temp.c_str()); + int HashSize = atoi(temp.c_str()); // k-mer length temp = argv[6]; int MinQ = atoi(temp.c_str()); temp = argv[7]; @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) MutHashFile.open(argv[1]); if (MutHashFile.is_open()) { cout << "Parent File open - " << argv[1] << endl; - } // cout << "##File Opend\n"; + } else { cout << "Error, ParentHashFile could not be opened"; return 0; @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) cout << "here " << endl; if (MutFileM1.is_open()) { - cout << "##File Opend\n"; + cout << "##File Opened\n"; } else { cout << "Error, MutFile could not be opened"; return 0; @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) MutFileM2.open(argv[3]); if (MutFileM2.is_open()) { - cout << "##File Opend\n"; + cout << "##File Opened\n"; } else { cout << "Error, MutFile could not be opened"; return 0; @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) string line; unordered_map Mutations; - cout << "Reading in pre-built hash talbe\n"; + cout << "Reading in pre-built hash table\n"; int lines = 0; string L1; unsigned long LongHash; @@ -118,6 +118,8 @@ int main(int argc, char *argv[]) cout << "starting " << endl; cout << " Reading in MutHashFile" << endl; + // Iterate through hash list and add to Mutations hash table + // Adds both forward and reverse version of kMer while (getline(MutHashFile, L1)) { vector temp; temp = Util::Split(L1, ' '); @@ -156,11 +158,12 @@ int main(int argc, char *argv[]) St = clock(); int found = 0; lines = 0; - string BufferMate1[2400]; + string BufferMate1[2400]; // TODO: why doesn't this match buffer size? string BufferMate2[2400]; while (getline(MutFileM1, L1)) { + // Put first four lines from each file in array lines++; BufferMate1[0] = L1; getline(MutFileM1, BufferMate1[1]); @@ -174,16 +177,18 @@ int main(int argc, char *argv[]) - + // todo: figure out what's going on here if (lines % 10000 > 1 && (lines % (10000 + Threads) < Threads)) { Et = clock(); float Dt = ((double)(Et - St)) * CLOCKS_PER_SEC; + // todo: there's a race condition somewhere on this output (in o.out) cout << "Read in " << lines * (BufferSize/4) << " lines: Found " << found << " Reads per sec = " << (float)lines / (float)Dt << " \r"; } int pos = 4; + // Put next lines in array until 10% of fastqs processed while (getline(MutFileM1, BufferMate1[pos])) { getline(MutFileM2, BufferMate2[pos]); @@ -193,6 +198,9 @@ int main(int argc, char *argv[]) } } + // I wonder if this could be faster if we keep track of where the kMers came from (lines in fastq) + // And then just pulled them out that way + // Would have to do the N/lowQ checks on the front end when we build the kMer table #pragma omp parallel for shared(MutOutFileM1, MutOutFileM2) num_threads(Threads) for (int BuffCount = 0; BuffCount < pos; BuffCount += 4) { @@ -202,6 +210,7 @@ int main(int argc, char *argv[]) for (int i = start; i < BufferMate1[BuffCount + 1].length()-1 ; i++) { + // If quality is too low, or base is N if (((int)BufferMate1[BuffCount + 3].c_str()[i] - 33) < MinQ || (int)BufferMate1[BuffCount + 1].c_str()[i] == 78) { //cout << "found bad base in read " << BufferMate1[BuffCount + 0] << "at pos " << i << " base " << BufferMate1[BuffCount + 1].c_str()[i] << " qual = " << BufferMate1[BuffCount + 3].c_str()[i] << " = " << (int)BufferMate1[BuffCount + 3].c_str()[i] - 33 << endl; @@ -211,14 +220,17 @@ int main(int argc, char *argv[]) else streak++; + // HashSize is length of kMer (25) if (streak >= HashSize ) { - if (Mutations.count(Util::HashToLong( BufferMate1[BuffCount + 1].substr(i-HashSize+1, HashSize))) > 0) + if (Mutations.count(Util::HashToLong(BufferMate1[BuffCount + 1].substr(i-HashSize+1, HashSize))) > 0) { MutHashesFound++; } } } + // HashCountThreshold default is 1 + // So if a read matches a single kMer (where the matching section doesn't have Ns or bad quality bases) if (MutHashesFound >= HashCountThreshold ) { #pragma omp critical(MutWrite) @@ -242,6 +254,7 @@ int main(int argc, char *argv[]) for (int i = startM2; i < BufferMate2[BuffCount + 1].length()-1 ; i++) { + // If quality is too low, or base is N if (((int)BufferMate2[BuffCount + 3].c_str()[i] - 33) < MinQ || (int)BufferMate2[BuffCount + 1].c_str()[i] == 78) { //cout << "found bad base in read2 " << BufferMate2[BuffCount + 0] << "at pos " << i << " base " << BufferMate2[BuffCount + 1].c_str()[i] << " qual = " << BufferMate2[BuffCount + 3].c_str()[i] << " = " << (int)BufferMate2[BuffCount + 3].c_str()[i] - 33 << endl; diff --git a/src/RUFUS.Filter.ss.cpp b/src/RUFUS.Filter.single.cpp similarity index 100% rename from src/RUFUS.Filter.ss.cpp rename to src/RUFUS.Filter.single.cpp diff --git a/src/RUFUS.interpret.cpp b/src/RUFUS.interpret.cpp index 4a06cac6..7568d671 100644 --- a/src/RUFUS.interpret.cpp +++ b/src/RUFUS.interpret.cpp @@ -1,7 +1,7 @@ -/*This vertion imcorporates both copy number and mutation detection in 1 - * * it needs to be run in two sptes, first the build, then the filter - * * it is split up to allow distribution to a cluster */ +/** This version incorporates both copy number and mutation detection in 1 + ** it needs to be run in two steps, first the build, then the filter. + ** It is split up to allow distribution to a cluster */ #include #include @@ -34,1173 +34,1081 @@ using namespace std; -bool IsExome = false; +// Globals +bool IsExome = false; vector > DistGlobal; -vector > DistLimitsGlobal; -int Dist1XCutoff = -1; -vector GenPrior; -vector ParNames; -vector > ParentHashes; -unordered_map MutantHashes; -unordered_map ExcludeHashes; +vector > DistLimitsGlobal; +int Dist1XCutoff = -1; +vector GenPrior; // todo: what is this - priors used to determine CN which influences genotyping + AO counts +vector ParNames; +vector > ParentHashes; +unordered_map MutantHashes; // todo: this is a data structure of kmers that were either in the contigs from the sample, or in the reference fasta and their respective counts; translated into a long; long_kmer: count +unordered_map ExcludeHashes; FastaReference Reff; -int ScGlobal = -1; -int CurrentSVeventID = 0; -int MaxBND = 0; -int HashSize = 25; -int totalDeleted; +int ScGlobal = -1; +int CurrentSVeventID = 0; +int MaxBND = 0; +int HashSize = 25; +int totalDeleted; int totalAdded; -int MaxVarentSize = 1000; -int ParLowCovThreshold = 7; +int MaxVarentSize = 1000; +int ParLowCovThreshold = 7; int SegThreshold = 10; -int SegThresholdCigar = 10; +int SegThresholdCigar = 10; ofstream VCFOutFile; ofstream BEDOutFile; ofstream BEDBigStuff; ofstream BEDNotHandled; -ofstream Invertions; -ofstream Translocations; -ofstream Translocationsbed; -ofstream Unaligned; -map Hash; +ofstream Invertions; +ofstream Translocations; +ofstream Translocationsbed; +ofstream Unaligned; +map Hash; // note: this is hash data structure of e.g. COLO829T_Ill_200X.bam.generator.k25_c5.HashList (hash seq: count) ///////////////////////// -const vector Split(const string& line, const char delim) { - vector tokens; + +const vector Split(const string &line, const char delim) { + vector tokens; stringstream lineStream(line); string token; - while ( getline(lineStream, token, delim) ) - tokens.push_back(token); + while (getline(lineStream, token, delim)) + tokens.push_back(token); return tokens; } -double entropyMulti(string s, int size) -{ - unordered_map events; - int step =size; - int count = 0; - for (int i = 0; i < s.size()+1 - size ; i+=step) - { - count++; - if (events.count(s.substr(i, size)) > 0) - {events[s.substr(i, size)]++;} - else - {events[s.substr(i, size)]=1;}//cout << "added " << s.substr(i, size) << endl; } - } - //cout << "I saw " << count << "events" << endl; - double log = -1 * log2(double(events[s.substr(0, size)]) / double (count)); - //cout << s.c_str()[0] << "," << log; - for (int i = 0+step; i < s.size()+1-size; i+=step) - { - // cout << " - " << s.substr(i, size) << "," << -1*log2(double(events[s.substr(i, size)]) / double (count)); - log = log + (-1*log2(double(events[s.substr(i, size)]) / double (count))); - } - //cout << " - "; - //cout << s << " - " << log << endl; - return log/double(count) ; -} -unsigned long HashToLong (string hash) -{ - bitset<64> HashBits; - for(int i=0; i events; + int step = size; + int count = 0; + for (int i = 0; i < s.size() + 1 - size; i += step) { + count++; + if (events.count(s.substr(i, size)) > 0) { events[s.substr(i, size)]++; } + else { events[s.substr(i, size)] = 1; }//cout << "added " << s.substr(i, size) << endl; } + } + + //cout << "I saw " << count << "events" << endl; + double log = -1 * log2(double(events[s.substr(0, size)]) / double(count)); + //cout << s.c_str()[0] << "," << log; + for (int i = 0 + step; i < s.size() + 1 - size; i += step) { + // cout << " - " << s.substr(i, size) << "," << -1*log2(double(events[s.substr(i, size)]) / double (count)); + log = log + (-1 * log2(double(events[s.substr(i, size)]) / double(count))); + } + //cout << " - "; + //cout << s << " - " << log << endl; + return log / double(count); } -int checkPage( char *data, string hash, long int pageSize, string line) -{ - //cout << "checking page" << "with size = " << pageSize<< endl; - bool firstNew = false; - for (int i = 0; i < pageSize; i++) - { - // cout << i << endl; - // cout << data[i] << endl; - if (data[i] == '\n') - { - // cout << "n found"; - if (firstNew != true) - firstNew = true; - else - { - vector stuff; - stuff = Split(line, '\t'); - string PageHash = stuff[0]; - // cout << "PageHash " << endl; - if (hash == PageHash) - { - // cout << "found a hash " << hash << " - " << PageHash; - return atoi(stuff[1].c_str()); - } - line = ""; - } - } - else if (firstNew == true) - { - // cout << "first Newline found" << endl; - line += data[i]; - } +unsigned long HashToLong(string hash) { + bitset<64> HashBits; + for (int i = 0; i < hash.length(); i++) { + if (hash.c_str()[i] == 'A') { + HashBits[i * 2] = 0; + HashBits[i * 2 + 1] = 0; + } else if (hash.c_str()[i] == 'C') { + HashBits[i * 2] = 0; + HashBits[i * 2 + 1] = 1; + } else if (hash.c_str()[i] == 'G') { + HashBits[i * 2] = 1; + HashBits[i * 2 + 1] = 0; + } else if (hash.c_str()[i] == 'T') { + HashBits[i * 2] = 1; + HashBits[i * 2 + 1] = 1; + } else { + //cout << "ERROR, invalid character - " << hash.c_str()[i] << endl; + } - } - return 0; + } + return HashBits.to_ulong(); } -void ProcessPage( char *data, string& PageFirstHash, string& PageLastHash, long int pageSize) -{ - string line = ""; - bool firstNew = false;\ - for (int i = 0; i < pageSize; i++) - { - if (data[i] == '\n') - { - - if (firstNew == true) - break; - else - firstNew = true; - } - else if (firstNew == true) - line += data[i]; - } - - vector stuff; - stuff = Split(line, '\t'); - PageFirstHash = stuff[0]; - firstNew = false; - line = ""; - for (int i = pageSize-1; i > 0; i+=-1) - { - if ( data[i] == '\n') - { - if (firstNew == true) - break; - else - firstNew = true; - } - else if(firstNew == true) - line = data[i] + line; - } - stuff = Split(line, '\t'); - PageLastHash = stuff[0]; +int checkPage(char *data, string hash, long int pageSize, string line) { + //cout << "checking page" << "with size = " << pageSize<< endl; + bool firstNew = false; + for (int i = 0; i < pageSize; i++) { + // cout << i << endl; + // cout << data[i] << endl; + if (data[i] == '\n') { + // cout << "n found"; + if (firstNew != true) + firstNew = true; + else { + vector stuff; + stuff = Split(line, '\t'); + string PageHash = stuff[0]; + // cout << "PageHash " << endl; + if (hash == PageHash) { + // cout << "found a hash " << hash << " - " << PageHash; + return atoi(stuff[1].c_str()); + } + line = ""; + } + } else if (firstNew == true) { + // cout << "first Newline found" << endl; + line += data[i]; + } + } + return 0; } +void ProcessPage(char *data, string &PageFirstHash, string &PageLastHash, long int pageSize) { + string line = ""; + bool firstNew = false;\ + for (int i = 0; i < pageSize; i++) { + if (data[i] == '\n') { + + if (firstNew == true) + break; + else + firstNew = true; + } else if (firstNew == true) + line += data[i]; + } + + vector stuff; + stuff = Split(line, '\t'); + PageFirstHash = stuff[0]; + firstNew = false; + line = ""; + for (int i = pageSize - 1; i > 0; i += -1) { + if (data[i] == '\n') { + if (firstNew == true) + break; + else + firstNew = true; + } else if (firstNew == true) + line = data[i] + line; + } + stuff = Split(line, '\t'); + PageLastHash = stuff[0]; +} -int search(long int& fd, string hash, char* fileptr) -{ - //cout << "searching for " << hash << endl; - char *data; - struct stat sb; - fstat(fd, &sb); - - long int pageSize; - pageSize = sysconf(_SC_PAGE_SIZE); - long int NumPages = sb.st_size/pageSize; - //cout << "Number of pages = " << NumPages << endl; - // char *fileptr = NULL; - - long int off = 0; - long int firstPos; - long int lastPos; - firstPos = 0; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos*pageSize); - data = fileptr; - // above should get me first page - string FirstPageFirstHash; - string FirstPageLastHash; - ProcessPage(data, FirstPageFirstHash, FirstPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - //cout << FirstPageFirstHash << endl << FirstPageLastHash << endl; - //quck check to see if on first page - if (hash >= FirstPageFirstHash and hash <= FirstPageLastHash) - { - // cout << "found on first page" << endl; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos*pageSize); - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - if (hash < FirstPageFirstHash) - { - cout << "HASH NOT IN FILE " << hash << endl; - return 0; - } - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*(NumPages-1)); - data = fileptr; - lastPos = NumPages-1; - //the above should get me the last two pages, we take two to ensure the last pages isnt just one character or something like that - - string LastPageFirstHash; - string LastPageLastHash; - ProcessPage(data, LastPageFirstHash, LastPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - //cout << LastPageFirstHash << endl << LastPageLastHash << endl; - //quck check to see if on last page - if (hash >= LastPageFirstHash and hash <= LastPageLastHash) - { - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*(NumPages-1)); - // cout << "found on last page" << endl; - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - if (hash > LastPageLastHash) - { - cout << "HASH NOT IN FILE " << hash << endl; - return 0; - } - //start the search - int counter = 0; - while (true) - { - // cout << "ON LOOP " << counter << endl << endl; - counter++; - long int currentPage = lastPos - ((lastPos-firstPos)/2); - // cout << "checking page " << currentPage << " last = " << lastPos << " and first = " << firstPos << endl;; - if (currentPage == lastPos or currentPage == firstPos or lastPos - firstPos < 3) - { - string extra = ""; - // cout << "\nenvoked this" << endl; - fileptr = (char*)mmap64(NULL, pageSize*5, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize * (firstPos-1)); - data = fileptr; - // cout << "made it here" << endl; - int val = checkPage(data, hash, pageSize*5, extra); - if (munmap(fileptr, pageSize*5) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - //cout << " fileptr = (char*)mmap64(NULL, " << pageSize*2 <<", PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, " << pageSize<<" * " << currentPage <<");"<< endl; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*currentPage); - data = fileptr; - string CurrentPageFirstHash; - string CurrentPageLastHash; - ProcessPage(data, CurrentPageFirstHash, CurrentPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - // cout << " with " << CurrentPageFirstHash << " and " << CurrentPageLastHash << endl; - if (hash >= CurrentPageFirstHash and hash <= CurrentPageLastHash) - { - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*currentPage); - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - else - { - if (hash < CurrentPageFirstHash) - { - // cout << "hash " << hash << " is greater than " << CurrentPageFirstHash << " looking above" << endl; - lastPos = currentPage; - LastPageFirstHash = CurrentPageFirstHash; - LastPageLastHash = CurrentPageLastHash; - } - else if (hash > CurrentPageLastHash) - { - // cout << "hash \n" << hash << " is less than \n" << CurrentPageLastHash << " looking below" << endl; - firstPos = currentPage; - FirstPageFirstHash = CurrentPageFirstHash; - FirstPageLastHash = CurrentPageLastHash; - } - } - } - close(fd); +int search(long int &fd, string hash, char *fileptr) { + //cout << "searching for " << hash << endl; + char *data; + struct stat sb; + fstat(fd, &sb); + + long int pageSize; + pageSize = sysconf(_SC_PAGE_SIZE); + long int NumPages = sb.st_size / pageSize; + //cout << "Number of pages = " << NumPages << endl; + // char *fileptr = NULL; + + long int off = 0; + long int firstPos; + long int lastPos; + firstPos = 0; + fileptr = (char *) mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos * pageSize); + data = fileptr; + // above should get me first page + string FirstPageFirstHash; + string FirstPageLastHash; + ProcessPage(data, FirstPageFirstHash, FirstPageLastHash, pageSize); + if (munmap(fileptr, pageSize) == -1) { + perror("Error un-mmapping the file"); + } + //cout << FirstPageFirstHash << endl << FirstPageLastHash << endl; + //quck check to see if on first page + if (hash >= FirstPageFirstHash and hash <= FirstPageLastHash) { + // cout << "found on first page" << endl; + fileptr = (char *) mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos * pageSize); + int val = checkPage(data, hash, pageSize, ""); + if (munmap(fileptr, pageSize) == -1) { + perror("Error un-mmapping the file"); + } + return val; + } + if (hash < FirstPageFirstHash) { + cout << "HASH NOT IN FILE " << hash << endl; + return 0; + } + fileptr = (char *) mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize * (NumPages - 1)); + data = fileptr; + lastPos = NumPages - 1; + //the above should get me the last two pages, we take two to ensure the last pages isnt just one character or something like that + + string LastPageFirstHash; + string LastPageLastHash; + ProcessPage(data, LastPageFirstHash, LastPageLastHash, pageSize); + if (munmap(fileptr, pageSize) == -1) { + perror("Error un-mmapping the file"); + } + //cout << LastPageFirstHash << endl << LastPageLastHash << endl; + //quck check to see if on last page + if (hash >= LastPageFirstHash and hash <= LastPageLastHash) { + fileptr = (char *) mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize * (NumPages - 1)); + // cout << "found on last page" << endl; + int val = checkPage(data, hash, pageSize, ""); + if (munmap(fileptr, pageSize) == -1) { + perror("Error un-mmapping the file"); + } + return val; + } + if (hash > LastPageLastHash) { + cout << "HASH NOT IN FILE " << hash << endl; + return 0; + } + //start the search + int counter = 0; + while (true) { + // cout << "ON LOOP " << counter << endl << endl; + counter++; + long int currentPage = lastPos - ((lastPos - firstPos) / 2); + // cout << "checking page " << currentPage << " last = " << lastPos << " and first = " << firstPos << endl;; + if (currentPage == lastPos or currentPage == firstPos or lastPos - firstPos < 3) { + string extra = ""; + // cout << "\nenvoked this" << endl; + fileptr = (char *) mmap64(NULL, pageSize * 5, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, + pageSize * (firstPos - 1)); + data = fileptr; + // cout << "made it here" << endl; + int val = checkPage(data, hash, pageSize * 5, extra); + if (munmap(fileptr, pageSize * 5) == -1) { + perror("Error un-mmapping the file"); + } + return val; + } + //cout << " fileptr = (char*)mmap64(NULL, " << pageSize*2 <<", PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, " << pageSize<<" * " << currentPage <<");"<< endl; + fileptr = (char *) mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize * currentPage); + data = fileptr; + string CurrentPageFirstHash; + string CurrentPageLastHash; + ProcessPage(data, CurrentPageFirstHash, CurrentPageLastHash, pageSize); + if (munmap(fileptr, pageSize) == -1) { + perror("Error un-mmapping the file"); + } + // cout << " with " << CurrentPageFirstHash << " and " << CurrentPageLastHash << endl; + if (hash >= CurrentPageFirstHash and hash <= CurrentPageLastHash) { + fileptr = (char *) mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, + pageSize * currentPage); + int val = checkPage(data, hash, pageSize, ""); + if (munmap(fileptr, pageSize) == -1) { + perror("Error un-mmapping the file"); + } + return val; + } else { + if (hash < CurrentPageFirstHash) { + // cout << "hash " << hash << " is greater than " << CurrentPageFirstHash << " looking above" << endl; + lastPos = currentPage; + LastPageFirstHash = CurrentPageFirstHash; + LastPageLastHash = CurrentPageLastHash; + } else if (hash > CurrentPageLastHash) { + // cout << "hash \n" << hash << " is less than \n" << CurrentPageLastHash << " looking below" << endl; + firstPos = currentPage; + FirstPageFirstHash = CurrentPageFirstHash; + FirstPageLastHash = CurrentPageLastHash; + } + } - return -1; //this better not ever happen, should return in one of the if statesments above + } + close(fd); + + return -1; //this better not ever happen, should return in one of the if statesments above } -bool fncomp (char lhs, char rhs) {return lhs=0; i+= -1) - { - char C = Sequence.c_str()[i]; - // cout << C << endl; - if (C == 'A') - NewString += 'T'; - else if (C == 'C') - NewString += 'G'; - else if (C == 'G') - NewString += 'C'; - else if (C == 'T') - NewString += 'A'; - else if (C == 'N') - NewString += 'N'; - else if (C == '-') - NewString += "-"; - else - { - cout << "ERROR IN RevComp - " << C << " " << endl; - NewString += C; - } +string RevComp(string Sequence) { + string NewString = ""; + //cout << "Start - " << Sequence << "\n"; + //cout << Sequence.length() << endl; + for (int i = Sequence.length() - 1; i >= 0; i += -1) { + char C = Sequence.c_str()[i]; + // cout << C << endl; + if (C == 'A') + NewString += 'T'; + else if (C == 'C') + NewString += 'G'; + else if (C == 'G') + NewString += 'C'; + else if (C == 'T') + NewString += 'A'; + else if (C == 'N') + NewString += 'N'; + else if (C == '-') + NewString += "-"; + else { + cout << "ERROR IN RevComp - " << C << " " << endl; + NewString += C; + } - } - //cout << "end\n"; - return NewString; + } + //cout << "end\n"; + return NewString; } -void process_mem_usage(double& vm_usage, double& resident_set, double& MAXvm, double& MAXrss) -{ - using std::ios_base; - using std::ifstream; - using std::string; - - vm_usage = 0.0; - resident_set = 0.0; - - // 'file' stat seems to give the most reliable results - // - ifstream stat_stream("/proc/self/stat",ios_base::in); - - // dummy vars for leading entries in stat that we don't care about - // - string pid, comm, state, ppid, pgrp, session, tty_nr; - string tpgid, flags, minflt, cminflt, majflt, cmajflt; - string utime, stime, cutime, cstime, priority, nice; - string O, itrealvalue, starttime; - - // the two fields we want - // - unsigned long vsize; - long rss; - - stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr - >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt - >> utime >> stime >> cutime >> cstime >> priority >> nice - >> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest - - stat_stream.close(); - - long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages - vm_usage = vsize / 1024.0; - resident_set = rss * page_size_kb; - if (vm_usage > MAXvm){MAXvm = vm_usage;} - if (resident_set > MAXrss){MAXrss = resident_set;} +void process_mem_usage(double &vm_usage, double &resident_set, double &MAXvm, double &MAXrss) { + using std::ios_base; + using std::ifstream; + using std::string; + + vm_usage = 0.0; + resident_set = 0.0; + + // 'file' stat seems to give the most reliable results + // + ifstream stat_stream("/proc/self/stat", ios_base::in); + + // dummy vars for leading entries in stat that we don't care about + // + string pid, comm, state, ppid, pgrp, session, tty_nr; + string tpgid, flags, minflt, cminflt, majflt, cmajflt; + string utime, stime, cutime, cstime, priority, nice; + string O, itrealvalue, starttime; + + // the two fields we want + // + unsigned long vsize; + long rss; + + stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr + >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt + >> utime >> stime >> cutime >> cstime >> priority >> nice + >> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest + + stat_stream.close(); + + long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages + vm_usage = vsize / 1024.0; + resident_set = rss * page_size_kb; + if (vm_usage > MAXvm) { MAXvm = vm_usage; } + if (resident_set > MAXrss) { MAXrss = resident_set; } } -string ShittyGenotyper(int Alt, int Ref) -{ - if (Alt ==0 and Ref ==0) - return "."; - else if (Alt == 0 and Ref > 1) - return "0/0"; - else if (Alt >0 and Ref ==0) - return "1/1"; - else if ((double) Alt / ((double) Ref + (double) Alt) >.85) - return "1/1"; - else if ((double) Alt / ((double) Ref + (double) Alt) <.15) - return "0/0"; - else - return "0/1"; + +string ShittyGenotyper(int Alt, int Ref) { + if (Alt == 0 and Ref == 0) + return "."; + else if (Alt == 0 and Ref > 1) + return "0/0"; + else if (Alt > 0 and Ref == 0) + return "1/1"; + else if ((double) Alt / ((double) Ref + (double) Alt) > .85) + return "1/1"; + else if ((double) Alt / ((double) Ref + (double) Alt) < .15) + return "0/0"; + else + return "0/1"; } -class MobRead -{ - public: - string name; - string cigarString; - int flag; - bool FlagBits[16]; - string chr; - int pos; - string cigar; - int mapQual; - string seq; - string qual; - void parse(string read); - int AS = -1; - void processCigar(); - void write(); + +class MobRead { +public: + string name; + string cigarString; + int flag; + bool FlagBits[16]; + string chr; + int pos; + string cigar; + int mapQual; + string seq; + string qual; + + void parse(string read); + + int AS = -1; // todo: what is this? + void processCigar(); + + void write(); }; -void MobRead::write() -{ - cout << name << endl; - cout << " flag = " << flag << endl; - cout << " mapQual = " << mapQual << endl; - cout << " Strand = " << GetReadOrientation(flag) << endl; - cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - cout << " cigar = " << cigar << endl; - cout << " Seq = " << seq << endl; - cout << " Qual = " << qual << endl; - cout << " Cigar = " << cigarString << endl; + +void MobRead::write() { + cout << name << endl; + cout << " flag = " << flag << endl; + cout << " mapQual = " << mapQual << endl; + cout << " Strand = " << GetReadOrientation(flag) << endl; + cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; + cout << " cigar = " << cigar << endl; + cout << " Seq = " << seq << endl; + cout << " Qual = " << qual << endl; + cout << " Cigar = " << cigarString << endl; } - -void MobRead::processCigar() -{ - string num = ""; - for (int i = 0; i < cigar.length(); i++) - { - if (cigar.c_str()[i] >= 48 and cigar.c_str()[i] <= 57) - num = num + cigar.c_str()[i]; - else - { - int number = atoi(num.c_str()); - for(int j = 0; j < number; j++) - {cigarString += cigar.c_str()[i];} - num = ""; - } - } + +void MobRead::processCigar() { + string num = ""; + for (int i = 0; i < cigar.length(); i++) { + if (cigar.c_str()[i] >= 48 and cigar.c_str()[i] <= 57) + num = num + cigar.c_str()[i]; + else { + int number = atoi(num.c_str()); + for (int j = 0; j < number; j++) { cigarString += cigar.c_str()[i]; } + num = ""; + } + } } -void MobRead::parse(string read) -{ - //cout << "Mob parsing " << read << endl; - vector temp = Split(read, '\t'); - name = temp[0]; - //cout << "name " << name; - flag = atoi(temp[1].c_str()); - chr = temp[2]; - pos = atoi(temp[3].c_str()); - mapQual = atoi(temp[4].c_str()); - cigar = temp[5]; - seq = temp[9]; - qual = temp[10]; - - for (int i = 11; i < temp.size(); i++) - { - if (temp[i].length() > 3) - { - if (temp[i].c_str()[0]== 'A' && temp[i].c_str()[1]== 'S' && temp[i].c_str()[2]== ':') - { - vector temp2 = Split(temp[i], ':'); - AS = atoi(temp2[2].c_str()); - } - } - } - for (int j = 0; j < 16; ++j){ - FlagBits [j] = 0 != (flag & (1 << j)); - } - processCigar(); +void MobRead::parse(string read) { + //cout << "Mob parsing " << read << endl; + vector temp = Split(read, '\t'); + name = temp[0]; + //cout << "name " << name; + flag = atoi(temp[1].c_str()); + chr = temp[2]; + pos = atoi(temp[3].c_str()); + mapQual = atoi(temp[4].c_str()); + cigar = temp[5]; + seq = temp[9]; + qual = temp[10]; + + for (int i = 11; i < temp.size(); i++) { + if (temp[i].length() > 3) { + if (temp[i].c_str()[0] == 'A' && temp[i].c_str()[1] == 'S' && temp[i].c_str()[2] == ':') { + vector temp2 = Split(temp[i], ':'); + AS = atoi(temp2[2].c_str()); + } + } + } + + for (int j = 0; j < 16; ++j) { + FlagBits[j] = 0 != (flag & (1 << j)); + } + processCigar(); } -class SamRead -{ - public: - - bool parsed = false; - bool MobAligned = false; - bool AllA = false; - int SVeventid = 0; - int BNDid =0; - string clipPattern = ""; - int isSplitRead = 0; - string MobContig = "none"; - int PolyA = 0; - string name; - int flag; - bool FlagBits[16]; - string chr; - int pos; - int mapQual; - int AlignScore; - int MobAS = -1; - string cigar; - string seq; - string qual; - string RefSeq; - string originalSeq; - string originalQual; - string cigarString; - string strand; - string phase = "none"; - float StrandBias; - string strands; - int forward; - int reverse; - bool UsedForBigVar; - vector alignments; - vector Positions; - vector ChrPositions; - int AlignmentSegments; - int AlignmentSegmentsCigar; - vector MutAltCounts; - vector MutRefCounts; - vector MutContigCounts; - vector MutHashListCounts; - - vector> ParAltCounts; - vector> ParRefCounts; - vector AltKmers; - vector RefKmers; - bool first; // = true; - bool combined; // = false; - vector PeakMap; - - void createPeakMap(); - void parse(string read); - void getRefSeq(); - void CountAlignmentSegments(); - void CountAlignmentSegmentsCigar(); - void processCigar(); - void parseInsertions( SamRead B); - void parseMutations( char *argv[], vector& reads ); - void GetModes2(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &HashCounts, int &PossibleVarKmer); - void GetModes(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &ParRefModes, vector &ParAltModes, vector &HashCounts, vector &HashCountsOG, int &PossibleVarKmer); - //string ShittyGenotyper(int Alt, int Ref); - int GetSupportingHashCount(int pos, string alt, string reff); - void processMultiAlignment(); - void write(); - void writeVertical(); - void writetofile(ofstream &out); - void flipRead(); - void LookUpKmers(); - void CheckPhase(); - void FixTandemRef(); - int isPolyA(vector r); - int CheckParentCov(int &mode); - bool StartsWithAlign(int &pos, string &insert); - bool EndsWithAlign(int &pos, string &insert); - bool StartsWithAlignAtPeak(int &pos, string &insert, int &Kdepth); - bool EndsWithAlignAtPeak(int &pos, string &insert, int &Kdepth); - void checkMob(unordered_map m); - int sigBreakPoint(); - int CountBasesAligned(int start); - int BreakPoint(); - string createStructGenotype(int pos); - string ClipPattern(); - string filterSV(); - bool CheckEndsAlign(); - int CheckBasesAligned(); - int SVCheckParentsForLowCov(int spot); - - - vector hashes; - vector hashesRef; - vector varHash; - vector candidateHash; - vector > parentCounts; - vector > parentCountsReference; - vector mutCounts; - vector mutCountsRef; - void BuildUpHashCountTable(); - void GetQualityHashes(int &Mut, int &Pos, int spot); - string getClippedSequence(int pos, string type); + +/* + * Class to represent a single SAM read. + */ +class SamRead { +public: + + bool parsed = false; + bool MobAligned = false; + bool AllA = false; + int SVeventid = 0; + int BNDid = 0; + string clipPattern = ""; + int isSplitRead = 0; + string MobContig = "none"; + int PolyA = 0; + string name; + int flag; + bool FlagBits[16]; + string chr; + int pos; + int mapQual; + int AlignScore; + int MobAS = -1; + string cigar; + string seq; + string qual; + string RefSeq; + string originalSeq; + string originalQual; + string cigarString; // todo: what is diff between cigar and cigar string? + string strand; + string phase = "none"; + float StrandBias; + string strands; + int forward; + int reverse; + bool UsedForBigVar; + vector alignments; + vector Positions; + vector ChrPositions; + int AlignmentSegments; + int AlignmentSegmentsCigar; + vector MutAltCounts; // The number of kmers supporting the mutation + vector MutRefCounts; + vector MutContigCounts; + vector MutHashListCounts; + + vector > ParAltCounts; + vector > ParRefCounts; + vector AltKmers; + vector RefKmers; + bool first; // = true; + bool combined; // = false; + vector PeakMap; + + void createPeakMap(); + + void parse(string read); + + void getRefSeq(); + + void CountAlignmentSegments(); + + void CountAlignmentSegmentsCigar(); + + void processCigar(); + + void parseInsertions(SamRead B); + + void parseMutations(char *argv[], vector &reads); + + void GetModes2(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &HashCounts, + int &PossibleVarKmer); + + void GetModes(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &ParRefModes, + vector &ParAltModes, vector &HashCounts, vector &HashCountsOG, int &PossibleVarKmer); + + //string ShittyGenotyper(int Alt, int Ref); + int GetSupportingHashCount(int pos, string alt, string reff); + + void processMultiAlignment(); + + void write(); + + void writeVertical(); + + void writetofile(ofstream &out); + + void flipRead(); + + void LookUpKmers(); + + void CheckPhase(); + + void FixTandemRef(); + + int isPolyA(vector r); + + int CheckParentCov(int &mode); + + bool StartsWithAlign(int &pos, string &insert); + + bool EndsWithAlign(int &pos, string &insert); + + bool StartsWithAlignAtPeak(int &pos, string &insert, int &Kdepth); + + bool EndsWithAlignAtPeak(int &pos, string &insert, int &Kdepth); + + void checkMob(unordered_map m); + + int sigBreakPoint(); + + int CountBasesAligned(int start); + + int BreakPoint(); + + string createStructGenotype(int pos); + + string ClipPattern(); + + string filterSV(); + + bool CheckEndsAlign(); + + int CheckBasesAligned(); + + int SVCheckParentsForLowCov(int spot); + + + vector hashes; + vector hashesRef; + vector varHash; + vector candidateHash; + vector > parentCounts; + vector > parentCountsReference; + vector mutCounts; + vector mutCountsRef; + + void BuildUpHashCountTable(); + + void GetQualityHashes(int &Mut, int &Pos, int spot); + + string getClippedSequence(int pos, string type); }; -string SamRead::getClippedSequence(int pos, string type) -{ - int start = -1; - int end = -1; - if (type == "mc") - { - start = pos; - end = seq.size(); - } - else if( type == "cm") - { - start = 0; - end = pos; - } - else - { - cout<< "unrecognised type = " << type; - return ""; - } - stringstream returnseq; - for(int i = start; i < end; i++) - { - returnseq<< seq.c_str()[i]; - } - return returnseq.str(); -} -string SamRead::filterSV() -{ - string Filter = ""; - if(StrandBias>=0) - { - if (StrandBias >0.99 || StrandBias < 0.01) - Filter+="SB;"; - } - if(AlignmentSegments > SegThreshold || AlignmentSegmentsCigar > SegThresholdCigar) - { - Filter+="PA;"; - } - return Filter; +string SamRead::getClippedSequence(int pos, string type) { + int start = -1; + int end = -1; + if (type == "mc") { + start = pos; + end = seq.size(); + } else if (type == "cm") { + start = 0; + end = pos; + } else { + cout << "unrecognised type = " << type; + return ""; + } + stringstream returnseq; + for (int i = start; i < end; i++) { + returnseq << seq.c_str()[i]; + } + return returnseq.str(); } -string SamRead::ClipPattern() -{ - //cout << "checking clip pattern"; - char last = 'a'; - string pattern = ""; - int count = 0; - - if (cigarString.c_str()[0] == 'H' || cigarString.c_str()[0] == 'S') - { - last = 'c'; - } - else - { - last = 'm'; - } +string SamRead::filterSV() { + string Filter = ""; + + if (StrandBias >= 0) { + if (StrandBias > 0.99 || StrandBias < 0.01) + Filter += "SB;"; + } + if (AlignmentSegments > SegThreshold || AlignmentSegmentsCigar > SegThresholdCigar) { + Filter += "PA;"; + } + return Filter; +} - for (int i =1; i 10) - { - pattern +=last; - } - last = 'c'; - count = 1; - } - } - else - { - if (last == 'm') - { - count ++; - } - else - { - if(count> 10) - { - pattern +=last; - } - last = 'm'; - count = 1; - } - } - } - if(count> 10) - { - pattern +=last; - } - - //write(); - //cout << "pattern = " << pattern << endl; - return pattern; +string SamRead::ClipPattern() { + //cout << "checking clip pattern"; + char last = 'a'; + string pattern = ""; + int count = 0; + + if (cigarString.c_str()[0] == 'H' || cigarString.c_str()[0] == 'S') { + last = 'c'; + } else { + last = 'm'; + } + + for (int i = 1; i < cigarString.size(); i++) { + if (cigarString.c_str()[i] == 'H' || cigarString.c_str()[i] == 'S') { + if (last == 'c') { + count++; + } else { + if (count > 10) { + pattern += last; + } + last = 'c'; + count = 1; + } + } else { + if (last == 'm') { + count++; + } else { + if (count > 10) { + pattern += last; + } + last = 'm'; + count = 1; + } + } + } + if (count > 10) { + pattern += last; + } + + //write(); + //cout << "pattern = " << pattern << endl; + return pattern; }; -void SamRead::GetQualityHashes(int &Mut, int &Pos, int spot) -{ - cout << "struct GettingHashes" << endl; - //write(); - vector MutAltCounts; - vector MutRefCounts; - vector a; - a.clear(); - ///build up mutant kmer depths for ALT - int start = spot - HashSize+1; - if (start <0) - start = 0; - - string hash =""; - string ref = ""; - string lastHash = ""; - int PossibleVarKmer = 0; - cout << "starting loop, start = " << start << " spot = " << spot << " seq size = " << seq.size() << endl; - - for(int i = start; i <= spot && i < seq.size()-HashSize; i++) - { - hash = seq.substr(i, HashSize); - ref = RefSeq.substr(i, HashSize); - unsigned long int LongHash = HashToLong(hash); - if ( hash != ref and (ExcludeHashes[HashToLong(hash)]<1 && ExcludeHashes[HashToLong(RevComp(hash))]<1) and hash != lastHash) - { - if (Hash.count(hash) > 0) - { - MutAltCounts.push_back(Hash[hash]); - } - else if (Hash.count(RevComp(hash)) > 0) - { - MutAltCounts.push_back(Hash[RevComp(hash)]); - } - - // if ( hash != ref and (ExcludeHashes[HashToLong(hash)]<1 && ExcludeHashes[HashToLong(RevComp(hash))]<1) and hash != lastHash) - { - - PossibleVarKmer++; - // cout << "Different" << endl; - } - } - lastHash = hash; - } - Mut = MutAltCounts.size(); - Pos = PossibleVarKmer; +void SamRead::GetQualityHashes(int &Mut, int &Pos, int spot) { + cout << "struct GettingHashes" << endl; + //write(); + vector MutAltCounts; + vector MutRefCounts; + vector a; + a.clear(); + ///build up mutant kmer depths for ALT + int start = spot - HashSize + 1; + if (start < 0) + start = 0; + + string hash = ""; + string ref = ""; + string lastHash = ""; + int PossibleVarKmer = 0; + cout << "starting loop, start = " << start << " spot = " << spot << " seq size = " << seq.size() << endl; + + for (int i = start; i <= spot && i < seq.size() - HashSize; i++) { + hash = seq.substr(i, HashSize); + ref = RefSeq.substr(i, HashSize); + unsigned long int LongHash = HashToLong(hash); + if (hash != ref and (ExcludeHashes[HashToLong(hash)] < 1 && ExcludeHashes[HashToLong(RevComp(hash))] < 1) and + hash != lastHash) { + if (Hash.count(hash) > 0) { + MutAltCounts.push_back(Hash[hash]); + } else if (Hash.count(RevComp(hash)) > 0) { + MutAltCounts.push_back(Hash[RevComp(hash)]); + } + + // if ( hash != ref and (ExcludeHashes[HashToLong(hash)]<1 && ExcludeHashes[HashToLong(RevComp(hash))]<1) and hash != lastHash) + { + + PossibleVarKmer++; + // cout << "Different" << endl; + } + + } + lastHash = hash; + } + Mut = MutAltCounts.size(); + Pos = PossibleVarKmer; } -bool CheckGenotypes(string genotypes) -{ - vector temp = Split(genotypes, '\t'); - if (temp.size() < 1) - return false; - for(int i =0; i < temp.size(); i++) - { - if (temp[i].c_str()[0] == '.') - return false; - } - return true; + +bool CheckGenotypes(string genotypes) { + vector temp = Split(genotypes, '\t'); + if (temp.size() < 1) + return false; + for (int i = 0; i < temp.size(); i++) { + if (temp[i].c_str()[0] == '.') + return false; + } + return true; } -int SamRead::SVCheckParentsForLowCov(int spot) -{ - int MinParCov = 1; - //cout << "CheckingParLowCov" << endl; - //write(); - vector MutAltCounts; - vector> sParAltCounts; - vector a; - a.clear(); - for (int i =0; i streak; - for (int i =0; i0 ) - { - //cout << "\t" << ParentHashes[k][LongHash]; - if (ParentHashes[k][LongHash] > 0 && ParentHashes[k][LongHash] <= ParLowCovThreshold ) - { - numlow ++; - } - } - else - { - //cout << "\t" << "-1"; - } - } - - if(numlow == 1) - { - - //cout << " keeping"; - for (int k =0; k0 ) - { - if (ParentHashes[k][LongHash] > MinParCov && ParentHashes[k][LongHash] <=ParLowCovThreshold) - { - streak[k]++; - //cout << "\ts=" << streak[k]; - if (streak[k] >=3) - sParAltCounts[k].push_back(ParentHashes[k][LongHash]); - } - else - streak[k]=0; - } - else - streak[k]=0; - } - } - else - { - //cout << " common reject"; - for (int k =0; k MutAltCounts; + vector > sParAltCounts; + vector a; + a.clear(); + for (int i = 0; i < ParentHashes.size(); i++) { + sParAltCounts.push_back(a); + + } + + int start = spot - HashSize + 1; + if (start < 0) + start = 0; + string hash = ""; + + vector streak; + for (int i = 0; i < sParAltCounts.size(); i++) { + streak.push_back(0); + } + for (int i = start; i < spot && spot < seq.size(); i++) { + hash = seq.substr(i, HashSize); + //cout << "hash = " << hash << endl; + //cout << i << "\t" << spot << "\t" << hash ; + unsigned long int LongHash = HashToLong(hash); + if (ExcludeHashes[HashToLong(hash)] < 1 && ExcludeHashes[HashToLong(RevComp(hash))] < 1) { + int numlow = 0; + for (int k = 0; k < sParAltCounts.size(); k++) { + if (ParentHashes[k].count(LongHash) > 0) { + //cout << "\t" << ParentHashes[k][LongHash]; + if (ParentHashes[k][LongHash] > 0 && ParentHashes[k][LongHash] <= ParLowCovThreshold) { + numlow++; + } + } else { + //cout << "\t" << "-1"; + } + } + + if (numlow == 1) { + + //cout << " keeping"; + for (int k = 0; k < sParAltCounts.size(); k++) { + if (ParentHashes[k].count(LongHash) > 0) { + if (ParentHashes[k][LongHash] > MinParCov && ParentHashes[k][LongHash] <= ParLowCovThreshold) { + streak[k]++; + //cout << "\ts=" << streak[k]; + if (streak[k] >= 3) + sParAltCounts[k].push_back(ParentHashes[k][LongHash]); + } else + streak[k] = 0; + } else + streak[k] = 0; + } + } else { + //cout << " common reject"; + for (int k = 0; k < sParAltCounts.size(); k++) { + streak[k] = 0; + } + } + } else { + //cout << "common hash"; + } + //cout << endl; + + } + int LowCovPar = 0; + //cout << "summing low cov par" << endl; + for (int i = 0; i < sParAltCounts.size(); i++) { + //cout << "parent[" << i << "] = " << sParAltCounts[i].size()<< endl ; + if (sParAltCounts[i].size() >= 1) + LowCovPar++; + } + return LowCovPar; } -string SamRead::createStructGenotype(int spot) -{ - if (spot <= 0) - return ""; - - cout << "struct genotyper" << endl; - //write(); - vector MutAltCounts; - vector MutRefCounts; - vector> sParAltCounts; - vector> sParRefCounts; - vector a; - a.clear(); - for (int i =0; i 0)//if (MutantHashes.count(LongHash)) - { - MutAltCounts.push_back(Hash[hash]); - cout << hash << "\t" << Hash[hash] << " i = " << i << " seq.size = " << seq.size() << " HashSize = " << HashSize ; - for (int i =0; i0) - { - sParAltCounts[i].push_back(ParentHashes[i][LongHash]); - cout << "\t" << ParentHashes[i][LongHash]; - } - else - { - cout << "\t-1"; - } - } - } - else if (Hash.count(RevComp(hash)) > 0) - { - MutAltCounts.push_back(Hash[RevComp(hash)]); - cout << hash << "\t" << Hash[RevComp(hash)] << " i = " << i << " seq.size = " << seq.size() << " HashSize = " << HashSize; - for (int i =0; i0) - { - sParAltCounts[i].push_back(ParentHashes[i][LongHash]); - cout << "\t" << ParentHashes[i][LongHash]; - } - else - { - cout << "\t-1"; - } - } - } - else - { - cout << hash << "\tnone"; - } - - cout << endl; - } - - cout << "RefSizes after anlying is added are " << sParRefCounts.size() << endl; - for (int i =0; i MutAltCounts; // todo: this is vector we need to remove 0s from + vector MutRefCounts; + vector > sParAltCounts; + vector > sParRefCounts; + vector a; + a.clear(); + for (int i = 0; i < ParentHashes.size(); i++) { + sParAltCounts.push_back(a); + sParRefCounts.push_back(a); + + } + cout << "RefSizes before anlying is added are " << endl; + for (int i = 0; i < sParRefCounts.size(); i++) { + cout << sParRefCounts[i].size() << endl; + } + ///build up mutant kmer depths for ALT + int start = spot - HashSize; + if (start < 0) + start = 0; + string hash = ""; + cout << "hereTESTING " << endl; + for (int i = start; i < spot && i + HashSize < seq.size(); i++) { + hash = seq.substr(i, HashSize); + unsigned long int LongHash = HashToLong(hash); + + if (Hash.count(hash) > 0)//if (MutantHashes.count(LongHash)) + { + MutAltCounts.push_back(Hash[hash]); + // SJG todo: this is where we need to filter for 0 AO - 1) is MutAltCounts used elsewhere? 2) Should we also filter RefAltCounts? + cout << hash << "\t" << Hash[hash] << " i = " << i << " seq.size = " << seq.size() << " HashSize = " + << HashSize; + for (int i = 0; i < sParAltCounts.size(); i++) { + if (ParentHashes[i].count(LongHash) > 0) { + sParAltCounts[i].push_back(ParentHashes[i][LongHash]); + cout << "\t" << ParentHashes[i][LongHash]; + } else { + cout << "\t-1"; + } + } + } else if (Hash.count(RevComp(hash)) > 0) { + // SJG todo: again where we need to filter for 0 AO + MutAltCounts.push_back(Hash[RevComp(hash)]); + cout << hash << "\t" << Hash[RevComp(hash)] << " i = " << i << " seq.size = " << seq.size() + << " HashSize = " << HashSize; + for (int i = 0; i < sParAltCounts.size(); i++) { + if (ParentHashes[i].count(LongHash) > 0) { + sParAltCounts[i].push_back(ParentHashes[i][LongHash]); + cout << "\t" << ParentHashes[i][LongHash]; + } else { + cout << "\t-1"; + } + } + } else { + cout << hash << "\tnone"; + } + cout << endl; + + } + + cout << "RefSizes after anlying is added are " << sParRefCounts.size() << endl; + for (int i = 0; i < sParRefCounts.size(); i++) { + cout << sParRefCounts[i].size() << endl; + } + + + + ///Build up mutant kmer depths for REF + cout << "chr = " << chr << " pos = " << pos << "+" << spot << "-" << HashSize << " = " << pos + spot - HashSize + << endl; + int pullstart = pos + spot - HashSize; + int pullend = HashSize + HashSize; + if (pullstart < 0) { + pullend += pullstart; + pullstart = 0; + } + string refs = Reff.getSubSequence(chr, pos + spot - HashSize, HashSize + HashSize); + cout << "refs = " << refs << endl; + cout << "hereTESTING" << endl; + for (int i = 0; i + HashSize < refs.size() && refs.size() > 0; i++) { + hash = refs.substr(i, HashSize); + cout << "hash = " << hash << " i = " << i << " refs.size = " << refs.size() << endl; + unsigned long int LongHash = HashToLong(hash); + if (MutantHashes.count(LongHash) > 0) { + MutRefCounts.push_back(MutantHashes[LongHash]); + cout << hash << "\t" << MutantHashes[LongHash]; + } else { + cout << hash << "\t-1"; + } + cout << "here" << endl; + for (int j = 0; j < sParRefCounts.size(); j++) { + if (ParentHashes[j].count(LongHash) > 0) { + sParRefCounts[j].push_back(ParentHashes[j][LongHash]); + cout << "\t" << ParentHashes[j][LongHash]; + } else { + cout << "\t-1"; + } + } + cout << endl; + } + cout << "RefSizes are" << endl; + for (int i = 0; i < sParRefCounts.size(); i++) { + cout << sParRefCounts[i].size() << endl; + } + + sort(MutAltCounts.begin(), MutAltCounts.end()); + sort(MutRefCounts.begin(), MutRefCounts.end()); + + for (int i = 0; i < sParRefCounts.size(); i++) { + sort(sParRefCounts[i].begin(), sParRefCounts[i].end()); + } + for (int i = 0; i < sParAltCounts.size(); i++) { + sort(sParAltCounts[i].begin(), sParAltCounts[i].end()); + } + cout << "done sorting"; + + int MutAlt; + int MutRef; + vector ParAlt; + vector ParRef; + + if (MutAltCounts.size() > 0) + MutAlt = MutAltCounts[0]; + else + MutAlt = 0; + if (MutRefCounts.size() > 0) + MutRef = MutRefCounts[0]; + else + MutRef = 0; + cout << "build Mut Alelles " << MutAlt << " " << MutRef << endl; + + for (int i = 0; i < sParAltCounts.size(); i++) { + if (sParAltCounts[i].size() > 0) + ParAlt.push_back(sParAltCounts[i][0]); + else + ParAlt.push_back(0); + } + + for (int i = 0; i < sParRefCounts.size(); i++) { + if (sParRefCounts[i].size() > 0) + ParRef.push_back(sParRefCounts[i][0]); + else + ParRef.push_back(0); + } + + cout << "counts are: \nMut: " << MutAlt << "\t" << MutRef << endl; + for (int i = 0; i < ParAlt.size(); i++) { + cout << ParAlt[i] << "\t" << ParRef[i] << endl; + } + cout << "done with counts" << endl; + stringstream ss; + ss << ShittyGenotyper(MutAlt, MutRef) << ":" << MutAlt + MutRef << ":" << MutRef << ":" << MutAlt; + for (int i = 0; i < sParAltCounts.size(); i++) { + ss << "\t" << ShittyGenotyper(ParAlt[i], ParRef[i]) << ":" << ParAlt[i] + ParRef[i] << ":" << ParRef[i] << ":" + << ParAlt[i]; + } + cout << "returning " << ss.str() << endl; + + return ss.str(); +} - ///Build up mutant kmer depths for REF - cout << "chr = " << chr << " pos = " << pos << "+"<< spot <<"-"< 0 ; i++) - { - hash = refs.substr(i, HashSize); - cout << "hash = " << hash << " i = " << i << " refs.size = " << refs.size() << endl; - unsigned long int LongHash = HashToLong(hash); - if (MutantHashes.count(LongHash) > 0) - { - MutRefCounts.push_back(MutantHashes[LongHash]); - cout << hash << "\t" << MutantHashes[LongHash]; - } - else - { - cout << hash << "\t-1"; - } - cout << "here" << endl; - for (int j =0; j0) - { - sParRefCounts[j].push_back(ParentHashes[j][LongHash]); - cout << "\t" << ParentHashes[j][LongHash]; - } - else - { - cout << "\t-1"; - } - } - cout << endl; - } - cout << "RefSizes are" << endl; - for (int i =0; i ParAlt; - vector ParRef; + int delFixA = 0; + int delFixB = 0; + bool StartAlign = false; + bool EndAlign = false; + bool InUnAlign = false; + int centerPeak = 0; + for (int i = 0; i + delFixA < A.seq.size() && i + delFixB < B.seq.size(); i++) { - if (MutAltCounts.size()>0) - MutAlt = MutAltCounts[0]; - else - MutAlt = 0; - - if (MutRefCounts.size()>0) - MutRef = MutRefCounts[0]; - else - MutRef = 0; - cout << "build Mut Alelles " << MutAlt << " " << MutRef << endl; - - for (int i =0; i0) - ParAlt.push_back(sParAltCounts[i][0]); - else - ParAlt.push_back(0); - } + ///////keep everything lined up ///// + while (A.seq.c_str()[i + delFixA] == '-') { + cout << "fixing base" << endl; + delFixA++; - for (int i =0; i0) - ParRef.push_back(sParRefCounts[i][0]); - else - ParRef.push_back(0); - } - - cout << "counts are: \nMut: " << MutAlt << "\t" < 0) - { - cout << "BreakpointInUnalignedCenter true with " << centerPeak << " peaks" << endl; - return true; - } - else - return false; + if (StartAlign == true && EndAlign == true && InUnAlign == true && centerPeak > 0) { + cout << "BreakpointInUnalignedCenter true with " << centerPeak << " peaks" << endl; + return true; + } else + return false; - } //bool BreakpointInUnalignedCenter(SamRead A, SamRead B) //{ @@ -1213,7 +1121,7 @@ bool BreakpointInUnalignedCenter(SamRead A, SamRead B) // for (int i = start; i <=end; i++) // { // if (A.PeakMap[i]) -// return true; +// return true; // } // } // if (B.clipPattern == "cm" && A.clipPattern == "mc" && GetReadOrientation(A.flag) == GetReadOrientation(B.flag)) @@ -1229,326 +1137,282 @@ bool BreakpointInUnalignedCenter(SamRead A, SamRead B) // //////NEED TO ADD STUFF IF THEY ARE NOT ON THE SAME STRAND // // } -// return false; +// return false; //} -int SamRead::CountBasesAligned(int start) -{ - int count = 0; - for (int i = start; i R) -{ - int MinPolyAsize = 10; - cout << "in poly a test" << endl; - cout << "size of array = " << R.size() << endl; - int start = -1; - int end = -1; - char base = 'f'; - bool clipped = false; - bool atpeak = false; - cout << "Checking PolyAstatus" << endl; - //write(); - for (int j = 0; j fix; - for (int i =0; i 0 && R[j].cigarString.c_str()[i+fix[j]] != 'S' && R[j].cigarString.c_str()[i+fix[j]] != 'H') - check =true; - } +int SamRead::isPolyA(vector R) { + int MinPolyAsize = 10; + cout << "in poly a test" << endl; + cout << "size of array = " << R.size() << endl; + int start = -1; + int end = -1; + char base = 'f'; + bool clipped = false; + bool atpeak = false; + cout << "Checking PolyAstatus" << endl; + //write(); + for (int j = 0; j < R.size(); j++) { + //R[j].write(); + //cout << R[j].seq.size() << " != " << seq.size() << endl; + //if (R[j].seq.size() != seq.size()) + //{ + // cout << "warning not all the same size" << endl; + // return -1; + //} + if (GetReadOrientation(flag) != GetReadOrientation(R[j].flag)) { + R[j].flipRead(); + } + } + //write(); + //for (int j = 0; j fix; + for (int i = 0; i < R.size(); i++) { + int f = 0; + fix.push_back(f); + } + + + for (int i = 0; i + delFix < seq.size(); i++) { + + int u = 0; + //////////////////////////////////////////////// + //cout << "i = " << i << "\tdelFix= " << delFix << "\t" << seq.c_str()[i+delFix] << "\t" << base << "\t" << cigarString.c_str()[i+delFix] ; + // for (int j =0; j < R.size(); j++) + // { + // cout << "\t" << fix[j] << "\t" << R[j].seq.c_str()[i+fix[j]] << "\t" << R[j].cigarString.c_str()[i+fix[j]]; + // } + // cout << endl; + while (seq.c_str()[i + delFix] == '-') { + // cout << "fixing base" << endl; + delFix++; - if ( base == 'f' && (seq.c_str()[i+delFix] == 'T' || seq.c_str()[i+delFix] == 'A') && ( cigarString.c_str()[i+delFix] == 'H' || cigarString.c_str()[i+delFix] == 'S') && check == false) - { - base = seq.c_str()[i+delFix]; - start = i+delFix; - cout << "found a start " << base << " " << start << endl; - } - else if (base != 'f' && seq.c_str()[i+delFix] == base && ( cigarString.c_str()[i+delFix] == 'H' || cigarString.c_str()[i+delFix] == 'S') && check == false) - { - cout << "on a run " << start << " " << base << endl; - } - else if (base != 'f' && (( seq.c_str()[i+delFix] != base || ( cigarString.c_str()[i+delFix] != 'H' && cigarString.c_str()[i+delFix] != 'S')) || check == true )) - { - end = i+delFix; - int size = end - start; - cout << "ended run " << end << " " << seq.c_str()[i] << " " << end << " so size = " << size << endl; - if (size> MinPolyAsize) - { - cout << "chekcing peak and clipped" << endl; - for(int j = start; j <=end; j++) - { - if ( PeakMap[j] == true) - { atpeak = true;} - if ( cigarString.c_str()[j] == 'H' || cigarString.c_str()[j] == 'S') - { clipped = true;} - } - cout << "done checking peak and clipped" << endl; - } - cout << "clipped = " << clipped << " and atpeak = " << atpeak << endl; - if (clipped == true && atpeak == true) - { - cout << "found poly A with start " << start << "and end " << end << "with base " << base << endl; - if (clipPattern == "mc") - return start; - else if (clipPattern == "cm") - return end; + } + for (int j = 0; j < R.size(); j++) { + while (R[j].seq.c_str()[i + fix[j]] == '-') { + fix[j]++; + } + } + /////////////////////////////////////////////// + check = false; + for (int j = 0; j < R.size(); j++) { + if (R[j].mapQual > 0 && R[j].cigarString.c_str()[i + fix[j]] != 'S' && + R[j].cigarString.c_str()[i + fix[j]] != 'H') + check = true; + } - } - clipped = false; - atpeak = false; - base = 'f'; - start = -1; - end = -1; - } - } - if (base != 'f' && seq.c_str()[seq.size()-1] == base && check == false ) - { - end = seq.size()-1; - int size = end - start; - cout << "ended run " << end << " " << seq.c_str()[seq.size()-1] << " " << end << " so size = " << size << endl; - if (size> MinPolyAsize) - { - cout << "chekcing peak and clipped" << endl; - for(int j = start; j <=end; j++) - { - if ( PeakMap[j] == true) - { atpeak = true;} - if ( cigarString.c_str()[j] == 'H' || cigarString.c_str()[j] == 'S') - { clipped = true;} - } - } - // cout << "clipped = " << clipped << " and atpeak = " << atpeak << endl; - if (clipped == true && atpeak == true) - { - // cout << "found poly A with start " << start << "and end " << end << "with base " << base << endl; - return start; - } - } + if (base == 'f' && (seq.c_str()[i + delFix] == 'T' || seq.c_str()[i + delFix] == 'A') && + (cigarString.c_str()[i + delFix] == 'H' || cigarString.c_str()[i + delFix] == 'S') && check == false) { + base = seq.c_str()[i + delFix]; + start = i + delFix; + cout << "found a start " << base << " " << start << endl; + } else if (base != 'f' && seq.c_str()[i + delFix] == base && + (cigarString.c_str()[i + delFix] == 'H' || cigarString.c_str()[i + delFix] == 'S') && + check == false) { + cout << "on a run " << start << " " << base << endl; + } else if (base != 'f' && ((seq.c_str()[i + delFix] != base || (cigarString.c_str()[i + delFix] != 'H' && + cigarString.c_str()[i + delFix] != 'S')) || + check == true)) { + end = i + delFix; + int size = end - start; + cout << "ended run " << end << " " << seq.c_str()[i] << " " << end << " so size = " << size << endl; + if (size > MinPolyAsize) { + cout << "chekcing peak and clipped" << endl; + for (int j = start; j <= end; j++) { + if (PeakMap[j] == true) { atpeak = true; } + if (cigarString.c_str()[j] == 'H' || cigarString.c_str()[j] == 'S') { clipped = true; } + } + cout << "done checking peak and clipped" << endl; + } + cout << "clipped = " << clipped << " and atpeak = " << atpeak << endl; + if (clipped == true && atpeak == true) { + cout << "found poly A with start " << start << "and end " << end << "with base " << base << endl; + if (clipPattern == "mc") + return start; + else if (clipPattern == "cm") + return end; + + } + clipped = false; + atpeak = false; + base = 'f'; + start = -1; + end = -1; + } + } + if (base != 'f' && seq.c_str()[seq.size() - 1] == base && check == false) { + end = seq.size() - 1; + int size = end - start; + cout << "ended run " << end << " " << seq.c_str()[seq.size() - 1] << " " << end << " so size = " << size + << endl; + if (size > MinPolyAsize) { + cout << "chekcing peak and clipped" << endl; + for (int j = start; j <= end; j++) { + if (PeakMap[j] == true) { atpeak = true; } + if (cigarString.c_str()[j] == 'H' || cigarString.c_str()[j] == 'S') { clipped = true; } + } + } + // cout << "clipped = " << clipped << " and atpeak = " << atpeak << endl; + if (clipped == true && atpeak == true) { + // cout << "found poly A with start " << start << "and end " << end << "with base " << base << endl; + return start; + } + } - return -1; + return -1; } -void SamRead::checkMob(unordered_map m) -{ - //cout << "mob check of " << name << endl; - if (m.count(name) > 0) - { - MobAligned = true; - MobContig = m[name].chr; - MobAS = m[name].AS; - // cout << "mob found " << MobContig << endl; - } +void SamRead::checkMob(unordered_map m) { + //cout << "mob check of " << name << endl; + if (m.count(name) > 0) { + MobAligned = true; + MobContig = m[name].chr; + MobAS = m[name].AS; + // cout << "mob found " << MobContig << endl; + } } -void SamRead::BuildUpHashCountTable() -{ - /////////////////Building up varHash and hash lists ///////////// - //cout << "Building up varHash" << endl; - for (int i = 0; i < seq.size() - HashSize; i++) - { - string newHash = ""; - string newHashRef = ""; - newHash += seq.c_str()[i]; - newHashRef += RefSeq.c_str()[i]; - int count = 0; - ////can i replace this with get hash ? - if ((cigarString.c_str()[i] != 'D' and cigarString.c_str()[i] != 'R' and cigarString.c_str()[i] != 'H')) - { - for (int j = 1; j 0 or Hash.count(RevComp(newHash)) > 0) - varHash.push_back(true); - else - varHash.push_back(false); - } - /////////////////////////////////////////////////// - - - ///////////////////building up parent hash counts ////////////////// - //cout << "Bulding Par hash counts" << endl; - //vector ParentHash; - for(int pi = 0; pi counts; - vector countsRef; - for(int i = 0; i< hashes.size(); i++) - { - string hash = hashes[i]; - string hashRef = hashesRef[i]; - bool checkHash = true; - for (int j = 0; j < HashSize; j++) - { - if (!(hash[j] == 'A' or hash[j] == 'C' or hash[j] == 'G' or hash[j] == 'T')) - { - checkHash = false; - break; - } - } - if (checkHash) - { - unsigned long int LongHash = HashToLong(hash); - if (ParentHashes[pi].count(LongHash) >0) - counts.push_back(ParentHashes[pi][LongHash]); - else - counts.push_back(0); - unsigned long int LongHashRef = HashToLong(hashRef); - if (ParentHashes[pi].count(LongHashRef) >0) - countsRef.push_back(ParentHashes[pi][LongHashRef]); - else - countsRef.push_back(0); - } - else - { - counts.push_back(-1); - countsRef.push_back(-1); - } - } - parentCounts.push_back(counts); - parentCountsReference.push_back(countsRef); - } - ////////////////////////////////////////////////////////////////// - /////////////////////bulid Mut counts///////////////////////////// - //cout << "bulding mut counts" << endl; - //cout << hashes.size() << endl; - //cout << hashesRef.size() << endl; - for(int i = 0; i< hashes.size(); i++) - { - // cout << i<< endl; - string hash = hashes[i]; - // cout << " hash = " << hash << endl; - string hashRef = hashesRef[i]; - // cout << "RefHash = " << hashRef << endl; - bool checkHash = true; - for (int j = 0; j < HashSize; j++) - { - if (!(hash[j] == 'A' or hash[j] == 'C' or hash[j] == 'G' or hash[j] == 'T')) - { - checkHash = false; - break; - } - } - // cout << "check hash = " << checkHash << endl; - if (checkHash) - { - unsigned long int LongHash = HashToLong(hash); - if (MutantHashes.count(LongHash) >0) - { mutCounts.push_back(MutantHashes[LongHash]);} - else - { mutCounts.push_back(0);} - - unsigned long int LongHashRef = HashToLong(hashRef); - if (MutantHashes.count(LongHashRef) >0) - { mutCountsRef.push_back(MutantHashes[LongHashRef]);} - else - { mutCountsRef.push_back(0);} - } - else - { - mutCounts.push_back(-1); - mutCountsRef.push_back(-1); - } - } - ///////////////////////////////////////////////////////////////////// +void SamRead::BuildUpHashCountTable() { + /////////////////Building up varHash and hash lists ///////////// + //cout << "Building up varHash" << endl; + for (int i = 0; i < seq.size() - HashSize; i++) { + string newHash = ""; + string newHashRef = ""; + newHash += seq.c_str()[i]; + newHashRef += RefSeq.c_str()[i]; + int count = 0; + ////can i replace this with get hash ? + if ((cigarString.c_str()[i] != 'D' and cigarString.c_str()[i] != 'R' and cigarString.c_str()[i] != 'H')) { + for (int j = 1; j < seq.size() - i and count < HashSize - 1; j++) { + + if (cigarString.c_str()[i + j] != 'D' and cigarString.c_str()[i + j] != 'R' and + cigarString.c_str()[i + j] != 'H') { + newHash += seq.c_str()[i + j]; + newHashRef += RefSeq.c_str()[i + j]; + count++; + } + } + } + hashes.push_back(newHash); + hashesRef.push_back(newHashRef); + if (Hash.count(newHash) > 0 or Hash.count(RevComp(newHash)) > 0) + varHash.push_back(true); + else + varHash.push_back(false); + } + /////////////////////////////////////////////////// + + + ///////////////////building up parent hash counts ////////////////// + //cout << "Bulding Par hash counts" << endl; + //vector ParentHash; + for (int pi = 0; pi < ParentHashes.size(); pi++) { + vector counts; + vector countsRef; + for (int i = 0; i < hashes.size(); i++) { + string hash = hashes[i]; + string hashRef = hashesRef[i]; + bool checkHash = true; + for (int j = 0; j < HashSize; j++) { + if (!(hash[j] == 'A' or hash[j] == 'C' or hash[j] == 'G' or hash[j] == 'T')) { + checkHash = false; + break; + } + } + if (checkHash) { + unsigned long int LongHash = HashToLong(hash); + if (ParentHashes[pi].count(LongHash) > 0) + counts.push_back(ParentHashes[pi][LongHash]); + else + counts.push_back(0); + unsigned long int LongHashRef = HashToLong(hashRef); + if (ParentHashes[pi].count(LongHashRef) > 0) + countsRef.push_back(ParentHashes[pi][LongHashRef]); + else + countsRef.push_back(0); + } else { + counts.push_back(-1); + countsRef.push_back(-1); + } + } + parentCounts.push_back(counts); + parentCountsReference.push_back(countsRef); + } + ////////////////////////////////////////////////////////////////// + /////////////////////bulid Mut counts///////////////////////////// + //cout << "bulding mut counts" << endl; + //cout << hashes.size() << endl; + //cout << hashesRef.size() << endl; + for (int i = 0; i < hashes.size(); i++) { + // cout << i<< endl; + string hash = hashes[i]; + // cout << " hash = " << hash << endl; + string hashRef = hashesRef[i]; + // cout << "RefHash = " << hashRef << endl; + bool checkHash = true; + for (int j = 0; j < HashSize; j++) { + if (!(hash[j] == 'A' or hash[j] == 'C' or hash[j] == 'G' or hash[j] == 'T')) { + checkHash = false; + break; + } + } + // cout << "check hash = " << checkHash << endl; + if (checkHash) { + unsigned long int LongHash = HashToLong(hash); + if (MutantHashes.count(LongHash) > 0) { mutCounts.push_back(MutantHashes[LongHash]); } + else { mutCounts.push_back(0); } + + unsigned long int LongHashRef = HashToLong(hashRef); + if (MutantHashes.count(LongHashRef) > 0) { mutCountsRef.push_back(MutantHashes[LongHashRef]); } + else { mutCountsRef.push_back(0); } + } else { + mutCounts.push_back(-1); + mutCountsRef.push_back(-1); + } + } + ///////////////////////////////////////////////////////////////////// - ////////////////////write out vertical table///////////////////////// + ////////////////////write out vertical table///////////////////////// // cout << "writing hashes out vert" << endl; // for(int i =0; i < hashes.size(); i++) // { // cout << i+pos << "\t" << i << "\t" << hashes[i] << "\t" << varHash[i] << "\t" << PeakMap[i] << "\t" << (int) qual.c_str()[i]-33; -// cout << "\t" << "MutVar-" << mutCounts[i]; +// cout << "\t" << "MutVar-" << mutCounts[i]; // for (int j = 0; j < parentCounts.size(); j++) // { // cout << "\t" << parentCounts[j][i]; @@ -1561,307 +1425,297 @@ void SamRead::BuildUpHashCountTable() // cout << endl; // // } - //////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////// } -int SamRead::GetSupportingHashCount(int pos, string alt, string reff) -{ - int Count =0; - int lower = pos-HashSize; - if (lower < 0){lower =0;} - int upper = pos+alt.length()+reff.length();//-1; - // cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; - if (upper > MutRefCounts.size()){ - // cout << "this is going to break " << upper << " > " << MutRefCounts.size() << endl; - upper = MutRefCounts.size(); - } - for (int j = lower; j 0 and Hash[AltKmers[j]] > 0) - Count++; - else if (Hash.count(RevComp(AltKmers[j])) > 0 and Hash[RevComp(AltKmers[j])]) - Count++; - } - return Count; +int SamRead::GetSupportingHashCount(int pos, string alt, string reff) { + int Count = 0; + int lower = pos - HashSize; + if (lower < 0) { lower = 0; } + int upper = pos + alt.length() + reff.length();//-1; + // cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; + if (upper > MutRefCounts.size()) { + // cout << "this is going to break " << upper << " > " << MutRefCounts.size() << endl; + upper = MutRefCounts.size(); + } + + for (int j = lower; j < upper; j++) { + if (Hash.count(AltKmers[j]) > 0 and Hash[AltKmers[j]] > 0) + Count++; + else if (Hash.count(RevComp(AltKmers[j])) > 0 and Hash[RevComp(AltKmers[j])]) + Count++; + } + return Count; } -int PickDepthSomatic(vector Counts) -{ - cout << "using somatic depth, size of counts is " << Counts.size() < Counts) { + cout << "using somatic depth, size of counts is " << Counts.size() << endl; + double total = 0; + double sum = 0; + for (int i = 0; i < Counts.size(); i++) { + if (Counts[i] < Dist1XCutoff) { + total++; + sum += Counts[i]; } - //cout << "depth is = " << sum/total << endl; - double average = sum/total; - average = average +0.5; - return (int) average; -} -int PickDepth(vector Counts, int maxI) -{ - double maxD = -1; - int C = -1; - for (int i = 0; i < Counts.size(); i++) - { - int depth = Counts[i]; - if (depth > DistGlobal[maxI].size()){depth = DistGlobal[maxI].size();} - // //cout << "Count = " << Counts[i] << " depth = " << depth << " dist = " << DistGlobal[maxI][depth] ; - if (DistGlobal[maxI][depth] > maxD) - { - //cout << " found new depest"; - maxD = DistGlobal[maxI][depth]; - C = Counts[i]; - } - //cout << endl; + } + cout << "total under " << Dist1XCutoff << " is " << total << endl; + if (total == 0) { + cout << " there were none, summing all " << endl; + for (int i = 0; i < Counts.size(); i++) { + cout << " " << Counts[i] << endl; + total++; + sum += Counts[i]; } - return C; -} -string BayseanGenotyper(vector Counts, int& count, string VarNum) -{ - //for (int i =0; i < Counts.size(); i++){cout << Counts[i] << ", ";}cout << endl; - if (Counts.size() ==0) - { - // cout << "no counts, must be 0" << endl; - count = 0; - return ""; - } - - long double Pb = 0.0 ; - long double PbA = 0.0 ; - vector PA; - - int offset = 0; - vector sums; - for (int copy = 0+offset; copy < DistGlobal.size() ; copy ++) - { - long double sum = 0; - for (int j = 0; j DistGlobal[copy].size()){depth = DistGlobal[copy].size();} - sum+=DistGlobal[copy][depth]; - } - // if (sum > 1){cout << "WTF sum is greater than 1, oh wait sum can be greater than if we see the same kmer over and over " << sum << endl; } - sums.push_back(sum); - Pb += sum; - } - //cout << "Pb = " << Pb << endl; - //cout << "sums = "; - //for (int i =0; i < sums.size(); i++){cout << sums[i] << ", ";} cout << endl; + } + cout << "depth is = " << sum << " / " << total << " = " << sum / total << endl; + double average = sum / total; + // Round to nearest whole number + average = average + 0.5; + return (int) average; - vector PaB; - for (int i = 0; i < sums.size(); i++) - { - PaB.push_back((sums[i] * GenPrior[i]) / Pb); - } - - //cout << "P(A|B) = "; - //for (int i =0; i < PaB.size(); i++){cout << PaB[i] << ", ";} cout << endl; +} +int PickDepthAverage(vector Counts, int maxI) { + double maxD = -1; + int C = -1; + double sum = 0; + double total = 0; + for (int i = 0; i < Counts.size(); i++) { + int depth = Counts[i]; + if (depth > DistGlobal[maxI].size()) { depth = DistGlobal[maxI].size(); } + ////cout << "Count = " << Counts[i] << " depth = " << depth << " dist = " << DistGlobal[maxI][depth] ; + if (depth > DistLimitsGlobal[maxI][0] && depth < DistLimitsGlobal[maxI][1]) { + sum += depth; + total++; + //cout << " keeping"; + } + //cout << endl; - double max = -1; - int maxI =-1; - ////pick bets copy number dist - for (int i =0; i< PaB.size(); i++) - { - if (PaB[i] > max) - { - max = PaB[i]; - maxI = i; - } - } + } + //cout << "depth is = " << sum/total << endl; + double average = sum / total; + average = average + 0.5; + return (int) average; +} - ////pick best k, for now were going to fo the k with highest prob dist, not sure this is the best as it will skew counts towards expectations - //double maxD = -1; - //int C = -1; - //for (int i = 0; i < Counts.size(); i++) - //{ - // int depth = Counts[i]; - // if (depth > DistGlobal[maxI].size()){depth = DistGlobal[maxI].size();} - // cout << "Count = " << Counts[i] << " depth = " << depth << " dist = " << DistGlobal[maxI][depth] ; - // if (DistGlobal[maxI][depth] > maxD) - // { - // cout << " found new depest"; - // maxD = DistGlobal[maxI][depth]; - // C = Counts[i]; - // } - // cout << endl; - //} - int C; - if (maxI <=2) - C = PickDepthSomatic(Counts); - else - int C = PickDepthAverage(Counts, maxI); - - //int C = PickDepth(Counts, maxI); - ///////// - stringstream ss; - ss << max << "-" << maxI; - //cout << ss.str()<< "-boomba" << endl; - ss << " - C = " << C << endl; - - count = C; - //cout << ss.str() << endl; - - string g ; - if (maxI == 0) - {} - else if (maxI == 1) - { - cout << "no idea how this happened" << endl; - } - else if (maxI == 2) - { - g = VarNum; - } - else if (maxI > 2) - { - //will need to fix this when I fix model to show odd types - g = VarNum; - for (int i =0; i < (maxI -2) ; i++) - { - g = g+VarNum; - } - } -// cout << "bayesgeno is returing " << g << endl; - return g; +int PickDepth(vector Counts, int maxI) { + double maxD = -1; + int C = -1; + for (int i = 0; i < Counts.size(); i++) { + int depth = Counts[i]; + if (depth > DistGlobal[maxI].size()) { depth = DistGlobal[maxI].size(); } + // //cout << "Count = " << Counts[i] << " depth = " << depth << " dist = " << DistGlobal[maxI][depth] ; + if (DistGlobal[maxI][depth] > maxD) { + //cout << " found new depest"; + maxD = DistGlobal[maxI][depth]; + C = Counts[i]; + } + //cout << endl; + } + return C; } -string ParseGenotype(string alt, string ref) -{ - cout << "alt = " << alt << " with size = " << alt.length() << " or " << alt.size() << " and ref = " << ref << " with size = " << ref.length() << " or " << ref.size() << endl; - string newG = ""; - if (ref == "") - {} - else if (ref.length()==0) - {} - else - { - newG+=ref.c_str()[0]; - for (int i = 1; i < ref.length(); i++) - { - newG+= "/" ; - newG+= "0";//ref.c_str()[i]; - } - } - - if (alt == "") - {} - else if (alt.length()==0) - {} - else - { - if (newG.length()>0) - newG+= "/"; - newG+=alt.c_str()[0]; - for (int i=1; i < alt.length(); i++) - { - newG+= "/"; - newG+= alt.c_str()[i]; - } - } - if (newG == ""){newG = ".";} - return newG; + +string BayseanGenotyper(vector Counts, int &count, string VarNum) { + //for (int i =0; i < Counts.size(); i++){cout << Counts[i] << ", ";}cout << endl; + if (Counts.size() == 0) { + // cout << "no counts, must be 0" << endl; + count = 0; + return ""; + } + + long double Pb = 0.0; + long double PbA = 0.0; + vector PA; + + int offset = 0; + vector sums; + for (int copy = 0 + offset; copy < DistGlobal.size(); copy++) { + long double sum = 0; + for (int j = 0; j < Counts.size(); j++) { + int depth = Counts[j]; + if (depth > DistGlobal[copy].size()) { depth = DistGlobal[copy].size(); } + sum += DistGlobal[copy][depth]; + } + // if (sum > 1){cout << "WTF sum is greater than 1, oh wait sum can be greater than if we see the same kmer over and over " << sum << endl; } + sums.push_back(sum); + Pb += sum; + } + //cout << "Pb = " << Pb << endl; + //cout << "sums = "; + //for (int i =0; i < sums.size(); i++){cout << sums[i] << ", ";} cout << endl; + + + vector PaB; + for (int i = 0; i < sums.size(); i++) { + PaB.push_back((sums[i] * GenPrior[i]) / Pb); + } + + //cout << "P(A|B) = "; + //for (int i =0; i < PaB.size(); i++){cout << PaB[i] << ", ";} cout << endl; + + + double max = -1; + int maxI = -1; + ////pick best copy number dist + for (int i = 0; i < PaB.size(); i++) { + if (PaB[i] > max) { + max = PaB[i]; + maxI = i; + } + } + + ////pick best k, for now were going to fo the k with highest prob dist, not sure this is the best as it will skew counts towards expectations + //double maxD = -1; + //int C = -1; + //for (int i = 0; i < Counts.size(); i++) + //{ + // int depth = Counts[i]; + // if (depth > DistGlobal[maxI].size()){depth = DistGlobal[maxI].size();} + // cout << "Count = " << Counts[i] << " depth = " << depth << " dist = " << DistGlobal[maxI][depth] ; + // if (DistGlobal[maxI][depth] > maxD) + // { + // cout << " found new depest"; + // maxD = DistGlobal[maxI][depth]; + // C = Counts[i]; + // } + // cout << endl; + //} + int C; + if (maxI <= 2) + C = PickDepthSomatic(Counts); // todo: this version is definitely getting called + else + int C = PickDepthAverage(Counts, maxI); + + //int C = PickDepth(Counts, maxI); + ///////// + stringstream ss; + ss << max << "-" << maxI; + //cout << ss.str()<< "-boomba" << endl; + ss << " - C = " << C << endl; + + count = C; + //cout << ss.str() << endl; + + string g; + if (maxI == 0) {} + else if (maxI == 1) { + cout << "no idea how this happened" << endl; + } else if (maxI == 2) { + g = VarNum; + } else if (maxI > 2) { + //will need to fix this when I fix model to show odd types + g = VarNum; + for (int i = 0; i < (maxI - 2); i++) { + g = g + VarNum; + } + } +// cout << "bayesgeno is returing " << g << endl; + return g; } -double GetModes3(int pos, string alt, string reff, vector RefCounts, vector AltCounts, vector AltKmers, vector RefKmers, vector &HashCounts, int &PossibleVarKmer, string& genotype, int& refCount, int& altCount) -{ - int lower = pos - HashSize+1; - if (lower < 0){lower =0;} - int upper = pos + alt.length()+reff.length()-1; - //cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; - if (upper > RefCounts.size()){ - cout << "this is going to break " << upper << " > " << RefCounts.size() << endl; - upper = RefCounts.size(); + +string ParseGenotype(string alt, string ref) { + cout << "alt = " << alt << " with size = " << alt.length() << " or " << alt.size() << " and ref = " << ref + << " with size = " << ref.length() << " or " << ref.size() << endl; + string newG = ""; + if (ref == "") {} + else if (ref.length() == 0) {} + else { + newG += ref.c_str()[0]; + for (int i = 1; i < ref.length(); i++) { + newG += "/"; + newG += "0";//ref.c_str()[i]; } - - vector varMutRefCounts; - vector varMutAltCounts; - vector temp; - string nonspecific = "nonspecific"; - string LastAtlKmer = "boomba"; - //cout << "lower = " << lower << " upper = " << upper << endl; - for (int j = lower; j0 and AltKmers[j] != RefKmers[j]) - varMutRefCounts.push_back(RefCounts[j]); - if (AltCounts[j]>0 and AltKmers[j] != RefKmers[j] and (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and (ExcludeHashes[HashToLong(AltKmers[j])]<1 && ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<1)) - varMutAltCounts.push_back(AltCounts[j]); - - //////This is for the infro field, better make sure the mut is the last one calculated //////////// - if (Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j]) - HashCounts.push_back(Hash[AltKmers[j]]); - else if (Hash[RevComp(AltKmers[j])] > 0 and AltKmers[j] != RefKmers[j]) - HashCounts.push_back(Hash[RevComp(AltKmers[j])]); - else - HashCounts.push_back(-1); - ////////////////////////////////////////////////////////////////////////////////////////////////// + } + + if (alt == "") {} + else if (alt.length() == 0) {} + else { + if (newG.length() > 0) + newG += "/"; + newG += alt.c_str()[0]; + for (int i = 1; i < alt.length(); i++) { + newG += "/"; + newG += alt.c_str()[i]; } - sort (varMutRefCounts.begin(), varMutRefCounts.end()); - sort (varMutAltCounts.begin(), varMutAltCounts.end()); + } + if (newG == "") { newG = "."; } + return newG; +} + +// SJG todo: this is super dumb, make a struct and return int values, instead of passing pointers +// todo: why is this a stand alone function and other iterations are struct methods? +// HashCounts here is the count per kmer from the original hashlist file e.g. COLO829T_Ill_200X.bam.generator.k25_c5.HashList +double GetModes3(int pos, string alt, string reff, vector RefCounts, vector AltCounts, + vector AltKmers, vector RefKmers, vector &HashCounts, int &PossibleVarKmer, + string &genotype, int &refCount, int &altCount) { + int lower = pos - HashSize + 1; + if (lower < 0) { lower = 0; } + int upper = pos + alt.length() + reff.length() - 1; + //cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; + if (upper > RefCounts.size()) { + cout << "this is going to break " << upper << " > " << RefCounts.size() << endl; + upper = RefCounts.size(); + } + + vector varMutRefCounts; + vector varMutAltCounts; + vector temp; + string nonspecific = "nonspecific"; + string LastAtlKmer = "boomba"; + //cout << "lower = " << lower << " upper = " << upper << endl; + for (int j = lower; j < upper; j++) { + // cout << j << " " << AltKmers[j] << " " << RefKmers[j] << " " << AltCounts[j] << " " << RefCounts[j] << endl; + if (AltKmers[j] != RefKmers[j] and + (ExcludeHashes[HashToLong(AltKmers[j])] < 1 && ExcludeHashes[HashToLong(RevComp(AltKmers[j]))] < 1) and + AltKmers[j] != LastAtlKmer) { PossibleVarKmer++; } /////count the number of candidate kmers for later use + + LastAtlKmer = AltKmers[j]; + + if (RefCounts[j] > 0 and AltKmers[j] != RefKmers[j]) + varMutRefCounts.push_back(RefCounts[j]); + + // todo: if altCounts > 0 and (altCount is kmer or revComp made from contigs or exist in the reference) + // altKmer seq DNE refKmer and + // hash counts of either kmer or reverse complement > 0 (e.g. from COLO829T_Ill_200X.bam.generator.k25_c5.HashList) + // and neither kmer is in the exclude hash list + if (AltCounts[j] > 0 and AltKmers[j] != RefKmers[j] and + (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and + (ExcludeHashes[HashToLong(AltKmers[j])] < 1 && ExcludeHashes[HashToLong(RevComp(AltKmers[j]))] < 1)) + varMutAltCounts.push_back(AltCounts[j]); + + //////This is for the info field, better make sure the mut is the last one calculated //////////// + // todo: HashCounts is what gets put into HD= INFO field + if (Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j]) + HashCounts.push_back(Hash[AltKmers[j]]); + else if (Hash[RevComp(AltKmers[j])] > 0 and AltKmers[j] != RefKmers[j]) + HashCounts.push_back(Hash[RevComp(AltKmers[j])]); + else + HashCounts.push_back(-1); // todo: why would kmer not exist in original table? - kmers are slightly modified here + ////////////////////////////////////////////////////////////////////////////////////////////////// + } + sort(varMutRefCounts.begin(), varMutRefCounts.end()); + sort(varMutAltCounts.begin(), varMutAltCounts.end()); // cout << "Calculating alt genotpey bayesway" << endl; - string AltGenotype = BayseanGenotyper(varMutAltCounts, altCount, "1"); +// todo: this is where altCount is assigned - seems to be average not mode + // Takes in an array of counts for kmers that are unique to the subject that exist in the contig and the original hash, and not in the exclude list + string AltGenotype = BayseanGenotyper(varMutAltCounts, altCount, "1"); // cout << "BayesGeno returned for alt " << altCount << " and " << AltGenotype << endl; // cout << "Calculating Reg genotype bayesway" << endl; - string RefGenotype = BayseanGenotyper(varMutRefCounts, refCount, "0"); + string RefGenotype = BayseanGenotyper(varMutRefCounts, refCount, "0"); //cout << "BayesGeno returned for ref " << refCount << " and " << RefGenotype << endl; // cout << "done with bayesway " << endl; ; - - genotype = ParseGenotype(AltGenotype, RefGenotype); - - double something; - return something; + genotype = ParseGenotype(AltGenotype, RefGenotype); + + + double something; + return something; } + /*void SamRead::GetModes2(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &HashCounts, int &PossibleVarKmer) { int lower = pos-HashSize+1; @@ -1873,7 +1727,7 @@ double GetModes3(int pos, string alt, string reff, vector RefCounts, upper = MutRefCounts.size(); } - //////////////chekcing allele frequencies /////////// + //////////////chekcing allele frequencies /////////// //vector HashCountsOG; vector varMutRefCounts; vector varMutAltCounts; @@ -1884,14 +1738,14 @@ double GetModes3(int pos, string alt, string reff, vector RefCounts, { if ( AltKmers[j] != RefKmers[j] and (ExcludeHashes[HashToLong(AltKmers[j])]<1 && ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<1) and AltKmers[j] != LastAtlKmer) {PossibleVarKmer++;} /////count the number of candidate kmers for later use - - LastAtlKmer = AltKmers[j]; - - if(MutRefCounts[j]>0 and AltKmers[j] != RefKmers[j]) + + LastAtlKmer = AltKmers[j]; + + if(MutRefCounts[j]>0 and AltKmers[j] != RefKmers[j]) varMutRefCounts.push_back(MutRefCounts[j]); - if (MutAltCounts[j]>0 and AltKmers[j] != RefKmers[j] and (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and (ExcludeHashes[HashToLong(AltKmers[j])]<1 && ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<1)) + if (MutAltCounts[j]>0 and AltKmers[j] != RefKmers[j] and (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and (ExcludeHashes[HashToLong(AltKmers[j])]<1 && ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<1)) varMutAltCounts.push_back(MutAltCounts[j]); - + //////This is for the infro field, better make sure the mut is the last one calculated //////////// if (Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j]) HashCounts.push_back(Hash[AltKmers[j]]); @@ -1904,87 +1758,98 @@ double GetModes3(int pos, string alt, string reff, vector RefCounts, sort (varMutRefCounts.begin(), varMutRefCounts.end()); sort (varMutAltCounts.begin(), varMutAltCounts.end()); - - + + /////////////////////////////////////////////// - cout << "Calculating alt genotpey bayesway" << endl; + cout << "Calculating alt genotpey bayesway" << endl; string AltGenotype = BayseanGenotyper(varMutAltCounts); - cout << "Calculating Reg genotype bayesway" << endl; + cout << "Calculating Reg genotype bayesway" << endl; string RegGenotype = BayseanGenotyper(varMutRefCounts); - cout << "done with bayesway"; + cout << "done with bayesway"; }*/ -void SamRead::GetModes(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &ParRefModes, vector &ParAltModes, vector &HashCounts, vector &HashCountsOG, int &PossibleVarKmer) -{ - int lower = pos-HashSize+1; - if (lower < 0){lower =0;} - int upper = pos+alt.length()+reff.length()-1; - //cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; - if (upper > MutRefCounts.size()){ - cout << "this is going to break " << upper << " > " << MutRefCounts.size() << endl; - upper = MutRefCounts.size(); - } - - //////////////chekcing allele frequencies /////////// - //vector HashCountsOG; - vector varMutRefCounts; - vector varMutAltCounts; - vector> varParRefCounts; - vector> varParAltCounts; - vector temp; - for(int pi = 0; pi freqs; - //cout << "checking NonSpecic Kmers"; - string LastAtlKmer = "boomba"; - for (int j = lower; j0 and AltKmers[j] != RefKmers[j] and MutRefCounts[j] < 400 )//and (ExcludeHashes[HashToLong(RefKmers[j])]<2 or ExcludeHashes[HashToLong(RevComp(RefKmers[j]))]<2)) //needs to be fixed, should be based on cov not cutoff of 400 - varMutRefCounts.push_back(MutRefCounts[j]); - if (MutAltCounts[j]>0 and AltKmers[j] != RefKmers[j] and MutAltCounts[j] < 400 and (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and (ExcludeHashes[HashToLong(AltKmers[j])]<1 && ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<1)) //needs to be fixed, should be based on cov not cutoff of 400 - varMutAltCounts.push_back(MutAltCounts[j]); - - for (int pi=0; pi < varParRefCounts.size(); pi++){ - if (ParRefCounts[pi][j] >0 and AltKmers[j] != RefKmers[j] and ParRefCounts[pi][j] <400)// and (ExcludeHashes[HashToLong(AltKmers[j])]<2 or ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<2)) //needs to be fixed, should be based on cov not cutoff of 400 - varParRefCounts[pi].push_back(ParRefCounts[pi][j]); - if (ParAltCounts[pi][j] >0 and AltKmers[j] != RefKmers[j] and ParAltCounts[pi][j] < 400 and (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and (ExcludeHashes[HashToLong(RefKmers[j])]<1 && ExcludeHashes[HashToLong(RevComp(RefKmers[j]))]<1)) //needs to be fixed, should be based on cov not cutoff of 400 - varParAltCounts[pi].push_back(ParAltCounts[pi][j]); +void SamRead::GetModes(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &ParRefModes, + vector &ParAltModes, vector &HashCounts, vector &HashCountsOG, + int &PossibleVarKmer) { + // todo: what are these bounds? + int lower = pos - HashSize + 1; + if (lower < 0) { lower = 0; } + int upper = pos + alt.length() + reff.length() - 1; + //cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; + if (upper > MutRefCounts.size()) { + cout << "this is going to break " << upper << " > " << MutRefCounts.size() << endl; + upper = MutRefCounts.size(); + } + + //////////////checking allele frequencies /////////// + //vector HashCountsOG; + vector varMutRefCounts; + vector varMutAltCounts; + vector > varParRefCounts; + vector > varParAltCounts; + vector temp; + // Initialize empty vector for each parent + for (int pi = 0; pi < ParentHashes.size(); pi++) { + varParRefCounts.push_back(temp); + varParAltCounts.push_back(temp); + } + string nonspecific = "nonspecific"; + //vector freqs; + //cout << "checking NonSpecic Kmers"; + string LastAtlKmer = "boomba"; + for (int j = lower; j < upper; j++) { + // cout << AltKmers[j] << endl << RefKmers[j] < 0 and AltKmers[j] != RefKmers[j] and MutRefCounts[j] < + 400)//and (ExcludeHashes[HashToLong(RefKmers[j])]<2 or ExcludeHashes[HashToLong(RevComp(RefKmers[j]))]<2)) //needs to be fixed, should be based on cov not cutoff of 400 + varMutRefCounts.push_back(MutRefCounts[j]); + if (MutAltCounts[j] > 0 and AltKmers[j] != RefKmers[j] and MutAltCounts[j] < 400 and + (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and + (ExcludeHashes[HashToLong(AltKmers[j])] < 1 && ExcludeHashes[HashToLong(RevComp(AltKmers[j]))] < + 1)) //needs to be fixed, should be based on cov not cutoff of 400 + varMutAltCounts.push_back(MutAltCounts[j]); + + for (int pi = 0; pi < varParRefCounts.size(); pi++) { + if (ParRefCounts[pi][j] > 0 and AltKmers[j] != RefKmers[j] and ParRefCounts[pi][j] < + 400)// and (ExcludeHashes[HashToLong(AltKmers[j])]<2 or ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<2)) //needs to be fixed, should be based on cov not cutoff of 400 + varParRefCounts[pi].push_back(ParRefCounts[pi][j]); + if (ParAltCounts[pi][j] > 0 and AltKmers[j] != RefKmers[j] and ParAltCounts[pi][j] < 400 and + (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and + (ExcludeHashes[HashToLong(RefKmers[j])] < 1 && ExcludeHashes[HashToLong(RevComp(RefKmers[j]))] < + 1)) //needs to be fixed, should be based on cov not cutoff of 400 + varParAltCounts[pi].push_back(ParAltCounts[pi][j]); - } + } - if (Hash.count(AltKmers[j]) > 0 and Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j] ) - HashCountsOG.push_back(Hash[AltKmers[j]]); - else if (Hash.count(RevComp(AltKmers[j])) > 0 and Hash[RevComp(AltKmers[j])] and AltKmers[j] != RefKmers[j] ) - HashCountsOG.push_back(Hash[RevComp(AltKmers[j])]); - - - if (Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j]) - HashCounts.push_back(Hash[AltKmers[j]]); - else if (Hash[RevComp(AltKmers[j])] > 0 and AltKmers[j] != RefKmers[j]) - HashCounts.push_back(Hash[RevComp(AltKmers[j])]); - else - HashCounts.push_back(-1); - } - // float freq = 0; - // if (freqs.size() > 0){ - // for (int i =0; i 0 and Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j]) + HashCountsOG.push_back(Hash[AltKmers[j]]); + else if (Hash.count(RevComp(AltKmers[j])) > 0 and Hash[RevComp(AltKmers[j])] and AltKmers[j] != RefKmers[j]) + HashCountsOG.push_back(Hash[RevComp(AltKmers[j])]); + + + if (Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j]) + HashCounts.push_back(Hash[AltKmers[j]]); + else if (Hash[RevComp(AltKmers[j])] > 0 and AltKmers[j] != RefKmers[j]) + HashCounts.push_back(Hash[RevComp(AltKmers[j])]); + else + HashCounts.push_back(-1); + } + // float freq = 0; + // if (freqs.size() > 0){ + // for (int i =0; i<><><><>MutRef<><><><><><>" << endl ; for (int s =0; s<><><><>MutRefSorted<><><><><><>" << endl ; for (int s =0; s<><><><>Ref" << pi << "<><><><><<><>" << endl; for (int s =0; s1) - //MutRefMode = varMutRefCounts[0]; - MutRefMode = varMutRefCounts[(varMutRefCounts.size())/2]; //// switch this for line above to get the mode, right now were taking the min - else if (varMutRefCounts.size() ==1) - MutRefMode = varMutRefCounts[0]; - else - MutRefMode = 0; - if (varMutAltCounts.size() >1) - // MutAltMode = varMutAltCounts[0]; - MutAltMode= varMutAltCounts[(varMutAltCounts.size()-2)/2]; //// switch this for line above to get the mode, right now were taking the min - else if (varMutAltCounts.size() ==1) - MutAltMode = varMutAltCounts[0]; - else - MutAltMode=0; - for(int pi = 0; pi1) - //ParRefModes.push_back(varParRefCounts[pi][0]); - ParRefModes.push_back(varParRefCounts[pi][((varParRefCounts[pi].size())/2)]); //// switch this for line above to get the mode, right now were taking the min - else if (varParRefCounts[pi].size() ==1) - ParRefModes.push_back(varParRefCounts[pi][0]); - else - ParRefModes.push_back( 0); - } - for(int pi =0; pi1) - //ParAltModes.push_back(varParAltCounts[pi][0]); - ParAltModes.push_back(varParAltCounts[pi][((varParAltCounts[pi].size())/2)]); //// switch this for line above to get the mode, right now were taking the min - else if (varParAltCounts[pi].size()==1) - ParAltModes.push_back(varParAltCounts[pi][0]); - else - ParAltModes.push_back( 0); - } +*/ } + /////////////////////////////////////////////// + if (varMutRefCounts.size() > 1) + //MutRefMode = varMutRefCounts[0]; + MutRefMode = varMutRefCounts[(varMutRefCounts.size()) / + 2]; //// switch this for line above to get the mode, right now were taking the min + else if (varMutRefCounts.size() == 1) + MutRefMode = varMutRefCounts[0]; + else + MutRefMode = 0; + if (varMutAltCounts.size() > 1) + // MutAltMode = varMutAltCounts[0]; + MutAltMode = varMutAltCounts[(varMutAltCounts.size() - 2) / + 2]; //// switch this for line above to get the mode, right now were taking the min + else if (varMutAltCounts.size() == 1) + MutAltMode = varMutAltCounts[0]; + else + MutAltMode = 0; + for (int pi = 0; pi < varParRefCounts.size(); pi++) { + if (varParRefCounts[pi].size() > 1) + //ParRefModes.push_back(varParRefCounts[pi][0]); + ParRefModes.push_back(varParRefCounts[pi][((varParRefCounts[pi].size()) / + 2)]); //// switch this for line above to get the mode, right now were taking the min + else if (varParRefCounts[pi].size() == 1) + ParRefModes.push_back(varParRefCounts[pi][0]); + else + ParRefModes.push_back(0); + } + for (int pi = 0; pi < varParAltCounts.size(); pi++) { + if (varParAltCounts[pi].size() > 1) + //ParAltModes.push_back(varParAltCounts[pi][0]); + ParAltModes.push_back(varParAltCounts[pi][((varParAltCounts[pi].size()) / + 2)]); //// switch this for line above to get the mode, right now were taking the min + else if (varParAltCounts[pi].size() == 1) + ParAltModes.push_back(varParAltCounts[pi][0]); + else + ParAltModes.push_back(0); + } } -void SamRead::CountAlignmentSegmentsCigar() -{ - AlignmentSegmentsCigar = 0; - char last = cigar.c_str()[0]; - for (int i =1; i < cigar.size(); i++) - { - if (cigar.c_str()[i] == 'M' or cigar.c_str()[i] == 'S' or cigar.c_str()[i] == 'H' or cigar.c_str()[i] == 'D' or cigar.c_str()[i] == 'I') - {} - else if (last == 'M' or last == 'S' or last == 'H' or last == 'I' or last == 'D') - { - AlignmentSegmentsCigar++; - } - last = cigar.c_str()[i]; - } - if (last == 'M' or last == 'S' or last == 'H' or last == 'I' or last == 'D') - { - AlignmentSegmentsCigar++; - } + +// todo: only place where cigar vs cigarString used (other than writing out fxns) +void SamRead::CountAlignmentSegmentsCigar() { + AlignmentSegmentsCigar = 0; + char last = cigar.c_str()[0]; + for (int i = 1; i < cigar.size(); i++) { + if (cigar.c_str()[i] == 'M' or cigar.c_str()[i] == 'S' or cigar.c_str()[i] == 'H' or cigar.c_str()[i] == 'D' or + cigar.c_str()[i] == 'I') {} + else if (last == 'M' or last == 'S' or last == 'H' or last == 'I' or last == 'D') { + AlignmentSegmentsCigar++; + } + last = cigar.c_str()[i]; + } + if (last == 'M' or last == 'S' or last == 'H' or last == 'I' or last == 'D') { + AlignmentSegmentsCigar++; + } } -void SamRead::CountAlignmentSegments() -{ - AlignmentSegments = 0; - char last = cigarString.c_str()[0]; - for (int i =1; i < cigarString.size(); i++) - { - if (cigarString.c_str()[i] == 'M') - {} - else if (last == 'M') - { - AlignmentSegments++; - } - last = cigarString.c_str()[i]; - } - if (last == 'M') - { - AlignmentSegments++; - } + +void SamRead::CountAlignmentSegments() { + AlignmentSegments = 0; + char last = cigarString.c_str()[0]; + for (int i = 1; i < cigarString.size(); i++) { + if (cigarString.c_str()[i] == 'M') {} + else if (last == 'M') { + AlignmentSegments++; + } + last = cigarString.c_str()[i]; + } + if (last == 'M') { + AlignmentSegments++; + } } -int SamRead::CheckParentCov(int &mode) -{ - bool good = true; - int lowC = 0; - vector cov; - for (int pi = 0; pi < ParRefCounts.size(); pi++){ - for (int i = 0; i < ParRefCounts[pi].size(); i++){ - if (RefKmers[i] != ""){ - int ParRef = 0; - int ParAlt = 0; - if (ParAltCounts[pi][i] > 0) - ParAlt = ParAltCounts[pi][i]; - if (ParRefCounts[pi][i] > 0) - ParRef = ParRefCounts[pi][i]; - cov.push_back(ParRef+ParAlt); - if (ParRef+ParAlt > 0 && ParRef+ParAlt < 10) - lowC++; - } - } - } - if(cov.size()>1){ - - sort (cov.begin(), cov.end()); - mode = cov[cov.size()/2]; - } - else - mode = -1; - return lowC; +int SamRead::CheckParentCov(int &mode) { + bool good = true; + int lowC = 0; + vector cov; + for (int pi = 0; pi < ParRefCounts.size(); pi++) { + for (int i = 0; i < ParRefCounts[pi].size(); i++) { + if (RefKmers[i] != "") { + int ParRef = 0; + int ParAlt = 0; + if (ParAltCounts[pi][i] > 0) + ParAlt = ParAltCounts[pi][i]; + if (ParRefCounts[pi][i] > 0) + ParRef = ParRefCounts[pi][i]; + cov.push_back(ParRef + ParAlt); + if (ParRef + ParAlt > 0 && ParRef + ParAlt < 10) + lowC++; + } + } + } + if (cov.size() > 1) { + + sort(cov.begin(), cov.end()); + mode = cov[cov.size() / 2]; + } else + mode = -1; + + return lowC; } -void SamRead::flipRead() -{ +void SamRead::flipRead() { // cout <<"FLIPPING reads not on the same strand"; -// write(); - string FlipSeq = "" ; - string FlipQual = "" ; - string FlipRefSeq = ""; - string FlipCigarString = ""; - string FlipStrand = ""; - string FlipclipPattern=""; - vector FlipPeakMap ; - vector FlipPos; - vector FlipChrPos; - for (int i = seq.size() -1; i >=0; i--) - { - // FlipSeq += seq.c_str()[i]; - FlipQual += qual.c_str()[i]; - // FlipRefSeq += RefSeq.c_str()[i]; - FlipCigarString += cigarString.c_str()[i]; - FlipStrand += '-'; - FlipPos.push_back(Positions[i]); - FlipChrPos.push_back(ChrPositions[i]); - FlipPeakMap.push_back(PeakMap[i]); - } - FlipSeq = RevComp(seq); - FlipRefSeq = RevComp(RefSeq); - - seq = FlipSeq; - qual = FlipQual; - RefSeq = FlipRefSeq; - cigarString = FlipCigarString; - strand = FlipStrand; - Positions = FlipPos; - ChrPositions = FlipChrPos; - PeakMap=FlipPeakMap; - for (int i = clipPattern.size()-1; i >=0; i--) - { - FlipclipPattern += clipPattern.c_str()[i]; - } - clipPattern = FlipclipPattern; -// write(); - +// write(); + string FlipSeq = ""; + string FlipQual = ""; + string FlipRefSeq = ""; + string FlipCigarString = ""; + string FlipStrand = ""; + string FlipclipPattern = ""; + vector FlipPeakMap; + vector FlipPos; + vector FlipChrPos; + for (int i = seq.size() - 1; i >= 0; i--) { + // FlipSeq += seq.c_str()[i]; + FlipQual += qual.c_str()[i]; + // FlipRefSeq += RefSeq.c_str()[i]; + FlipCigarString += cigarString.c_str()[i]; + FlipStrand += '-'; + FlipPos.push_back(Positions[i]); + FlipChrPos.push_back(ChrPositions[i]); + FlipPeakMap.push_back(PeakMap[i]); + } + FlipSeq = RevComp(seq); + FlipRefSeq = RevComp(RefSeq); + + seq = FlipSeq; + qual = FlipQual; + RefSeq = FlipRefSeq; + cigarString = FlipCigarString; + strand = FlipStrand; + Positions = FlipPos; + ChrPositions = FlipChrPos; + PeakMap = FlipPeakMap; + for (int i = clipPattern.size() - 1; i >= 0; i--) { + FlipclipPattern += clipPattern.c_str()[i]; + } + clipPattern = FlipclipPattern; +// write(); + } -void SamRead::processMultiAlignment() -{ - //check if this is a mis-joined contig +void SamRead::processMultiAlignment() { + //check if this is a mis-joined contig } -void SamRead::write() -{ - cout << name << endl; - cout << " parsed= " << parsed << endl; - cout << " flag = " << flag << endl; - cout << " mapQual = " << mapQual << endl; - cout << " Strand = " << GetReadOrientation(flag) << endl; - cout << " Alignments = " << alignments.size() << endl; - cout << " SVeventID = " << SVeventid << endl; - cout << " MobAligned = " << MobAligned << endl; - cout << " MobContig = " << MobContig << endl; - cout << " MobAS = " << MobAS << endl; - cout << " AllA = " << AllA << endl; - cout << " isSplitRead = " << isSplitRead << endl; - cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - cout << " clip = " << clipPattern << endl; - cout << " cigar = " << cigar << endl; - cout << " Seq = " << seq << endl; - cout << " Qual = " << qual << endl; - cout << " Cigar = " << cigarString << endl; - cout << " RefSeq = " << RefSeq << endl; - cout << " strand = " << strand << endl; - cout << " PeakMap = "; - for (int i =0; i < PeakMap.size(); i++) - {cout << PeakMap[i]; } - cout << endl; - cout << " RefPositions: "; - for (int i =0; i < Positions.size(); i++) - cout << Positions[i] << " \t"; - cout << endl; - cout << " RefChromoso: "; - for (int i =0; i < ChrPositions.size(); i++) - cout << ChrPositions[i] << " \t"; - cout << endl; - + +void SamRead::write() { + cout << name << endl; + cout << " parsed= " << parsed << endl; + cout << " flag = " << flag << endl; + cout << " mapQual = " << mapQual << endl; + cout << " Strand = " << GetReadOrientation(flag) << endl; + cout << " Alignments = " << alignments.size() << endl; + cout << " SVeventID = " << SVeventid << endl; + cout << " MobAligned = " << MobAligned << endl; + cout << " MobContig = " << MobContig << endl; + cout << " MobAS = " << MobAS << endl; + cout << " AllA = " << AllA << endl; + cout << " isSplitRead = " << isSplitRead << endl; + cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; + cout << " clip = " << clipPattern << endl; + cout << " cigar = " << cigar << endl; + cout << " Seq = " << seq << endl; + cout << " Qual = " << qual << endl; + cout << " Cigar = " << cigarString << endl; + cout << " RefSeq = " << RefSeq << endl; + cout << " strand = " << strand << endl; + cout << " PeakMap = "; + for (int i = 0; i < PeakMap.size(); i++) { cout << PeakMap[i]; } + cout << endl; + cout << " RefPositions: "; + for (int i = 0; i < Positions.size(); i++) + cout << Positions[i] << " \t"; + cout << endl; + cout << " RefChromoso: "; + for (int i = 0; i < ChrPositions.size(); i++) + cout << ChrPositions[i] << " \t"; + cout << endl; + } -void SamRead::writetofile(ofstream &out) -{ - out << name << endl; - out << " flag = " << flag << endl; - out << " mapQual = " << mapQual << endl; - out << " Strand = " << GetReadOrientation(flag) << endl; - out << " Alignments = " << alignments.size() << endl; - out << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - out << " AlignScore = " << AlignScore << endl; - out << " clip = " << clipPattern << endl; - out << " cigar = " << cigar << endl; - out << " Seq = " << seq << endl; - out << " Qual = " << qual << endl; - out << " Cigar = " << cigarString << endl; - out << " RefSeq = " << RefSeq << endl; - out << " PeakMap= "; - for (int i =0; i < PeakMap.size(); i++) - { - out << PeakMap[i] ; - } - out << endl; - out << " PMSize = " << PeakMap.size() << endl; +void SamRead::writetofile(ofstream &out) { + + out << name << endl; + out << " flag = " << flag << endl; + out << " mapQual = " << mapQual << endl; + out << " Strand = " << GetReadOrientation(flag) << endl; + out << " Alignments = " << alignments.size() << endl; + out << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; + out << " AlignScore = " << AlignScore << endl; + out << " clip = " << clipPattern << endl; + out << " cigar = " << cigar << endl; + out << " Seq = " << seq << endl; + out << " Qual = " << qual << endl; + out << " Cigar = " << cigarString << endl; + out << " RefSeq = " << RefSeq << endl; + out << " PeakMap= "; + for (int i = 0; i < PeakMap.size(); i++) { + out << PeakMap[i]; + } + out << endl; + out << " PMSize = " << PeakMap.size() << endl; } -void SamRead::writeVertical() -{ - cout << "ParentHashes size = " << ParentHashes.size() << "ParAltCounts size " << ParAltCounts.size() << endl; - cout << name << endl; - cout << " flag = " << flag << endl; - cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - cout << " clip = " << clipPattern << endl; - cout << " cigar = " << cigar << endl; - cout << " Alignments = " << alignments.size() << endl; - cout << " AlignScore = " << AlignScore << endl; - for (int i =0; i < seq.size(); i++){ - - cout << seq.c_str()[i] << "\t" << qual.c_str()[i] << "\t" << cigarString.c_str()[i] << "\t" << RefSeq.c_str()[i] << "\t" << ChrPositions[i] << "\t" << Positions[i] << "\t" << MutAltCounts[i] << "\t" << MutRefCounts[i] << "\t" << MutHashListCounts[i] << "\t" ; - cout << "\tParents"; - for (int pi=0; pi < ParAltCounts.size(); pi++){ - cout << "\t" << ParAltCounts[pi][i] << "\t" << ParRefCounts[pi][i]; - } - cout << "\t" << RefKmers[i] << "\t" << AltKmers[i]; - cout<< endl; - } +void SamRead::writeVertical() { + cout << "ParentHashes size = " << ParentHashes.size() << "ParAltCounts size " << ParAltCounts.size() << endl; + cout << name << endl; + cout << " flag = " << flag << endl; + cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; + cout << " clip = " << clipPattern << endl; + cout << " cigar = " << cigar << endl; + cout << " Alignments = " << alignments.size() << endl; + cout << " AlignScore = " << AlignScore << endl; + for (int i = 0; i < seq.size(); i++) { + + cout << seq.c_str()[i] << "\t" << qual.c_str()[i] << "\t" << cigarString.c_str()[i] << "\t" << RefSeq.c_str()[i] + << "\t" << ChrPositions[i] << "\t" << Positions[i] << "\t" << MutAltCounts[i] << "\t" << MutRefCounts[i] + << "\t" << MutHashListCounts[i] << "\t"; + cout << "\tParents"; + for (int pi = 0; pi < ParAltCounts.size(); pi++) { + cout << "\t" << ParAltCounts[pi][i] << "\t" << ParRefCounts[pi][i]; + } + cout << "\t" << RefKmers[i] << "\t" << AltKmers[i]; + cout << endl; + } } -void SamRead::CheckPhase() -{ -// cout << "Checking Phasing" << endl; + +void SamRead::CheckPhase() { +// cout << "Checking Phasing" << endl; // cout << "ParentHashes size = " << ParentHashes.size() << " ParAltCounts size " << ParAltCounts.size() << endl; // cout << name << endl; // cout << " flag = " << flag << endl; @@ -2268,235 +2122,201 @@ void SamRead::CheckPhase() // cout << " cigar = " << cigar << endl; // cout << " Alignments = " << alignments.size() << endl; // cout << " AlignScore = " << AlignScore << endl; - //write(); - vector phased ; - phased.push_back(0); - phased.push_back(0); - for (int i =0; i < seq.size(); i++) - { - // cout << seq.c_str()[i] << "\t" << qual.c_str()[i] << "\t" << cigarString.c_str()[i] << "\t" << RefSeq.c_str()[i] << "\t" << ChrPositions[i] << "\t" << Positions[i] << "\tMutContigCounts=" << MutContigCounts[i] << "\t" << MutAltCounts[i] << "\t" << MutRefCounts[i] << "\t" << MutHashListCounts[i] << "\t" ; - //cout << "made it all the way here " << endl; - // cout << "\tParents"; - // for (int pi=0; pi < ParAltCounts.size(); pi++){ - // cout << "\t" << ParAltCounts[pi][i] << "\t" << ParRefCounts[pi][i]; - // } - bool p = false; - if (ParAltCounts.size()>=2) - { - if (ParAltCounts[0][i] == 0 & ParAltCounts[1][i] > 3 && MutContigCounts[i] > 2 && ParAltCounts[0][i] >= 0 && ParAltCounts[1][i] >= 0 && ParRefCounts[0][i] >= 0 && ParRefCounts[1][i] >=0) - { - p=true; - phased[1]++; - } - else if(ParAltCounts[0][i] > 3 & ParAltCounts[1][i] == 0 && MutContigCounts[i] > 2 && ParAltCounts[0][i] >= 0 && ParAltCounts[1][i] >= 0 && ParRefCounts[0][i] >= 0 && ParRefCounts[1][i] >=0) - { - p=true; - phased[0]++; - } - else if(ParRefCounts[0][i] ==0 && ParRefCounts[1][i] > 3 && MutContigCounts[i] < -2 && ParAltCounts[0][i] >= 0 && ParAltCounts[1][i] >= 0 && ParRefCounts[0][i] >= 0 && ParRefCounts[1][i] >=0) - { - p=true; - phased[1]++; - } - else if(ParRefCounts[0][i] > 3 && ParRefCounts[1][i] == 0 && MutContigCounts[i] < -2 && ParAltCounts[0][i] >= 0 && ParAltCounts[1][i] >= 0 && ParRefCounts[0][i] >= 0 && ParRefCounts[1][i] >=0) - { - p=true; - phased[0]++; - } - } - // cout << "\t" << RefKmers[i] << "\t" << AltKmers[i]; - // if (p) - // { - // cout << " FOUND ONE " << phased[0] << "-" << phased[1] << "\t"; - // } - // cout<< endl; - } - if ( phased[0]>0 and phased[1] ==0) - { - // cout << "PHASED CONTIG " << phased[0] << "-" << phased[1] << endl; - + //write(); + vector phased; + phased.push_back(0); + phased.push_back(0); + for (int i = 0; i < seq.size(); i++) { + // cout << seq.c_str()[i] << "\t" << qual.c_str()[i] << "\t" << cigarString.c_str()[i] << "\t" << RefSeq.c_str()[i] << "\t" << ChrPositions[i] << "\t" << Positions[i] << "\tMutContigCounts=" << MutContigCounts[i] << "\t" << MutAltCounts[i] << "\t" << MutRefCounts[i] << "\t" << MutHashListCounts[i] << "\t" ; + //cout << "made it all the way here " << endl; + // cout << "\tParents"; + // for (int pi=0; pi < ParAltCounts.size(); pi++){ + // cout << "\t" << ParAltCounts[pi][i] << "\t" << ParRefCounts[pi][i]; + // } + bool p = false; + if (ParAltCounts.size() >= 2) { + if (ParAltCounts[0][i] == 0 & ParAltCounts[1][i] > 3 && MutContigCounts[i] > 2 && ParAltCounts[0][i] >= 0 && + ParAltCounts[1][i] >= 0 && ParRefCounts[0][i] >= 0 && ParRefCounts[1][i] >= 0) { + p = true; + phased[1]++; + } else if (ParAltCounts[0][i] > 3 & ParAltCounts[1][i] == 0 && MutContigCounts[i] > 2 && + ParAltCounts[0][i] >= 0 && ParAltCounts[1][i] >= 0 && ParRefCounts[0][i] >= 0 && + ParRefCounts[1][i] >= 0) { + p = true; + phased[0]++; + } else if (ParRefCounts[0][i] == 0 && ParRefCounts[1][i] > 3 && MutContigCounts[i] < -2 && + ParAltCounts[0][i] >= 0 && ParAltCounts[1][i] >= 0 && ParRefCounts[0][i] >= 0 && + ParRefCounts[1][i] >= 0) { + p = true; + phased[1]++; + } else if (ParRefCounts[0][i] > 3 && ParRefCounts[1][i] == 0 && MutContigCounts[i] < -2 && + ParAltCounts[0][i] >= 0 && ParAltCounts[1][i] >= 0 && ParRefCounts[0][i] >= 0 && + ParRefCounts[1][i] >= 0) { + p = true; + phased[0]++; + } + } + // cout << "\t" << RefKmers[i] << "\t" << AltKmers[i]; + // if (p) + // { + // cout << " FOUND ONE " << phased[0] << "-" << phased[1] << "\t"; + // } + // cout<< endl; + } + if (phased[0] > 0 and phased[1] == 0) { + // cout << "PHASED CONTIG " << phased[0] << "-" << phased[1] << endl; + + + ostringstream convert; + convert << phased[0]; + + phase = "PHASED-" + convert.str() + "-" + ParNames[0]; + } else if (phased[0] == 0 and phased[1] > 0) { + + // cout << "PHASED CONTIG " << phased[0] << "-" << phased[1] << endl; + ostringstream convert; + convert << phased[1]; + phase = "PHASED-" + convert.str() + "-" + ParNames[1]; + } else if (phased[0] > 0 and phased[1] > 0) { + + // cout << "Conflicting PHASED CONTIG " << phased[0] << "-" << phased[1] << endl; + ostringstream convert; + ostringstream convert2; + convert << phased[1]; + convert2 << phased[0]; + + phase = "ConflictingPHASED-" + convert.str() + "-" + convert2.str(); + } + //cout << "done checking phasing" << endl; +} - ostringstream convert; - convert << phased[0]; +string compressVar(string line, int start, string &StructCall) { + //cout << "compressing var" << endl; + char current = line.c_str()[0]; + int currentCount = 1; + string CV = ""; + for (int i = 1; i < line.size(); i++) { + // cout << current << endl; + if (line.c_str()[i] == current) { + currentCount++; + } else { + if (currentCount > 2) { + ostringstream convert; + convert << currentCount; + CV += convert.str(); + CV += current; + + ostringstream convertEND; + int end = currentCount + start; + convertEND << end; + + + if (current == 'Y') { + // cout << "YAAAY STRUCT" << endl; + StructCall = "SVTYPE=DUP;END="; + StructCall += convertEND.str(); + StructCall += ";SVLEN="; + StructCall += convert.str(); + StructCall += ";"; + // cout << StructCall << endl; + } + } else if (currentCount == 2) { + CV += current; + CV += current; + } else if (currentCount == 1) { + CV += current; + } else { + // cout << "ERROR in compress " << current << " " << currentCount << endl; + } + + current = line.c_str()[i]; + currentCount = 1; + } + } + if (currentCount > 2) { + ostringstream convert; + convert << currentCount; + CV += convert.str(); + CV += current; + + ostringstream convertEND; + int end = currentCount + start; + convertEND << end; + + + if (current == 'Y') { + // cout << "YAAAY STRUCT" << endl; + StructCall = "SVTYPE=DUP:TANDEM;END="; + StructCall += convertEND.str(); + StructCall += ";SVLEN="; + StructCall += convert.str(); + StructCall += ";"; + // cout << StructCall << endl; + } + } else if (currentCount == 2) { + CV += current; + CV += current; + } else if (currentCount == 1) { + CV += current; + } else { + // cout << "ERROR in compress " << current << " " << currentCount << endl; + } + + return CV; +} - phase = "PHASED-" + convert.str() + "-" + ParNames[0]; - } - else if( phased[0]==0 and phased[1] >0) - { +char next(string &qual, int i) { + + for (int j = i + 1; j < qual.size(); j++) { + if (qual[j] != qual[i] || qual[j] == '!') + return qual[j]; + } + return qual[i]; - // cout << "PHASED CONTIG " << phased[0] << "-" << phased[1] << endl; - ostringstream convert; - convert << phased[1]; - phase = "PHASED-" + convert.str() + "-" + ParNames[1]; - } - else if (phased[0]>0 and phased[1] >0) - { - - // cout << "Conflicting PHASED CONTIG " << phased[0] << "-" << phased[1] << endl; - ostringstream convert; - ostringstream convert2; - convert << phased[1]; - convert2 << phased[0]; - - phase = "ConflictingPHASED-" + convert.str() + "-" + convert2.str(); - } - //cout << "done checking phasing" << endl; -} -string compressVar(string line, int start, string& StructCall) -{ - //cout << "compressing var" << endl; - char current = line.c_str()[0]; - int currentCount = 1; - string CV = ""; - for (int i = 1; i< line.size(); i++) - { - // cout << current << endl; - if (line.c_str()[i] == current) - { - currentCount++; - } - else - { - if (currentCount > 2) - { - ostringstream convert; - convert << currentCount; - CV+=convert.str(); - CV+=current; - - ostringstream convertEND; - int end = currentCount+start; - convertEND << end; - - - if (current == 'Y') - { - // cout << "YAAAY STRUCT" << endl; - StructCall = "SVTYPE=DUP;END="; - StructCall += convertEND.str(); - StructCall += ";SVLEN="; - StructCall += convert.str(); - StructCall += ";"; - // cout << StructCall << endl; - } - } - else if (currentCount ==2) - { - CV+=current; - CV+=current; - } - else if (currentCount == 1) - { - CV+=current; - } - else - { - // cout << "ERROR in compress " << current << " " << currentCount << endl; - } - - current = line.c_str()[i]; - currentCount = 1; - } - } - if (currentCount > 2) - { - ostringstream convert; - convert << currentCount; - CV+=convert.str(); - CV+=current; - - ostringstream convertEND; - int end = currentCount+start; - convertEND << end; - - - if (current == 'Y') - { - // cout << "YAAAY STRUCT" << endl; - StructCall = "SVTYPE=DUP:TANDEM;END="; - StructCall += convertEND.str(); - StructCall += ";SVLEN="; - StructCall += convert.str(); - StructCall += ";"; - // cout << StructCall << endl; - } - } - else if (currentCount ==2) - { - CV+=current; - CV+=current; - } - else if (currentCount == 1) - { - CV+=current; - } - else - { - // cout << "ERROR in compress " << current << " " << currentCount << endl; - } - - return CV; } -char next(string& qual , int i) -{ - for(int j = i+1; j < qual.size(); j++) - { - if (qual[j] != qual[i] || qual[j] == '!') - return qual[j]; - } - return qual[i]; +char last(string &qual, int i) { + for (int j = i - 1; j >= 0; j += -1) { + if (qual[j] != qual[i] || qual[j] == '!') + return qual[j]; + } + return qual[i]; } -char last(string& qual, int i ) -{ - for(int j = i-1; j >=0; j+= -1) - { - if (qual[j] != qual[i] || qual[j] == '!') - return qual[j]; - } - return qual[i]; -} -void SamRead::createPeakMap() -{ - vector tempPeakMap; - for (int i =0; i< qual.size()-1; i++) - { +void SamRead::createPeakMap() { + vector tempPeakMap; + for (int i = 0; i < qual.size() - 1; i++) { - if (qual[i] <='!') - { - tempPeakMap.push_back(0); - } - else - { - if (qual[i] >= last(qual, i) && qual[i] >= next(qual, i)) - tempPeakMap.push_back(1); - else - tempPeakMap.push_back(0); + if (qual[i] <= '!') { + tempPeakMap.push_back(0); + } else { + if (qual[i] >= last(qual, i) && qual[i] >= next(qual, i)) + tempPeakMap.push_back(1); + else + tempPeakMap.push_back(0); - } - } - tempPeakMap.push_back(0); + } + } + tempPeakMap.push_back(0); - // I hate one time corrections, but here on is to correct if ther is a del - for (int i =0; i< qual.size(); i++) - { - if (seq[i] == '-'){ - tempPeakMap[i] == tempPeakMap[i-1]; - } - } + // I hate one time corrections, but here on is to correct if ther is a del + for (int i = 0; i < qual.size(); i++) { + if (seq[i] == '-') { + tempPeakMap[i] == tempPeakMap[i - 1]; + } + } - PeakMap.clear(); - PeakMap = tempPeakMap; + PeakMap.clear(); + PeakMap = tempPeakMap; } /*void SamRead::createPeakMap() { vector tempPeakMap; - int i =0; - int max = -1; - int maxSpot = -1; - int last = 0; + int i =0; + int max = -1; + int maxSpot = -1; + int last = 0; for (int i =0; i< qual.size(); i++) { @@ -2506,8 +2326,8 @@ void SamRead::createPeakMap() } else { - int j = i; - max = qual[j]; + int j = i; + max = qual[j]; while ( j < qual.size() and qual[j] > '!' ) { if (max < qual[j]) @@ -2526,7 +2346,7 @@ void SamRead::createPeakMap() } } - // I hate one time corrections, but here on is to correct if ther is a del + // I hate one time corrections, but here on is to correct if ther is a del for (int i =0; i< qual.size(); i++) { if (seq[i] == '-'){ @@ -2534,16 +2354,16 @@ void SamRead::createPeakMap() } } - PeakMap.clear(); + PeakMap.clear(); PeakMap = tempPeakMap; }*/ /*void SamRead::createPeakMap() { // cout << "crateing PeakMap" << endl; vector tempPeakMap; - int i =0; - int max = -1; - int maxSpot = -1; + int i =0; + int max = -1; + int maxSpot = -1; while (i& reads) -{ - //cout << "In Parsing Mutations " << endl; - BuildUpHashCountTable(); - createPeakMap(); - //write(); - - - string StructCall = ""; - string reff = ""; - string alt = ""; - string varType = ""; - for(int i = 25; i '!') - AnyBasesOver0 = true; - if (PeakMap[i] == 1) - Denovo = "DeNovo"; - - for(int j = 0; j< cigarString.size() - i; j++) - { - if(cigarString.c_str()[i+j] == 'X' or cigarString.c_str()[i+j] == 'D' or cigarString.c_str()[i+j] == 'I' or cigarString.c_str()[i+j] == 'Y' /*or cigarString.c_str()[i+j] == 'S' or cigarString.c_str()[i+j] == 'H'*/) - { - size = j; - if (qual.c_str()[i+j] > '!') - AnyBasesOver0 = true; - if (PeakMap[i+j] == 1) - Denovo = "DeNovo"; - - } - else //if (qual.c_str()[i+j] == '!') - break; - } - // cout << "size =" << size<< endl; - - if (AnyBasesOver0) //enabling this will only report varites covered by hashes - { - - if ( cigarString.c_str()[i] == 'I' or cigarString.c_str()[i] == 'D' or cigarString.c_str()[i] == 'Y' /*or cigarString.c_str()[i] == 'S' or cigarString.c_str()[i] == 'H'*/) - { - for (int k = 1; i-k >= 0; k++) - { - if (ChrPositions[i-k] == "nope") - {} - else - { - reff+=RefSeq.c_str()[i-k]; - alt+=seq.c_str()[i-k]; - startPos = i-k; - break; - } - } - } - - /////////build the alleles and var type///////// - for(int j = 0; j<= size; j++) - { - if (RefSeq.c_str()[i+j] == 'A' or RefSeq.c_str()[i+j] == 'C' or RefSeq.c_str()[i+j] == 'G' or RefSeq.c_str()[i+j] == 'T') - reff+=RefSeq.c_str()[i+j]; - if (seq.c_str()[i+j] == 'A' or seq.c_str()[i+j] == 'C' or seq.c_str()[i+j] == 'G' or seq.c_str()[i+j] == 'T') - alt+=seq.c_str()[i+j]; - varType += cigarString.c_str()[i+j]; - } - //***********check that the alese are only baess************** - bool good = true; - for (int j = 0; j ParRefModes; - vector ParAltModes; - vector HashCounts; - vector HashCountsOG; - vector ParGenotypes; - int SupportingHashes = GetSupportingHashCount(i, alt, reff); - string CompressedVarType = compressVar(varType, Positions[startPos], StructCall); - string Genotype = "-1"; - int PossibleAltKmer=0; - if (IsExome == true) - { - GetModes(i, alt, reff, MutRefMode, MutAltMode, ParRefModes, ParAltModes, HashCounts, HashCountsOG, PossibleAltKmer); - Genotype = ShittyGenotyper(MutAltMode, MutRefMode); - for (int p = 0; p< parentCounts.size(); p++) - { - ParGenotypes.push_back(ShittyGenotyper(ParAltModes[p], ParRefModes[p]) ); - } - } - else - { - //GetModes2(i, alt, reff, MutRefMode, MutAltMode, HashCounts, PossibleAltKmer); - for (int pi=0; pi < parentCounts.size(); pi++) - { - int temp; - ParRefModes.push_back(temp); - ParAltModes.push_back(temp); - ParGenotypes.push_back(""); - vector ParHashCounts; - int ParPossibleAltKmer; - GetModes3(i, alt, reff, ParRefCounts[pi], ParAltCounts[pi], AltKmers, RefKmers, ParHashCounts, ParPossibleAltKmer, ParGenotypes[pi], ParRefModes[pi], ParAltModes[pi]); - // cout << "parent geno = " << ParGenotypes[pi] << " ref = " << ParRefModes[pi] << " alt = " << ParAltModes[pi] << endl; - } - GetModes3(i, alt, reff, MutRefCounts, MutAltCounts, AltKmers, RefKmers, HashCounts, PossibleAltKmer, Genotype, MutRefMode, MutAltMode); - - - } +void SamRead::parseMutations(char *argv[], vector &reads) { + //cout << "In Parsing Mutations " << endl; + BuildUpHashCountTable(); + createPeakMap(); + //write(); + + + string StructCall = ""; + string reff = ""; + string alt = ""; + string varType = ""; + // todo: Iterating through cigar string here? + for (int i = 25; i < cigarString.size() - 25; i++) { + reff = ""; + alt = ""; + varType = ""; + //find the first variant base + if ((cigarString.c_str()[i] == 'X' or cigarString.c_str()[i] == 'I' or cigarString.c_str()[i] == 'D' or + cigarString.c_str()[i] == 'Y'/* or cigarString.c_str()[i] == 'S' *or cigarString.c_str()[i] == 'H'*/) and + RefSeq.c_str()[i] != 'N') { + // cout << "found a " << cigarString.c_str()[i] << endl; + // cout << "at pos " << i << " so pos " << i+pos << endl; + int size = -1; + int startPos = i; + bool AnyBasesOver0 = false; + string Denovo = "inherited"; + + if (qual.c_str()[i] > '!') + AnyBasesOver0 = true; + if (PeakMap[i] == 1) + Denovo = "DeNovo"; + + for (int j = 0; j < cigarString.size() - i; j++) { + if (cigarString.c_str()[i + j] == 'X' or cigarString.c_str()[i + j] == 'D' or + cigarString.c_str()[i + j] == 'I' or cigarString.c_str()[i + j] == + 'Y' /*or cigarString.c_str()[i+j] == 'S' or cigarString.c_str()[i+j] == 'H'*/) { + size = j; + if (qual.c_str()[i + j] > '!') + AnyBasesOver0 = true; + if (PeakMap[i + j] == 1) + Denovo = "DeNovo"; + + } else //if (qual.c_str()[i+j] == '!') + break; + } + // cout << "size =" << size<< endl; + + if (AnyBasesOver0) //enabling this will only report varites covered by hashes + { + + if (cigarString.c_str()[i] == 'I' or cigarString.c_str()[i] == 'D' or cigarString.c_str()[i] == + 'Y' /*or cigarString.c_str()[i] == 'S' or cigarString.c_str()[i] == 'H'*/) { + for (int k = 1; i - k >= 0; k++) { + if (ChrPositions[i - k] == "nope") {} + else { + reff += RefSeq.c_str()[i - k]; + alt += seq.c_str()[i - k]; + startPos = i - k; + break; + } + } + } - // cout << chr << "\t" << pos+i << "\t" << CompressedVarType /*"."*/ << "\t" << reff << "\t" << alt << "\t" << SupportingHashes << "\t" << varType << "\t" << "." << "\t" << "." << "\t" << "." << endl; - ////////////////generatre parent genotypes and check/////////////////////// - // cout << endl; - ////////////////check that parents have enough coverage//////////////////// - // cout << "PAR LOW COV CHECK" << endl; - int NumLowCov = 0; - int low = i-HashSize-50; - if (low < 0) - low = 0; - - for(int k = low ; k <= i+50 and k < hashes.size(); k++) - { - for (int j = 0; j < parentCounts.size(); j++) - { - int sum = 0; - if (hashesRef[k] == hashes[k]) - {sum = parentCountsReference[j][k]; /*cout < 2 ) - { - NumLowCov++; - // cout << "\tLOWCOV-" << NumLowCov ; - } - } - //cout << endl; + /////////build the alleles and var type///////// + for (int j = 0; j <= size; j++) { + if (RefSeq.c_str()[i + j] == 'A' or RefSeq.c_str()[i + j] == 'C' or RefSeq.c_str()[i + j] == 'G' or + RefSeq.c_str()[i + j] == 'T') + reff += RefSeq.c_str()[i + j]; + if (seq.c_str()[i + j] == 'A' or seq.c_str()[i + j] == 'C' or seq.c_str()[i + j] == 'G' or + seq.c_str()[i + j] == 'T') + alt += seq.c_str()[i + j]; + varType += cigarString.c_str()[i + j]; + } + //***********check that the alese are only baess************** + bool good = true; + for (int j = 0; j < reff.size(); j++) { + if (reff.c_str()[j] != 'A' or reff.c_str()[j] != 'C' or reff.c_str()[j] != 'G' or + reff.c_str()[j] != 'T') { good = false; } + } + for (int j = 0; j < alt.size(); j++) { + if (alt.c_str()[j] != 'A' or alt.c_str()[j] != 'C' or alt.c_str()[j] != 'G' or + alt.c_str()[j] != 'T') { good = false; } + } + if (good = false) { + cout << "ERROR in SNP detect" << endl; + cout << endl << chr << "\t" << pos + i << "\t" << reff << "\t" << alt << endl; + write(); + } + //***********check that the alese are only baess done************** + ////////Starting Checks ///////////// + int MutRefMode; + int MutAltMode; + vector ParRefModes; + vector ParAltModes; + vector HashCounts; + vector HashCountsOG; + vector ParGenotypes; + int SupportingHashes = GetSupportingHashCount(i, alt, reff); + string CompressedVarType = compressVar(varType, Positions[startPos], StructCall); + string Genotype = "-1"; + int PossibleAltKmer = 0; + if (IsExome == true) { + GetModes(i, alt, reff, MutRefMode, MutAltMode, ParRefModes, ParAltModes, HashCounts, HashCountsOG, + PossibleAltKmer); + Genotype = ShittyGenotyper(MutAltMode, MutRefMode); + for (int p = 0; p < parentCounts.size(); p++) { + ParGenotypes.push_back(ShittyGenotyper(ParAltModes[p], ParRefModes[p])); + } + } else { + //GetModes2(i, alt, reff, MutRefMode, MutAltMode, HashCounts, PossibleAltKmer); + for (int pi = 0; pi < parentCounts.size(); pi++) { + int temp; + ParRefModes.push_back(temp); + ParAltModes.push_back(temp); + ParGenotypes.push_back(""); + vector ParHashCounts; + int ParPossibleAltKmer; + GetModes3(i, alt, reff, ParRefCounts[pi], ParAltCounts[pi], AltKmers, RefKmers, ParHashCounts, + ParPossibleAltKmer, ParGenotypes[pi], ParRefModes[pi], ParAltModes[pi]); + // cout << "parent geno = " << ParGenotypes[pi] << " ref = " << ParRefModes[pi] << " alt = " << ParAltModes[pi] << endl; + } + GetModes3(i, alt, reff, MutRefCounts, MutAltCounts, AltKmers, RefKmers, HashCounts, PossibleAltKmer, + Genotype, MutRefMode, MutAltMode); - } - //////////////////////////////check if the parenst contain any of mut hashes////////////////////////////////////////// - bool LowCov = false; - int lowCount = 0; - low = i - HashSize ; - if (low < 0){low = 0;} - // cout << "checking bases " << low << " to " << i+size+5 << endl; - vector streak; - for (int k = 0; k < parentCounts.size(); k++) - { - streak.push_back(0); - } - for(int j = low; j <= i+size and j < hashes.size(); j++) - { - if (hashesRef[j] != hashes[j]) - { - // cout << "Checking Par Hash " << hashes[j] << "\t" << hashesRef[j]; - if ((ExcludeHashes[HashToLong(hashes[j])]<1 && ExcludeHashes[HashToLong(RevComp(hashes[j]))]<1)) - { - for (int k = 0; k < parentCounts.size(); k++) - { - //cout << "Checking Par Hash " << hashes[j] << "\t" << parentCounts[k][j] << "\t" << hashesRef[j] << "\t" << parentCountsReference[k][j]; - // cout << "\t" << parentCounts[k][j] << "\t" << parentCountsReference[k][j]; - float varFreq = 1; - - if (parentCountsReference[k][j] > 0) - { - varFreq = (double)parentCounts[k][j]/((double)parentCountsReference[k][j] + (double)parentCounts[k][j]); - } - // cout << "\tvarFreq=" << varFreq; - - if (parentCounts[k][j] >= 1 and parentCounts[k][j] <= ParLowCovThreshold and varFreq > .02 )//and parentCountsReference[k][j]<150 ) //if (parentCounts[k][j] <= 5 and parentCounts[k][j] > 0 ) - { - streak[k]++; - // cout << " LC HASH FOUND streak = " << streak[k] ; - if (streak[k] >=1) - { - // cout << " LC STREAK FOUND streak = " << streak[k] ; - LowCov = true; - lowCount++; - } - } - else - { - streak[k] = 0; - // cout << "streak " << k << " reset to 0 - " << streak[k] ; - } - } - } - else - { }//cout << " HASH FOUND IN REF " << hashes[j] << " - " << ExcludeHashes[HashToLong(hashes[j])] << " - " << ExcludeHashes[HashToLong(RevComp(hashes[j]))] ;} - //cout << endl; - } - // else - // cout << "hashes are same, skpping " << hashes[j] << "\t" << hashesRef[j]; - } + } - //cout << "done with LC check, LC = " << LowCov << " and LowCount = " << lowCount << endl; - ///////////////////final filter check///////////////////////////////////////// - string Filter = "."; - string InfoFilter = ""; - if (Genotype.find("1") == std::string::npos) { - Denovo = "Mosaic"; - } - if (AlignmentSegments > SegThreshold or AlignmentSegmentsCigar > SegThresholdCigar) - { - Denovo = "PoorAlignment"; - stringstream ss; - ss << AlignmentSegments << "-" << AlignmentSegmentsCigar; - Denovo += ss.str(); - if (Filter == ".") - Filter = ""; - Filter+="PA"; - InfoFilter+="PA"; - InfoFilter+=ss.str(); - InfoFilter+=","; - Filter+=";"; - } - if (NumLowCov > 25) - { - Denovo = "ParLowCovRegion"; - // cout << "ParLowCov " << NumLowCov << endl; - if (Filter == ".") - Filter = ""; - stringstream ss; - ss << NumLowCov; - Filter+="PLC"; - InfoFilter+="PLC"; - InfoFilter+=ss.str(); - Filter+=";"; - InfoFilter+=","; - } - //if (LowCov) - if (lowCount >=2) - { - // cout << "LOW COVERAGE" << endl; - Denovo = "Inherited"; - stringstream ss; - ss << lowCount; - Denovo += ss.str(); - if (Filter == ".") - Filter = ""; - Filter+="LCH"; - InfoFilter+="LCH"; - InfoFilter+=ss.str(); - Filter+=";"; - InfoFilter+=","; - } - //else - // cout << "GOOD COVERAGE" << endl; - if (StrandBias >= 0){ - - if (StrandBias >0.99999 or StrandBias < 0.00001) - { - Denovo = "StrandBias"; - stringstream ss; - ss << StrandBias; - if (Filter == ".") - Filter = ""; - Filter+="SB"; - InfoFilter+="SB"; - InfoFilter+=ss.str(); - Filter+=";"; - InfoFilter+=","; - } - } - if (Denovo == "DeNovo" and Filter == ".") - Filter = "PASS"; - if (InfoFilter=="") - InfoFilter="PASS"; - - - //checking if the aligment is a split that shows a good event to remove it from consideratin for the less likely sv stuff - //cout << "ok lets see if this is a big event" << endl; - - ///if (Denovo == "DeNovo") - { - // cout << "yup DeNovo" << endl; - if (isSplitRead > 0) - { - // cout << "yup more than one alignment" << endl; - if ( varType.find("D") != std::string::npos || varType.find("Y") != std::string::npos || varType.find("I") != std::string::npos ) - { - // cout << "YAAAAAY found a deletion, let me se these SV's" << endl; - for (int w = 0; w < alignments.size(); w++) - { - reads[alignments[w]].SVeventid = -1; - } - } - } - } - for (int p = 0; p< ParRefModes.size(); p++) - { - //if (ParGenotypes[p].find("1") != std::string::npos) { - //Denovo = "PresentInParents"; } - } - ///// lets play with entropy //////// - //cout << "starting entropy" << endl; - int estart = i - 25; - int eend = i + 25; - if (estart < 0){estart = 0;} - if (eend >= seq.size()){eend = seq.size()-1;} - //cout << "start = " << estart << " end = " << eend << endl; - string refContext = RefSeq.substr(estart, eend-estart); - //cout << "reff -= " << refContext << endl; - double w1 = entropyMulti(refContext, 1); - double w2 = entropyMulti(refContext, 2); - double w3 = entropyMulti(refContext, 3); - double w4 = entropyMulti(refContext, 4); - double w5 = entropyMulti(refContext, 5); - //cout << "done with entropy" << endl; - /////////////////////////////////////////////////////// - //cout << "startpos = " << startPos << " chrsize = " << ChrPositions.size() << endl; - //cout << ChrPositions[startPos] << "\t" << endl; - //cout << Positions[startPos] << "\t" << endl; - //cout << CompressedVarType <<"-" << endl; - //cout << Denovo /*"."*/ << "\t" << endl; - //cout << reff << "\t" << endl; - //cout << alt << "\t" << endl; - //cout << SupportingHashes << "\t" << endl; - //cout << Filter << "\t" << endl; - // cout << StructCall << endl; - //cout <<"RN=" << name << endl; - //cout << ";MQ=" << mapQual << endl; - //cout << ";cigar=" << cigar << endl; - //cout << ";" << "CVT=" << CompressedVarType << ";HD=" << endl; - - double Score = ((double)SupportingHashes/(double)PossibleAltKmer) * 100.0; - ////////////////////////Writing var out to file///////////////////////// - //cout << ChrPositions[startPos] << "\t" < 2) { + NumLowCov++; + // cout << "\tLOWCOV-" << NumLowCov ; + } + } + //cout << endl; + } + //////////////////////////////check if the parents contain any of mut hashes////////////////////////////////////////// + bool LowCov = false; + int lowCount = 0; + low = i - HashSize; + if (low < 0) { low = 0; } + // cout << "checking bases " << low << " to " << i+size+5 << endl; + vector streak; + for (int k = 0; k < parentCounts.size(); k++) { + streak.push_back(0); + } + for (int j = low; j <= i + size and j < hashes.size(); j++) { + + if (hashesRef[j] != hashes[j]) { + // cout << "Checking Par Hash " << hashes[j] << "\t" << hashesRef[j]; + if ((ExcludeHashes[HashToLong(hashes[j])] < 1 && + ExcludeHashes[HashToLong(RevComp(hashes[j]))] < 1)) { + for (int k = 0; k < parentCounts.size(); k++) { + //cout << "Checking Par Hash " << hashes[j] << "\t" << parentCounts[k][j] << "\t" << hashesRef[j] << "\t" << parentCountsReference[k][j]; + // cout << "\t" << parentCounts[k][j] << "\t" << parentCountsReference[k][j]; + float varFreq = 1; + + if (parentCountsReference[k][j] > 0) { + varFreq = (double) parentCounts[k][j] / + ((double) parentCountsReference[k][j] + (double) parentCounts[k][j]); + } + // cout << "\tvarFreq=" << varFreq; + + if (parentCounts[k][j] >= 1 and parentCounts[k][j] <= ParLowCovThreshold and varFreq > + .02)//and parentCountsReference[k][j]<150 ) //if (parentCounts[k][j] <= 5 and parentCounts[k][j] > 0 ) + { + streak[k]++; + // cout << " LC HASH FOUND streak = " << streak[k] ; + if (streak[k] >= 1) { + // cout << " LC STREAK FOUND streak = " << streak[k] ; + LowCov = true; + lowCount++; + } + } else { + streak[k] = 0; + // cout << "streak " << k << " reset to 0 - " << streak[k] ; + } + } + } else {}//cout << " HASH FOUND IN REF " << hashes[j] << " - " << ExcludeHashes[HashToLong(hashes[j])] << " - " << ExcludeHashes[HashToLong(RevComp(hashes[j]))] ;} + //cout << endl; + } + // else + // cout << "hashes are same, skpping " << hashes[j] << "\t" << hashesRef[j]; + } + + //cout << "done with LC check, LC = " << LowCov << " and LowCount = " << lowCount << endl; + ///////////////////final filter check///////////////////////////////////////// + string Filter = "."; + string InfoFilter = ""; + if (Genotype.find("1") == std::string::npos) { + Denovo = "Mosaic"; + } + if (AlignmentSegments > SegThreshold or AlignmentSegmentsCigar > SegThresholdCigar) { + Denovo = "PoorAlignment"; + stringstream ss; + ss << AlignmentSegments << "-" << AlignmentSegmentsCigar; + Denovo += ss.str(); + if (Filter == ".") + Filter = ""; + Filter += "PA"; + InfoFilter += "PA"; + InfoFilter += ss.str(); + InfoFilter += ","; + Filter += ";"; + } + if (NumLowCov > 25) { + Denovo = "ParLowCovRegion"; + // cout << "ParLowCov " << NumLowCov << endl; + if (Filter == ".") + Filter = ""; + stringstream ss; + ss << NumLowCov; + Filter += "PLC"; + InfoFilter += "PLC"; + InfoFilter += ss.str(); + Filter += ";"; + InfoFilter += ","; + } + //if (LowCov) + if (lowCount >= 2) { + // cout << "LOW COVERAGE" << endl; + Denovo = "Inherited"; + stringstream ss; + ss << lowCount; + Denovo += ss.str(); + if (Filter == ".") + Filter = ""; + Filter += "LCH"; + InfoFilter += "LCH"; + InfoFilter += ss.str(); + Filter += ";"; + InfoFilter += ","; + } + //else + // cout << "GOOD COVERAGE" << endl; + if (StrandBias >= 0) { + + if (StrandBias > 0.99999 or StrandBias < 0.00001) { + Denovo = "StrandBias"; + stringstream ss; + ss << StrandBias; + if (Filter == ".") + Filter = ""; + Filter += "SB"; + InfoFilter += "SB"; + InfoFilter += ss.str(); + Filter += ";"; + InfoFilter += ","; + } + } + if (Denovo == "DeNovo" and Filter == ".") + Filter = "PASS"; + if (InfoFilter == "") + InfoFilter = "PASS"; + + + //checking if the aligment is a split that shows a good event to remove it from consideratin for the less likely sv stuff + //cout << "ok lets see if this is a big event" << endl; + + ///if (Denovo == "DeNovo") + { + // cout << "yup DeNovo" << endl; + if (isSplitRead > 0) { + // cout << "yup more than one alignment" << endl; + if (varType.find("D") != std::string::npos || varType.find("Y") != std::string::npos || + varType.find("I") != std::string::npos) { + // cout << "YAAAAAY found a deletion, let me se these SV's" << endl; + for (int w = 0; w < alignments.size(); w++) { + reads[alignments[w]].SVeventid = -1; + } + } + } + } + for (int p = 0; p < ParRefModes.size(); p++) { + //if (ParGenotypes[p].find("1") != std::string::npos) { + //Denovo = "PresentInParents"; } + } + ///// lets play with entropy //////// + //cout << "starting entropy" << endl; + int estart = i - 25; + int eend = i + 25; + if (estart < 0) { estart = 0; } + if (eend >= seq.size()) { eend = seq.size() - 1; } + //cout << "start = " << estart << " end = " << eend << endl; + string refContext = RefSeq.substr(estart, eend - estart); + //cout << "reff -= " << refContext << endl; + double w1 = entropyMulti(refContext, 1); + double w2 = entropyMulti(refContext, 2); + double w3 = entropyMulti(refContext, 3); + double w4 = entropyMulti(refContext, 4); + double w5 = entropyMulti(refContext, 5); + //cout << "done with entropy" << endl; + /////////////////////////////////////////////////////// + //cout << "startpos = " << startPos << " chrsize = " << ChrPositions.size() << endl; + //cout << ChrPositions[startPos] << "\t" << endl; + //cout << Positions[startPos] << "\t" << endl; + //cout << CompressedVarType <<"-" << endl; + //cout << Denovo /*"."*/ << "\t" << endl; + //cout << reff << "\t" << endl; + //cout << alt << "\t" << endl; + //cout << SupportingHashes << "\t" << endl; + //cout << Filter << "\t" << endl; + // cout << StructCall << endl; + //cout <<"RN=" << name << endl; + //cout << ";MQ=" << mapQual << endl; + //cout << ";cigar=" << cigar << endl; + //cout << ";" << "CVT=" << CompressedVarType << ";HD=" << endl; + + double Score = ((double) SupportingHashes / (double) PossibleAltKmer) * 100.0; + ////////////////////////Writing var out to file///////////////////////// + //cout << ChrPositions[startPos] << "\t" <= 48 and cigar.c_str()[i] <= 57) - num = num + cigar.c_str()[i]; - else - { - int number = atoi(num.c_str()); - for(int j = 0; j < number; j++) - {cigarString += cigar.c_str()[i];} - num = ""; - } - } - isSplitRead= 0; - for (int i = 0; i= 48 and cigar.c_str()[i] <= 57) + num = num + cigar.c_str()[i]; + else { + int number = atoi(num.c_str()); + for (int j = 0; j < number; j++) { cigarString += cigar.c_str()[i]; } + num = ""; + } + } + isSplitRead = 0; + for (int i = 0; i < cigarString.length(); i++) { + if (cigarString.c_str()[i] == 'H' || cigarString.c_str()[i] == 'S') + isSplitRead++; + } + } -void SamRead::FixTandemRef() -{ + +void SamRead::FixTandemRef() { // cout << "FOUND TANDEM" << endl; // write(); - //writeVertical(); - string lastChr = "nope"; - int lastPos = -1; - string NewRef = ""; - for (int i = 0; i NewPositions; - vector NewChromosome; - int InsOffset = 0; - - if ( Reff.sequenceNameStartingWith(chr) == "") //come back to, need to check if chr is in reference - { - cout << "ERROR chr " << chr << " not found\n"; - return; - } - - //correct star position of the read to account for Hard and soft clipped bases as we are counting those now - for (int i = 0; i< cigarString.size(); i++) - { - if (cigarString.c_str()[i]== 'H') - {} - else - { - pos = pos-i; - break; - } - } - for (int i = 0; i< cigarString.size(); i++) - { - if (cigarString.c_str()[i]== 'S') - {} - else - { - pos = pos-i; - break; - } - } - - +void SamRead::getRefSeq() { + originalSeq = seq; + originalQual = qual; + RefSeq = ""; + string NewSeq = ""; + string NewQual = ""; + string NewCigar = ""; + string NewStrand = ""; + vector NewPositions; + vector NewChromosome; + int InsOffset = 0; + + if (Reff.sequenceNameStartingWith(chr) == "") //come back to, need to check if chr is in reference + { + cout << "ERROR chr " << chr << " not found\n"; + return; + } + + //correct start position of the read to account for Hard and soft clipped bases as we are counting those now + for (int i = 0; i < cigarString.size(); i++) { + if (cigarString.c_str()[i] == 'H') {} + else { + pos = pos - i; + break; + } + } + for (int i = 0; i < cigarString.size(); i++) { + if (cigarString.c_str()[i] == 'S') {} + else { + pos = pos - i; + break; + } + } + + + int Roffset = 0; + int Coffset = 0; + for (int i = 0; i < cigarString.length(); i++) { + if (cigarString.c_str()[i] == 'M') { + //cout << "yay cigar = M" << endl; + RefSeq += toupper(Reff.getSubSequence(chr, i + pos - 1 + Roffset, 1).c_str()[0]); + NewSeq += seq.c_str()[i - Coffset]; + NewQual += qual.c_str()[i - Coffset]; + NewPositions.push_back(pos + i - InsOffset); + NewChromosome.push_back(chr); + if (toupper(Reff.getSubSequence(chr, i + pos - 1 + Roffset, 1).c_str()[0]) == seq.c_str()[i - Coffset]) + NewCigar += 'M'; + else + NewCigar += 'X'; + + } else if (cigarString.c_str()[i] == 'I') { + // cout << "yay cigar = I" << endl; + RefSeq += '-'; + Roffset += -1; + NewSeq += seq.c_str()[i - Coffset]; + NewQual += qual.c_str()[i - Coffset]; + NewCigar += 'I'; + InsOffset++; + NewPositions.push_back(pos + i - InsOffset); + NewChromosome.push_back(chr); + } else if (cigarString.c_str()[i] == 'D') { + // cout << "yay cigar = D" << endl; + NewSeq += '-'; + NewQual += ' '; + Coffset++; + RefSeq += toupper(Reff.getSubSequence(chr, i + pos - 1 + Roffset, 1).c_str()[0]); + NewCigar += 'D'; + NewPositions.push_back(pos + i - InsOffset); + NewChromosome.push_back(chr); + } else if (cigarString.c_str()[i] == 'H') { + RefSeq += 'H'; + NewSeq += 'H'; + NewQual += ' '; + Coffset++; + NewCigar += 'H'; + // Roffset+= -1; + NewPositions.push_back(-1); + NewChromosome.push_back("nope"); + } else if (cigarString.c_str()[i] == 'S') { + //I have an error here, when a read starts with S its ofset wrong + RefSeq += '-'; + NewSeq += seq.c_str()[i - Coffset]; + NewQual += qual.c_str()[i - Coffset]; + NewCigar += 'S'; + // Roffset += -1; + NewPositions.push_back(pos + i - InsOffset); //NewPositions.push_back(-1); + NewChromosome.push_back(chr); //NewChromosome.push_back("nope"); + } + //{ cout << "yay cigar = H" << endl;} + else { cout << "well shit" << endl; } + //cout << "yay" << endl; + } + seq = NewSeq; + cigarString = NewCigar; + qual.clear(); + char lastQ = ' '; + + //cout << "qual = " << qual; + for (int i = 0; i < NewQual.size(); i++) { + if (NewQual.c_str()[i] == ' ') { + if (NewCigar.c_str()[i] == 'D') + qual += lastQ; //'!'; + else + qual += '!'; + } else { + qual += NewQual.c_str()[i]; + lastQ = NewQual.c_str()[i]; + } + } + for (int i = 0; i < qual.size(); i++) { + strand += "+"; + } + Positions = NewPositions; + ChrPositions = NewChromosome; + //************************Lookup Kmer counts ***************************// + LookUpKmers(); + vector blank; - int Roffset = 0; - int Coffset = 0; - for (int i =0; i blank; - - - - //**********************************************************************// - CountAlignmentSegments(); - CountAlignmentSegmentsCigar(); + //**********************************************************************// + CountAlignmentSegments(); + CountAlignmentSegmentsCigar(); // cout << "After getRefSeq"; - //FullOutwriteVertical(); + //FullOutwriteVertical(); } -void SamRead::LookUpKmers() -{ +void SamRead::LookUpKmers() { // cout << "SeqSize = " << seq.size() << " RefSize = " << RefSeq.size() << endl; - vector blank; - ParAltCounts.clear(); - ParRefCounts.clear(); - MutHashListCounts.clear(); - MutContigCounts.clear(); - MutAltCounts.clear(); - MutRefCounts.clear(); - RefKmers.clear(); - AltKmers.clear(); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - ParAltCounts.push_back(blank); - ParRefCounts.push_back(blank); - } - for (int j = 0; j 0 ){ - if (hash == Refhash) - MutContigCounts.push_back(MutantHashes[HashToLong(hash)]*-1); - else - MutContigCounts.push_back(MutantHashes[HashToLong(hash)]); - } - else - { - MutContigCounts.push_back(0); - } - - - if (hash == Refhash){ - MutAltCounts.push_back(0); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - ParAltCounts[pi].push_back(0); - } - } - else{ - if (MutantHashes.count(HashToLong(hash)) > 0 ){ - MutAltCounts.push_back(MutantHashes[HashToLong(hash)]); - } - else - MutAltCounts.push_back(-1); - - for (int pi = 0; pi < ParentHashes.size(); pi++){ - if (ParentHashes[pi].count(HashToLong(hash)) > 0){ - ParAltCounts[pi].push_back(ParentHashes[pi][HashToLong(hash)]); - } - else - ParAltCounts[pi].push_back(-1); - } - } - - if (Hash.count(hash) > 0){ - MutHashListCounts.push_back(Hash[hash]); - } - else - MutHashListCounts.push_back(-1); + vector blank; + ParAltCounts.clear(); + ParRefCounts.clear(); + MutHashListCounts.clear(); + MutContigCounts.clear(); + MutAltCounts.clear(); + MutRefCounts.clear(); + RefKmers.clear(); + AltKmers.clear(); + for (int pi = 0; pi < ParentHashes.size(); pi++) { + ParAltCounts.push_back(blank); + ParRefCounts.push_back(blank); + } + for (int j = 0; j < seq.size(); j++) { + //hash table already has revcomp counted in it + string hash = getHash(seq, j, HashSize); // Gets nucleotide segment from sequence + string Refhash = getHash(RefSeq, j, HashSize); // Gets nucleotide from ref fasta + RefKmers.push_back(Refhash); + AltKmers.push_back(hash); + if (hash != "") { + if (MutantHashes.count(HashToLong(hash)) > 0) { + if (hash == Refhash) + MutContigCounts.push_back(MutantHashes[HashToLong(hash)] * -1); + else + MutContigCounts.push_back(MutantHashes[HashToLong(hash)]); + } else { + MutContigCounts.push_back(0); + } - } - else{ - MutContigCounts.push_back(-3); - MutAltCounts.push_back(-3); - MutHashListCounts.push_back(-3); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - ParAltCounts[pi].push_back(-3); - } - } + if (hash == Refhash) { + MutAltCounts.push_back(0); // If the subsequence is the same as the reference, add 0 to our counts + for (int pi = 0; pi < ParentHashes.size(); pi++) { + ParAltCounts[pi].push_back(0); + } + } else { + if (MutantHashes.count(HashToLong(hash)) > 0) { // Add actual count + MutAltCounts.push_back(MutantHashes[HashToLong(hash)]); + } else + MutAltCounts.push_back(-1); // The segment DNE in the MutantHashes table + + for (int pi = 0; pi < ParentHashes.size(); pi++) { + if (ParentHashes[pi].count(HashToLong(hash)) > 0) { + ParAltCounts[pi].push_back(ParentHashes[pi][HashToLong(hash)]); + } else + ParAltCounts[pi].push_back(-1); + } + } - if(Refhash != ""){ - if (MutantHashes.count(HashToLong(Refhash)) > 0 ) - { - MutRefCounts.push_back(MutantHashes[HashToLong(Refhash)]); - } - else - MutRefCounts.push_back(-1); + if (Hash.count(hash) > 0) { + MutHashListCounts.push_back(Hash[hash]); + } else + MutHashListCounts.push_back(-1); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - if (ParentHashes[pi].count(HashToLong(Refhash)) > 0){ - ParRefCounts[pi].push_back(ParentHashes[pi][HashToLong(Refhash)]); - } - else - ParRefCounts[pi].push_back(-1); - } - } - else{ + } else { + MutContigCounts.push_back(-3); + MutAltCounts.push_back(-3); + MutHashListCounts.push_back(-3); + for (int pi = 0; pi < ParentHashes.size(); pi++) { + ParAltCounts[pi].push_back(-3); + } + } - MutRefCounts.push_back(-3); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - ParRefCounts[pi].push_back(-3); - } - } + if (Refhash != "") { + if (MutantHashes.count(HashToLong(Refhash)) > 0) { + MutRefCounts.push_back(MutantHashes[HashToLong(Refhash)]); + } else + MutRefCounts.push_back(-1); + + for (int pi = 0; pi < ParentHashes.size(); pi++) { + if (ParentHashes[pi].count(HashToLong(Refhash)) > 0) { + ParRefCounts[pi].push_back(ParentHashes[pi][HashToLong(Refhash)]); + } else + ParRefCounts[pi].push_back(-1); + } + + } else { + + MutRefCounts.push_back(-3); + for (int pi = 0; pi < ParentHashes.size(); pi++) { + ParRefCounts[pi].push_back(-3); + } + } - } - //cout << "donezo" << endl; + } + //cout << "donezo" << endl; } -void SamRead::parse(string read) -{ - - //cout << "parsing " << read << endl; - vector temp = Split(read, '\t'); - //cout << "boom" << endl; - name = temp[0]; - //cout << "name " << name << endl; - flag = atoi(temp[1].c_str()); - chr = temp[2]; - pos = atoi(temp[3].c_str()); - mapQual = atoi(temp[4].c_str()); - cigar = temp[5]; - seq = temp[9]; - if (temp[10] == "*") - { - // cout << "correcting missing qualtiy" << endl; - string newQual = ""; - for (int i = 0; i < seq.size(); i++) - { - newQual+='5'; - } - temp[10] = newQual; - } - qual = temp[10]; - alignments.clear(); - - UsedForBigVar = false;UsedForBigVar = false; - first = true; - combined = false; - string NewSeq = ""; - for (int i = 0; i < seq.size(); i++) - NewSeq+=toupper(seq.c_str()[i]); - - seq = NewSeq; - - processCigar(); - //cout << "working on strand bias" << endl; - //cout << temp[0] << endl; - vector temp2 = Split(name, ':'); - if (temp2.size() >= 2){ - // cout << "break it down " << endl; - strands = temp2[1]; - // cout << "strands = " << strands << endl; - forward = 0; - reverse = 0; - forward = atoi(temp2[1].c_str()); - reverse = atoi(temp2[2].c_str()); - // cout << "forward = " << forward << endl; - // cout << "reverse = " << reverse << endl; - if (forward+reverse ==0) - StrandBias = 1; - else - StrandBias = ((float)forward)/((float)forward+(float)reverse); - // cout << "strand bias = " << StrandBias << endl; - } - else{ - // cout << "no strand data " << temp2.size() << endl; - strands = ""; - StrandBias = -1; - forward = -1; - reverse = -1; - } - AlignScore = 0; - for (int i = 11; i< temp.size(); i++){ - vector astemp = Split(temp[i], ':'); - if (astemp[0] == "AS"){ - AlignScore = atoi(astemp[2].c_str()); - } - } - //cout << "getting flag bits " << endl; - for (int j = 0; j < 16; ++j){ - FlagBits [j] = 0 != (flag & (1 << j)); - } - //cout << "Read Pared = " << FlagBits[0] << endl; - //cout << "read mapped in proper pair = " << FlagBits[1] << endl; - //cout << "read unmapped = " << FlagBits[2] << endl; - //cout << "mate unmapped = " << FlagBits[3] << endl; - //cout << "read reverse strand = " << FlagBits[4] << endl; - //cout << "mate referse strand = " << FlagBits[5] << endl; - //cout << "first in pair =" << FlagBits[6] << endl; - //cout << "second in pair =" << FlagBits[7] << endl; - //cout << "not primary alignment =" << FlagBits[8] << endl; - //cout << "read fails platform or vendor quality checks =" << FlagBits[9] << endl; - //cout << "read is PCR or optical duplicate =" << FlagBits[10] << endl; - //cout << "supplementary alignment =" << FlagBits[11] << endl; +/* + * Parses raw read into SamRead object. + */ +void SamRead::parse(string read) { + + vector temp = Split(read, '\t'); + name = temp[0]; + flag = atoi(temp[1].c_str()); + chr = temp[2]; + pos = atoi(temp[3].c_str()); + mapQual = atoi(temp[4].c_str()); + cigar = temp[5]; + seq = temp[9]; + if (temp[10] == "*") { + // cout << "correcting missing qualtiy" << endl; + string newQual = ""; + for (int i = 0; i < seq.size(); i++) { + newQual += '5'; + } + temp[10] = newQual; + } + qual = temp[10]; + alignments.clear(); + + UsedForBigVar = false; + UsedForBigVar = false; + first = true; + combined = false; + string NewSeq = ""; + for (int i = 0; i < seq.size(); i++) + NewSeq += toupper(seq.c_str()[i]); + + seq = NewSeq; + + processCigar(); + //cout << "working on strand bias" << endl; + //cout << temp[0] << endl; + vector temp2 = Split(name, ':'); + if (temp2.size() >= 2) { + // cout << "break it down " << endl; + strands = temp2[1]; + // cout << "strands = " << strands << endl; + forward = 0; + reverse = 0; + forward = atoi(temp2[1].c_str()); + reverse = atoi(temp2[2].c_str()); + // cout << "forward = " << forward << endl; + // cout << "reverse = " << reverse << endl; + if (forward + reverse == 0) + StrandBias = 1; + else + StrandBias = ((float) forward) / ((float) forward + (float) reverse); + // cout << "strand bias = " << StrandBias << endl; + } else { + // cout << "no strand data " << temp2.size() << endl; + strands = ""; + StrandBias = -1; + forward = -1; + reverse = -1; + } + AlignScore = 0; + for (int i = 11; i < temp.size(); i++) { + vector astemp = Split(temp[i], ':'); + if (astemp[0] == "AS") { + AlignScore = atoi(astemp[2].c_str()); + } + } + //cout << "getting flag bits " << endl; + for (int j = 0; j < 16; ++j) { + FlagBits[j] = 0 != (flag & (1 << j)); + } + //cout << "Read Pared = " << FlagBits[0] << endl; + //cout << "read mapped in proper pair = " << FlagBits[1] << endl; + //cout << "read unmapped = " << FlagBits[2] << endl; + //cout << "mate unmapped = " << FlagBits[3] << endl; + //cout << "read reverse strand = " << FlagBits[4] << endl; + //cout << "mate referse strand = " << FlagBits[5] << endl; + //cout << "first in pair =" << FlagBits[6] << endl; + //cout << "second in pair =" << FlagBits[7] << endl; + //cout << "not primary alignment =" << FlagBits[8] << endl; + //cout << "read fails platform or vendor quality checks =" << FlagBits[9] << endl; + //cout << "read is PCR or optical duplicate =" << FlagBits[10] << endl; + //cout << "supplementary alignment =" << FlagBits[11] << endl; } -int findBreak(SamRead& read) -{ - char Afirst = read.cigarString.c_str()[0]; + +int findBreak(SamRead &read) { + char Afirst = read.cigarString.c_str()[0]; // cout << "Afirst = " << Afirst << endl; // cout << "starting A check " << endl; - if (Afirst == 'H' or Afirst == 'S') - { + if (Afirst == 'H' or Afirst == 'S') { // cout << "forward" << endl; - for (int i =0; i < read.seq.size(); i++) - { - if (read.cigarString.c_str()[i] == 'H' or read.cigarString.c_str()[i] == 'S') - { - //keep going + for (int i = 0; i < read.seq.size(); i++) { + if (read.cigarString.c_str()[i] == 'H' or read.cigarString.c_str()[i] == 'S') { + //keep going // cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i]<< endl; - } - else - { + } else { // cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i] << endl; // cout << "fond break at " << i << endl; - return i; - } - } - } - else - { + return i; + } + } + } else { // cout << "reverse" << endl; - for (int i = read.seq.size()-1; i >= 0; i += -1) - { - if (read.cigarString.c_str()[i] == 'H' or read.cigarString.c_str()[i] == 'S') - { + for (int i = read.seq.size() - 1; i >= 0; i += -1) { + if (read.cigarString.c_str()[i] == 'H' or read.cigarString.c_str()[i] == 'S') { // cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i] << endl; - //keep going - } - else - { + //keep going + } else { // cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i] << endl; // cout << "fond break at " << i << endl; - return i; - } - } - } + return i; + } + } + } - return -1; //this better never happen, should retrun from the if statemtns above + return -1; //this better never happen, should retrun from the if statemtns above } -SamRead BetterWay(vector reads) -{ - cout << "In BetterWay" << endl; - int A = 0; - int B = 1; - //cout << "B = " << B << endl; - cout << "Working on " << reads[A].name << ", size = " << reads[B].pos -reads[A].pos << endl; - vector> AlignmentPos; - vector> AlignmentChr; - int ALastGoodRef = -1; - string ALastGoodChr = "nope"; - int BLastGoodRef = -1; - string BLastGoodChr = "nope"; - - - vector NewSeqs; - vector NewQuals; - vector NewRefs; - vector NewCigars; - - for(int i = 0; i reads) { + cout << "In BetterWay" << endl; + int A = 0; + int B = 1; + //cout << "B = " << B << endl; + cout << "Working on " << reads[A].name << ", size = " << reads[B].pos - reads[A].pos << endl; + vector > AlignmentPos; + vector > AlignmentChr; + int ALastGoodRef = -1; + string ALastGoodChr = "nope"; + int BLastGoodRef = -1; + string BLastGoodChr = "nope"; + + + vector NewSeqs; + vector NewQuals; + vector NewRefs; + vector NewCigars; + + for (int i = 0; i < reads.size(); i++) { + NewSeqs.push_back(""); + NewQuals.push_back(""); + NewRefs.push_back(""); + NewCigars.push_back(""); + } + + + /*for (int i = 0; i < reads.size(); i++) { cout << "Pre Lining up reads " << i << endl; reads[i].write(); }*/ - int Acount = 0; - int Bcount = 0; - if (B == 1 and GetReadOrientation(reads[A].flag) != GetReadOrientation(reads[B].flag)) - { - cout <<"FLIPPING reads not on the same strand"; - reads[B].flipRead(); - } - while (Acount < reads[A].cigarString.size() and Bcount < reads[B].cigarString.size()) - { - vector currentPos; - vector currentChr; - //need to get all the reads lined up with the same number of bases, taking account of I's and D's that change length// - if (reads[A].cigarString.c_str()[Acount] == 'D' and reads[B].cigarString.c_str()[Acount] != 'D') - { - currentPos.push_back(reads[A].Positions[Acount]); - currentPos.push_back(-1); - - currentChr.push_back(reads[A].ChrPositions[Acount]); - currentChr.push_back("nope"); - - ALastGoodRef = reads[A].Positions[Acount]; - ALastGoodChr = reads[A].ChrPositions[Acount]; - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - - NewSeqs[B]+='-'; - NewQuals[B]+='!'; - NewRefs[B]+="-"; - NewCigars[B]+='R'; - } - else if (reads[A].cigarString.c_str()[Acount] != 'D' and reads[B].cigarString.c_str()[Acount] == 'D') - { - currentPos.push_back(-1); - currentPos.push_back(reads[B].Positions[Bcount]); - - currentChr.push_back("nope"); - currentChr.push_back(reads[B].ChrPositions[Bcount]); - - BLastGoodRef = reads[B].Positions[Bcount]; - BLastGoodChr = reads[B].ChrPositions[Bcount]; - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - - NewSeqs[A]+='-'; - NewQuals[A]+='!'; - NewRefs[A]+='-'; - NewCigars[A]+='R'; - } - else - { - if (reads[A].cigarString.c_str()[Acount] == 'H' or reads[A].cigarString.c_str()[Acount] == 'S') - { - currentPos.push_back(-1); - currentChr.push_back("nope"); - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - - } - else if (reads[A].cigarString.c_str()[Acount] == 'M' or reads[A].cigarString.c_str()[Acount] == 'X' or reads[A].cigarString.c_str()[Acount] == 'D') - { - currentPos.push_back(reads[A].Positions[Acount]); - currentChr.push_back(reads[A].ChrPositions[Acount]); - ALastGoodRef = reads[A].Positions[Acount]; - ALastGoodChr = reads[A].ChrPositions[Acount]; - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - } - else if (reads[A].cigarString.c_str()[Acount] == 'I') - { - currentPos.push_back(ALastGoodRef); - currentChr.push_back(ALastGoodChr); - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - } - else - cout << "WTF, cigar = " << reads[A].cigarString.c_str()[Acount]; - - - - if (reads[B].cigarString.c_str()[Bcount] == 'H' or reads[B].cigarString.c_str()[Bcount] == 'S') - { - currentPos.push_back(-1); - currentChr.push_back("nope"); - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - } - else if (reads[B].cigarString.c_str()[Bcount] == 'M' or reads[B].cigarString.c_str()[Bcount] == 'X' or reads[B].cigarString.c_str()[Bcount] == 'D') - { - currentPos.push_back(reads[B].Positions[Bcount]); - currentChr.push_back(reads[B].ChrPositions[Bcount]); - BLastGoodRef = reads[B].Positions[Bcount]; - BLastGoodChr = reads[B].ChrPositions[Bcount]; - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - } - else if (reads[B].cigarString.c_str()[Bcount] == 'I') - { - currentPos.push_back(BLastGoodRef); - currentChr.push_back(BLastGoodChr); - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - } - else - cout << "WTF, cigar = " << reads[B].cigarString.c_str()[Bcount]; - - } - AlignmentPos.push_back(currentPos); - AlignmentChr.push_back(currentChr); - } + int Acount = 0; + int Bcount = 0; + if (B == 1 and GetReadOrientation(reads[A].flag) != GetReadOrientation(reads[B].flag)) { + cout << "FLIPPING reads not on the same strand"; + reads[B].flipRead(); + } + while (Acount < reads[A].cigarString.size() and Bcount < reads[B].cigarString.size()) { + vector currentPos; + vector currentChr; + //need to get all the reads lined up with the same number of bases, taking account of I's and D's that change length// + if (reads[A].cigarString.c_str()[Acount] == 'D' and reads[B].cigarString.c_str()[Acount] != 'D') { + currentPos.push_back(reads[A].Positions[Acount]); + currentPos.push_back(-1); + + currentChr.push_back(reads[A].ChrPositions[Acount]); + currentChr.push_back("nope"); + + ALastGoodRef = reads[A].Positions[Acount]; + ALastGoodChr = reads[A].ChrPositions[Acount]; + + NewSeqs[A] += reads[A].seq.c_str()[Acount]; + NewQuals[A] += reads[A].qual.c_str()[Acount]; + NewRefs[A] += reads[A].RefSeq.c_str()[Acount]; + NewCigars[A] += reads[A].cigarString.c_str()[Acount]; + + Acount++; + + NewSeqs[B] += '-'; + NewQuals[B] += '!'; + NewRefs[B] += "-"; + NewCigars[B] += 'R'; + } else if (reads[A].cigarString.c_str()[Acount] != 'D' and reads[B].cigarString.c_str()[Acount] == 'D') { + currentPos.push_back(-1); + currentPos.push_back(reads[B].Positions[Bcount]); + + currentChr.push_back("nope"); + currentChr.push_back(reads[B].ChrPositions[Bcount]); + + BLastGoodRef = reads[B].Positions[Bcount]; + BLastGoodChr = reads[B].ChrPositions[Bcount]; + + NewSeqs[B] += reads[B].seq.c_str()[Bcount]; + NewQuals[B] += reads[B].qual.c_str()[Bcount]; + NewRefs[B] += reads[B].RefSeq.c_str()[Bcount]; + NewCigars[B] += reads[B].cigarString.c_str()[Bcount]; + + Bcount++; + + NewSeqs[A] += '-'; + NewQuals[A] += '!'; + NewRefs[A] += '-'; + NewCigars[A] += 'R'; + } else { + if (reads[A].cigarString.c_str()[Acount] == 'H' or reads[A].cigarString.c_str()[Acount] == 'S') { + currentPos.push_back(-1); + currentChr.push_back("nope"); + + NewSeqs[A] += reads[A].seq.c_str()[Acount]; + NewQuals[A] += reads[A].qual.c_str()[Acount]; + NewRefs[A] += reads[A].RefSeq.c_str()[Acount]; + NewCigars[A] += reads[A].cigarString.c_str()[Acount]; + + Acount++; + + } else if (reads[A].cigarString.c_str()[Acount] == 'M' or reads[A].cigarString.c_str()[Acount] == 'X' or + reads[A].cigarString.c_str()[Acount] == 'D') { + currentPos.push_back(reads[A].Positions[Acount]); + currentChr.push_back(reads[A].ChrPositions[Acount]); + ALastGoodRef = reads[A].Positions[Acount]; + ALastGoodChr = reads[A].ChrPositions[Acount]; + + NewSeqs[A] += reads[A].seq.c_str()[Acount]; + NewQuals[A] += reads[A].qual.c_str()[Acount]; + NewRefs[A] += reads[A].RefSeq.c_str()[Acount]; + NewCigars[A] += reads[A].cigarString.c_str()[Acount]; + + Acount++; + } else if (reads[A].cigarString.c_str()[Acount] == 'I') { + currentPos.push_back(ALastGoodRef); + currentChr.push_back(ALastGoodChr); + + NewSeqs[A] += reads[A].seq.c_str()[Acount]; + NewQuals[A] += reads[A].qual.c_str()[Acount]; + NewRefs[A] += reads[A].RefSeq.c_str()[Acount]; + NewCigars[A] += reads[A].cigarString.c_str()[Acount]; + + Acount++; + } else + cout << "WTF, cigar = " << reads[A].cigarString.c_str()[Acount]; + + + if (reads[B].cigarString.c_str()[Bcount] == 'H' or reads[B].cigarString.c_str()[Bcount] == 'S') { + currentPos.push_back(-1); + currentChr.push_back("nope"); + + NewSeqs[B] += reads[B].seq.c_str()[Bcount]; + NewQuals[B] += reads[B].qual.c_str()[Bcount]; + NewRefs[B] += reads[B].RefSeq.c_str()[Bcount]; + NewCigars[B] += reads[B].cigarString.c_str()[Bcount]; + + Bcount++; + } else if (reads[B].cigarString.c_str()[Bcount] == 'M' or reads[B].cigarString.c_str()[Bcount] == 'X' or + reads[B].cigarString.c_str()[Bcount] == 'D') { + currentPos.push_back(reads[B].Positions[Bcount]); + currentChr.push_back(reads[B].ChrPositions[Bcount]); + BLastGoodRef = reads[B].Positions[Bcount]; + BLastGoodChr = reads[B].ChrPositions[Bcount]; + + NewSeqs[B] += reads[B].seq.c_str()[Bcount]; + NewQuals[B] += reads[B].qual.c_str()[Bcount]; + NewRefs[B] += reads[B].RefSeq.c_str()[Bcount]; + NewCigars[B] += reads[B].cigarString.c_str()[Bcount]; + + Bcount++; + } else if (reads[B].cigarString.c_str()[Bcount] == 'I') { + currentPos.push_back(BLastGoodRef); + currentChr.push_back(BLastGoodChr); + + NewSeqs[B] += reads[B].seq.c_str()[Bcount]; + NewQuals[B] += reads[B].qual.c_str()[Bcount]; + NewRefs[B] += reads[B].RefSeq.c_str()[Bcount]; + NewCigars[B] += reads[B].cigarString.c_str()[Bcount]; + + Bcount++; + } else + cout << "WTF, cigar = " << reads[B].cigarString.c_str()[Bcount]; - //write - for (int i =0; i< reads.size(); i++) - { - reads[i].Positions.clear(); - reads[i].ChrPositions.clear(); - reads[i].seq = NewSeqs[i]; - reads[i].qual = NewQuals[i]; - reads[i].RefSeq = NewRefs[i]; - reads[i].cigarString = NewCigars[i]; - for (int j = 0; j NewPos; + vector NewChr; + + char LastAlignedQ = ' '; + int LastAlignedPos = -1; + string LastAlignedChr = "nope"; + + + //set LastAlignedPos to the first base with an aligned base + bool notfound = true; + int base = 0; + while (notfound) { + for (int i = 0; i < reads.size(); i++) { + if (reads[i].Positions[base] > -1) { + LastAlignedPos = reads[i].Positions[base]; + LastAlignedChr = reads[i].ChrPositions[base]; + notfound = false; + break; + } + } + if (notfound) + base++; + } + for (int i = 0; i < base; i++) { + + NewCigar += reads[A].cigarString.c_str()[i]; + NewSeq += reads[A].seq.c_str()[i]; + NewQual += reads[A].qual.c_str()[i]; + NewRef += reads[A].RefSeq.c_str()[i]; + NewPos.push_back(reads[A].Positions[i]); + NewChr.push_back(reads[A].ChrPositions[i]); + } + //corect qualites so everyone has the same ones, H will produce no quality + cout << "checking quals" << endl; + string bestQual = reads[0].qual; + for (int i = 0; i < reads.size(); i++) { + bool h = false; + cout << "read " << reads[i].name << endl; + for (int j = 0; j < reads[i].RefSeq.size(); j++) { + if (reads[i].RefSeq.c_str()[j] == 'H') { + h = true; + } + } + if (h) { + cout << "contains H" << reads[i].RefSeq << endl; + } else { + cout << "does not contain H " << reads[i].RefSeq << endl; + bestQual = reads[i].qual; + } - bool deletion = true; - string NewCigar = ""; - string NewSeq = ""; - string NewQual = ""; - string NewRef = ""; - vectorNewPos; - vector NewChr; - - char LastAlignedQ = ' '; - int LastAlignedPos = -1; - string LastAlignedChr = "nope"; - - - //set LastAlignedPos to the first base with an aligned base - bool notfound = true; - int base = 0; - while (notfound) - { - for (int i = 0; i< reads.size(); i++) - { - if (reads[i].Positions[base] > -1) - { - LastAlignedPos = reads[i].Positions[base]; - LastAlignedChr = reads[i].ChrPositions[base]; - notfound = false; - break; - } - } - if (notfound) - base++; - } - for (int i =0; i < base; i++) - { - NewCigar += reads[A].cigarString.c_str()[i]; - NewSeq +=reads[A].seq.c_str()[i]; - NewQual += reads[A].qual.c_str()[i]; - NewRef+= reads[A].RefSeq.c_str()[i]; - NewPos.push_back(reads[A].Positions[i]); - NewChr.push_back(reads[A].ChrPositions[i]); - } - //corect qualites so everyone has the same ones, H will produce no quality - cout << "checking quals" << endl; - string bestQual = reads[0].qual; - for (int i =0; i -1) //if this base is aligned in A - { -// cout << A << " is aligned " << reads[A].seq.c_str()[i] << " " << reads[A].Positions[i] << " " << reads[A].chr << endl; - if (reads[A].Positions[i] - LastAlignedPos > 1) //indicates a deletion - { - if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!' ) - { + for (int i = base; i < reads[A].seq.size(); i++) { +// cout << "base " << i << " of " << reads[A].seq.size() << " or " << reads[B].seq.size() << endl; + if (reads[A].Positions[i] > -1) //if this base is aligned in A + { +// cout << A << " is aligned " << reads[A].seq.c_str()[i] << " " << reads[A].Positions[i] << " " << reads[A].chr << endl; + if (reads[A].Positions[i] - LastAlignedPos > 1) //indicates a deletion + { + if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!') { // cout << "well fuck this shit A" << endl; - //return reads[A]; - } - //if(reads[A].ChrPositions[i] == LastAlignedChr and abs(reads[A].Positions[i] -LastAlignedPos ) < MaxVarentSize ) //must be on the same chromosome - if(reads[A].chr == reads[B].chr and abs(reads[A].Positions[i] -LastAlignedPos ) <= (MaxVarentSize+1000) ) //must be on the same chromosome - { + //return reads[A]; + } + //if(reads[A].ChrPositions[i] == LastAlignedChr and abs(reads[A].Positions[i] -LastAlignedPos ) < MaxVarentSize ) //must be on the same chromosome + if (reads[A].chr == reads[B].chr and abs(reads[A].Positions[i] - LastAlignedPos) <= + (MaxVarentSize + 1000)) //must be on the same chromosome + { // cout << "wel this dosnt make any sense" << endl; //reads are in order in the bam so A should always be downstream of B, theus the deletion shoould be detected in B - BEDBigStuff << reads[A].chr << "\t" << LastAlignedPos << "\t" << reads[A].Positions[i] << "\t" << "Deletion" << endl; - for (int j = LastAlignedPos; j= MaxVarentSize ) - if( reads[A].chr == reads[B].chr and abs(reads[A].Positions[i] -LastAlignedPos ) >= MaxVarentSize + 1000 ) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + BEDBigStuff << reads[A].chr << "\t" << LastAlignedPos << "\t" << reads[A].Positions[i] << "\t" + << "Deletion" << endl; + for (int j = LastAlignedPos; j < reads[A].Positions[i] - 1; j++) { + NewCigar += 'D'; + NewSeq += '-'; + NewQual += LastAlignedQ; + NewRef += toupper(Reff.getSubSequence(reads[A].chr, i, 1).c_str()[0]); + NewPos.push_back(j); + NewChr.push_back(reads[A].ChrPositions[i]); + } + } else { + //if( reads[A].ChrPositions[i] == LastAlignedChr and abs(reads[A].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) + if (reads[A].chr == reads[B].chr and + abs(reads[A].Positions[i] - LastAlignedPos) >= MaxVarentSize + 1000) { + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Too Big, Same strand and chr "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + if ( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { + cout << "INVERSION written to file" << endl; + Translocations << "Too Big, Same strand and chr " + << abs(reads[A].Positions[i] - LastAlignedPos) << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 << "\t" + << reads[A].Positions[Abreak] + 200 << endl << reads[B].chr << "\t" + << reads[B].Positions[Bbreak] - 200 << "\t" + << reads[B].Positions[Bbreak] + 200 << endl; + } else { + cout << "INVERSION skipped" << endl; + } + // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + // { + // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + // } + } else { + if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5") or + (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5")) { + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0 ) - { - cout << "INVERSION written to file" << endl; - Translocations << "Possible mob event "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "mobil elemnt " << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + if ( /*1==1 or*/(reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { + cout << "INVERSION written to file" << endl; + Translocations << "Possible mob event " + << abs(reads[A].Positions[i] - LastAlignedPos) << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 + << "\t" << reads[A].Positions[Abreak] + 200 << endl + << reads[B].chr << "\t" << reads[B].Positions[Bbreak] - 200 + << "\t" << reads[B].Positions[Bbreak] + 200 << endl; + } else { + cout << "INVERSION skipped" << endl; + } + // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + // { + // Translocations << "mobil elemnt " << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + // } + } else { + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Translocataion, same strand "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "we got a translocation" << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - } - } - } - else if (reads[A].Positions[i] -LastAlignedPos < 0 and abs(reads[A].Positions[i] -LastAlignedPos ) <= MaxVarentSize +1000) // indicates a possible insertion or tandem duplication - { - if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!') - { - cout << "well fuck this shit B" << endl; - //return reads[A]; - } + if ( /*1==1 or*/(reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { + cout << "INVERSION written to file" << endl; + Translocations << "Translocataion, same strand " + << abs(reads[A].Positions[i] - LastAlignedPos) << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 + << "\t" << reads[A].Positions[Abreak] + 200 << endl + << reads[B].chr << "\t" << reads[B].Positions[Bbreak] - 200 + << "\t" << reads[B].Positions[Bbreak] + 200 << endl; + } else { + cout << "INVERSION skipped" << endl; + } + // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + // { + // Translocations << "we got a translocation" << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + // } + } + } + } + } else if (reads[A].Positions[i] - LastAlignedPos < 0 and abs(reads[A].Positions[i] - LastAlignedPos) <= + MaxVarentSize + + 1000) // indicates a possible insertion or tandem duplication + { + if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!') { + cout << "well fuck this shit B" << endl; + //return reads[A]; + } // cout << "this could be one A, last = " << LastAlignedPos << " Current = " << reads[A].Positions[i] << " chr = " << LastAlignedChr << " and " << reads[A].ChrPositions[i] << endl; // if (reads[A].ChrPositions[i] == LastAlignedChr ) - if (reads[A].chr == reads[B].chr ) - { - cout << "This is an insertion A at base " << i << endl; - BEDBigStuff << reads[A].chr << "\t" << reads[A].Positions[i] << "\t" << LastAlignedPos << "\tTandemDup" << endl; - cout << "tadem dup" << endl; - int j = 0; - for( j = i; j=0; k+= -1) - { - if (reads[A].Positions[k]+1 > 1) - break; - } - //cout << "j= " << reads[A].Positions[k]+1 << " < " << LastAlignedPos << " - " << endl; - for( j = reads[A].Positions[k]+1; j < LastAlignedPos; j++) - { - NewCigar += 'Y'; //'I'; - NewSeq += toupper(Reff.getSubSequence(reads[A].chr, j, 1).c_str()[0]); - NewQual += '!'; - NewRef+= '-'; - NewPos.push_back(j); - NewChr.push_back(reads[A].chr); - } - cout << "yaya finished" << endl; - - } - else - { - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + if (reads[A].chr == reads[B].chr) { + cout << "This is an insertion A at base " << i << endl; + BEDBigStuff << reads[A].chr << "\t" << reads[A].Positions[i] << "\t" << LastAlignedPos + << "\tTandemDup" << endl; + cout << "tadem dup" << endl; + int j = 0; + for (j = i; j < reads[A].seq.size() and reads[A].Positions[j] < LastAlignedPos; j++) { + NewCigar += 'Y'; //'I'; + NewSeq += reads[A].seq.c_str()[j]; + NewQual += reads[A].qual.c_str()[j]; + NewRef += '-'; + NewPos.push_back(reads[A].Positions[i]); + NewChr.push_back(reads[A].ChrPositions[i]); + } + i = j; + //find the last base that was aligned, htere can be novel insertion stuff so you cant jsut take the last base + int k; + for (k = reads[A].Positions.size() - 1; k >= 0; k += -1) { + if (reads[A].Positions[k] + 1 > 1) + break; + } + //cout << "j= " << reads[A].Positions[k]+1 << " < " << LastAlignedPos << " - " << endl; + for (j = reads[A].Positions[k] + 1; j < LastAlignedPos; j++) { + NewCigar += 'Y'; //'I'; + NewSeq += toupper(Reff.getSubSequence(reads[A].chr, j, 1).c_str()[0]); + NewQual += '!'; + NewRef += '-'; + NewPos.push_back(j); + NewChr.push_back(reads[A].chr); + } + cout << "yaya finished" << endl; + + } else { + if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5") or + (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5")) { + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0) - { + if ( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { // cout << "INVERSION written to file" << endl; - Translocations << "Possible mob event "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { + Translocations << "Possible mob event " << abs(reads[A].Positions[i] - LastAlignedPos) + << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 << "\t" + << reads[A].Positions[Abreak] + 200 << endl << reads[B].chr << "\t" + << reads[B].Positions[Bbreak] - 200 << "\t" + << reads[B].Positions[Bbreak] + 200 << endl; + } else { // cout << "INVERSION skipped" << endl; - } - //if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - //{ - // Translocations << "mobil elemnt " << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - //} - } - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + } + //if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + //{ + // Translocations << "mobil elemnt " << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + //} + } + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0) - { + if ( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { // cout << "INVERSION written to file" << endl; - Translocations << "Translocation, same strand "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { + Translocations << "Translocation, same strand " + << abs(reads[A].Positions[i] - LastAlignedPos) << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 << "\t" + << reads[A].Positions[Abreak] + 200 << endl << reads[B].chr << "\t" + << reads[B].Positions[Bbreak] - 200 << "\t" + << reads[B].Positions[Bbreak] + 200 << endl; + } else { // cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "we got a translocation" << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - - } - else if( reads[A].Positions[i] -LastAlignedPos < 0 and abs(reads[A].Positions[i] -LastAlignedPos ) >= MaxVarentSize +1000 ) - { - if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!') - { - cout << "well fuck this shit C" << endl; - - // return reads[A]; - } - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + } + // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + // { + // Translocations << "we got a translocation" << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + // } + } + + } else if (reads[A].Positions[i] - LastAlignedPos < 0 and + abs(reads[A].Positions[i] - LastAlignedPos) >= MaxVarentSize + 1000) { + if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!') { + cout << "well fuck this shit C" << endl; + + // return reads[A]; + } + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0) - { + if ( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { // cout << "INVERSION written to file" << endl; - if (reads[A].chr == reads[B].chr) - Translocations << "TOO BIG 3 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - else - Translocations << "Translocation 3 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { + if (reads[A].chr == reads[B].chr) + Translocations << "TOO BIG 3 " << abs(reads[A].Positions[i] - LastAlignedPos) << endl; + else + Translocations << "Translocation 3 " << abs(reads[A].Positions[i] - LastAlignedPos) << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 << "\t" + << reads[A].Positions[Abreak] + 200 << endl << reads[B].chr << "\t" + << reads[B].Positions[Bbreak] - 200 << "\t" + << reads[B].Positions[Bbreak] + 200 << endl; + } else { // cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } + } + // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + // { + // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + // } + } - - if (i -1) - { + + if (i < reads[A].cigarString.size()) { + NewCigar += reads[A].cigarString.c_str()[i]; + NewSeq += reads[A].seq.c_str()[i]; + NewQual += reads[A].qual.c_str()[i]; + NewRef += reads[A].RefSeq.c_str()[i]; + NewPos.push_back(reads[A].Positions[i]); + NewChr.push_back(reads[A].ChrPositions[i]); + LastAlignedQ = reads[A].qual.c_str()[i]; + LastAlignedPos = reads[A].Positions[i]; + LastAlignedChr = reads[A].ChrPositions[i]; + //cout << "A " << reads[A].seq.c_str()[i] << " " << reads[A].cigarString.c_str()[i] << " " << reads[A].RefSeq.c_str()[i] <<" " << reads[A].ChrPositions[i] << " " << reads[A].Positions[i] << NewSeq << endl; + } + } else if (reads[B].Positions[i] > -1) { // cout << B << " is aligned " << reads[A].seq.c_str()[i] << " " << reads[A].Positions[i] << " " << reads[A].chr << endl; - if (reads[B].Positions[i] - LastAlignedPos > 1) - { -// cout << B << " is aligned infront of A " << endl; - if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!') - { - - cout << "well fuck this shit D" << endl; - - //return reads[A]; - } - //if(reads[B].ChrPositions[i] == LastAlignedChr and abs(reads[B].Positions[i] - LastAlignedPos ) < MaxVarentSize ) - cout << "yup this one " << "abs(" << reads[B].Positions[i]<< " - " << LastAlignedPos <<" ) < " << MaxVarentSize << endl; - cout << abs(reads[B].Positions[i] - LastAlignedPos ) << endl; - if(reads[B].chr == reads[A].chr and abs(reads[B].Positions[i] - LastAlignedPos ) <= MaxVarentSize +1000 ) - { - cout << "striahgtup deletion, size = " << abs(reads[B].Positions[i] -LastAlignedPos ) << " at base " << i << " from Position " << LastAlignedPos << " to " << reads[B].Positions[i] << endl; - BEDBigStuff << reads[B].chr << "\t" << LastAlignedPos << "\t" << reads[B].Positions[i] << "\t" << "Deletion" << endl; - cout << "Inserting reff sequence from " << LastAlignedPos+1 << " to " << reads[B].Positions[i] << " = " << reads[B].Positions[i]-LastAlignedPos << endl; - for (int j = LastAlignedPos; j< reads[B].Positions[i]-1; j++) - { - //cout << j << " - " << j - LastAlignedPos<< endl; - NewCigar += 'D'; - NewSeq += '-'; - NewQual += LastAlignedQ; - NewRef+= toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); - NewPos.push_back(j); - NewChr.push_back(reads[B].ChrPositions[i]); - - // char tmp = toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); - // cout << "R " << '-' << " " << 'D' << " " << tmp << " " << reads[B].chr << " " << j << " " << NewSeq << endl; - // cout << "R " << '-' << " " << 'D' << " " << tmp << " " << reads[B].chr << " " << j << " " << NewRef << endl << endl; - } - cout << "done inserting sequence" << endl; - } - else - { - cout << "fond one way too big" << endl; - // if( reads[A].ChrPositions[i] == LastAlignedChr and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - if( reads[A].chr == reads[B].chr and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize +1000 ) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + if (reads[B].Positions[i] - LastAlignedPos > 1) { +// cout << B << " is aligned infront of A " << endl; + if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!') { + + cout << "well fuck this shit D" << endl; + + //return reads[A]; + } + //if(reads[B].ChrPositions[i] == LastAlignedChr and abs(reads[B].Positions[i] - LastAlignedPos ) < MaxVarentSize ) + cout << "yup this one " << "abs(" << reads[B].Positions[i] << " - " << LastAlignedPos << " ) < " + << MaxVarentSize << endl; + cout << abs(reads[B].Positions[i] - LastAlignedPos) << endl; + if (reads[B].chr == reads[A].chr and + abs(reads[B].Positions[i] - LastAlignedPos) <= MaxVarentSize + 1000) { + cout << "striahgtup deletion, size = " << abs(reads[B].Positions[i] - LastAlignedPos) + << " at base " << i << " from Position " << LastAlignedPos << " to " + << reads[B].Positions[i] << endl; + BEDBigStuff << reads[B].chr << "\t" << LastAlignedPos << "\t" << reads[B].Positions[i] << "\t" + << "Deletion" << endl; + cout << "Inserting reff sequence from " << LastAlignedPos + 1 << " to " << reads[B].Positions[i] + << " = " << reads[B].Positions[i] - LastAlignedPos << endl; + for (int j = LastAlignedPos; j < reads[B].Positions[i] - 1; j++) { + //cout << j << " - " << j - LastAlignedPos<< endl; + NewCigar += 'D'; + NewSeq += '-'; + NewQual += LastAlignedQ; + NewRef += toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); + NewPos.push_back(j); + NewChr.push_back(reads[B].ChrPositions[i]); + + // char tmp = toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); + // cout << "R " << '-' << " " << 'D' << " " << tmp << " " << reads[B].chr << " " << j << " " << NewSeq << endl; + // cout << "R " << '-' << " " << 'D' << " " << tmp << " " << reads[B].chr << " " << j << " " << NewRef << endl << endl; + } + cout << "done inserting sequence" << endl; + } else { + cout << "fond one way too big" << endl; + // if( reads[A].ChrPositions[i] == LastAlignedChr and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) + if (reads[A].chr == reads[B].chr and + abs(reads[B].Positions[i] - LastAlignedPos) >= MaxVarentSize + 1000) { + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "TOO BIG 2 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + if ( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { + cout << "INVERSION written to file" << endl; + Translocations << "TOO BIG 2 " << abs(reads[A].Positions[i] - LastAlignedPos) << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 << "\t" + << reads[A].Positions[Abreak] + 200 << endl << reads[B].chr << "\t" + << reads[B].Positions[Bbreak] - 200 << "\t" + << reads[B].Positions[Bbreak] + 200 << endl; + } else { + cout << "INVERSION skipped" << endl; + } + // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + // { + // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + // } + } else { + if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5") or + (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5")) { + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0) - { + if ( /*1==1 or*/(reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { // cout << "INVERSION written to file" << endl; - Translocations << "Possible mob event "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { + Translocations << "Possible mob event " + << abs(reads[A].Positions[i] - LastAlignedPos) << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 + << "\t" << reads[A].Positions[Abreak] + 200 << endl + << reads[B].chr << "\t" << reads[B].Positions[Bbreak] - 200 + << "\t" << reads[B].Positions[Bbreak] + 200 << endl; + } else { // cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "mobil elemnt " << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + } + // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + // { + // Translocations << "mobil elemnt " << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + // } + } else { + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0) - { + if ( /*1==1 or*/(reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { // cout << "INVERSION written to file" << endl; - Translocations << "Translocation 2 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { + Translocations << "Translocation 2 " << abs(reads[A].Positions[i] - LastAlignedPos) + << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 + << "\t" << reads[A].Positions[Abreak] + 200 << endl + << reads[B].chr << "\t" << reads[B].Positions[Bbreak] - 200 + << "\t" << reads[B].Positions[Bbreak] + 200 << endl; + } else { // cout << "INVERSION skipped" << endl; - } - - - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "we got a translocation" << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - } - } - - } - else if (reads[B].Positions[i] -LastAlignedPos < 0 and abs(reads[B].Positions[i] - LastAlignedPos ) < MaxVarentSize +1000 ) // indicates a possible insertion or tandem duplication - { - cout << "IN POSSIBLE TANDEM DUP BIT" << endl; - if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!' ) - { - cout << "well fuck this shit E" << endl; - - // return reads[A]; - } - // cout << "this could be one B, last = " << LastAlignedPos << " Current = " << reads[B].Positions[i] << " chr = " << LastAlignedChr << " and " << reads[B].ChrPositions[i] << endl; - //if (reads[B].ChrPositions[i] == LastAlignedChr - if (reads[B].chr == reads[A].chr ) - { + } + + + // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + // { + // Translocations << "we got a translocation" << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + // } + } + } + } + + } else if (reads[B].Positions[i] - LastAlignedPos < 0 and abs(reads[B].Positions[i] - LastAlignedPos) < + MaxVarentSize + + 1000) // indicates a possible insertion or tandem duplication + { + cout << "IN POSSIBLE TANDEM DUP BIT" << endl; + if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!') { + cout << "well fuck this shit E" << endl; + + // return reads[A]; + } + // cout << "this could be one B, last = " << LastAlignedPos << " Current = " << reads[B].Positions[i] << " chr = " << LastAlignedChr << " and " << reads[B].ChrPositions[i] << endl; + //if (reads[B].ChrPositions[i] == LastAlignedChr + if (reads[B].chr == reads[A].chr) { // cout << "This is an insertion B at base " << i << endl; - BEDBigStuff << reads[B].chr << "\t" << reads[B].Positions[i] << "\t" << LastAlignedPos << "\tTandemDup" << endl; - // cout << "tadem dup" << endl; - int j = 0; - for(j = i; j < reads[B].seq.size() and reads[B].Positions[j] <= LastAlignedPos; j++) - { - NewCigar += 'Y'; - NewSeq += reads[B].seq.c_str()[j]; - NewQual += reads[B].qual.c_str()[j]; - NewRef+= '-'; - NewPos.push_back(reads[B].Positions[i]); - NewChr.push_back(reads[B].ChrPositions[i]); - } - i=j; - //need to find last base that was alinged, insetion can mess this up so you can just take the last base pos - int k; - for (k =reads[B].Positions.size()-1; k >=0; k+= -1) - { - if (reads[B].Positions[k]+1 > 1) - break; - } - //cout << "j= " << reads[B].Positions[k]+1 << " < " << LastAlignedPos << " - " << endl; - for( j = reads[B].Positions[k]+1; j < LastAlignedPos; j++) - { - NewCigar += 'Y'; - NewSeq += toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); - NewQual += '!'; - NewRef+= '-'; - NewPos.push_back(j); - NewChr.push_back(reads[B].chr); - } - - } - else - { + BEDBigStuff << reads[B].chr << "\t" << reads[B].Positions[i] << "\t" << LastAlignedPos + << "\tTandemDup" << endl; + // cout << "tadem dup" << endl; + int j = 0; + for (j = i; j < reads[B].seq.size() and reads[B].Positions[j] <= LastAlignedPos; j++) { + NewCigar += 'Y'; + NewSeq += reads[B].seq.c_str()[j]; + NewQual += reads[B].qual.c_str()[j]; + NewRef += '-'; + NewPos.push_back(reads[B].Positions[i]); + NewChr.push_back(reads[B].ChrPositions[i]); + } + i = j; + //need to find last base that was alinged, insetion can mess this up so you can just take the last base pos + int k; + for (k = reads[B].Positions.size() - 1; k >= 0; k += -1) { + if (reads[B].Positions[k] + 1 > 1) + break; + } + //cout << "j= " << reads[B].Positions[k]+1 << " < " << LastAlignedPos << " - " << endl; + for (j = reads[B].Positions[k] + 1; j < LastAlignedPos; j++) { + NewCigar += 'Y'; + NewSeq += toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); + NewQual += '!'; + NewRef += '-'; + NewPos.push_back(j); + NewChr.push_back(reads[B].chr); + } + + } else { // cout << "we got a translocation" << endl; - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { + if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5") or + (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5")) { // cout << "mobil elemnt " << endl; - //reads[A].write(); - //reads[B].write(); - } - } + //reads[A].write(); + //reads[B].write(); + } + } - } - else if( reads[B].Positions[i] -LastAlignedPos < 0 and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize +1000 ) - { - if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!') - { - cout << "well fuck this shit F" << endl; - //return reads[A]; - } - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + } else if (reads[B].Positions[i] - LastAlignedPos < 0 and + abs(reads[B].Positions[i] - LastAlignedPos) >= MaxVarentSize + 1000) { + if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!') { + cout << "well fuck this shit F" << endl; + //return reads[A]; + } + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0) - { + if ( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and + Abreak > 0 and Bbreak > 0) { // cout << "INVERSION written to file" << endl; - Translocations << "TOO BIG 1 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { + Translocations << "TOO BIG 1 " << abs(reads[A].Positions[i] - LastAlignedPos) << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 << "\t" + << reads[A].Positions[Abreak] + 200 << endl << reads[B].chr << "\t" + << reads[B].Positions[Bbreak] - 200 << "\t" + << reads[B].Positions[Bbreak] + 200 << endl; + } else { // cout << "INVERSION skipped" << endl; - } - - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } + } + + // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) + // { + // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; + // reads[A].writetofile(Translocations); + // reads[B].writetofile(Translocations); + // Translocations << endl << endl; + // } + } - if(i= 0; i--) { + if (NewCigar.c_str()[i] != 'S' and NewCigar.c_str()[i] != 'H') { + Last = i; + break; + } + } - //fix inernal S bases - int First = -1; - int Last = -1; - string NewNewCigar = ""; - for (int i =0; i < NewCigar.size(); i++) - { - if(NewCigar.c_str()[i] != 'S' and NewCigar.c_str()[i] != 'H') - { - First = i; - break; - } - } - for (int i = NewCigar.size() -1; i>=0; i--) - { - if(NewCigar.c_str()[i] != 'S' and NewCigar.c_str()[i] != 'H') - { - Last = i; - break; - } - } + for (int i = 0; i < NewCigar.size(); i++) { + if (i > First and i < Last) { + if (NewCigar.c_str()[i] == 'S' or NewCigar.c_str()[i] == 'H') + NewNewCigar += 'I'; + else + NewNewCigar += NewCigar.c_str()[i]; + } else + NewNewCigar += NewCigar.c_str()[i]; - for (int i = 0; i First and i < Last) - { - if (NewCigar.c_str()[i] == 'S' or NewCigar.c_str()[i] == 'H') - NewNewCigar+= 'I'; - else - NewNewCigar+=NewCigar.c_str()[i]; - } - else - NewNewCigar+=NewCigar.c_str()[i]; - - } - NewCigar = NewNewCigar; - - int UnalignedCount = 0; - for (int i =0; i 0 and Bbreak > 0 - if( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1) and ( reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0) - { + //if( /*1==1 or*/ reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1 or reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0 + if ( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and Abreak > 0 and + Bbreak > 0) { // cout << "INVERSION written to file" << endl; - Translocations << "INVERSION" << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { + Translocations << "INVERSION" << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 << "\t" + << reads[A].Positions[Abreak] + 200 << endl << reads[B].chr << "\t" + << reads[B].Positions[Bbreak] - 200 << "\t" << reads[B].Positions[Bbreak] + 200 + << endl; + } else { // cout << "INVERSION skipped" << endl; - } - string Acig = ""; - string Bcig = ""; - for (int i = 0; i < reads[A].seq.size(); i++) - { - char Ab = reads[A].cigarString.c_str()[i]; - char Bb = reads[B].cigarString.c_str()[i]; - if ((reads[A].cigarString.c_str()[i] == 'M' or reads[A].cigarString.c_str()[i] == 'X') and (reads[B].cigarString.c_str()[i] == 'S' or reads[B].cigarString.c_str()[i] == 'H')) - Bb = 'U'; - if ((reads[B].cigarString.c_str()[i] == 'M' or reads[B].cigarString.c_str()[i] == 'X') and (reads[A].cigarString.c_str()[i] == 'S' or reads[A].cigarString.c_str()[i] == 'H')) - Ab = 'U'; - Acig += Ab; - Bcig += Bb; - - } - reads[A].cigarString = Acig; - reads[B].cigarString = Bcig; -// cout << "invertion adjust string"; -// reads[A].write(); -// reads[B].write(); - } - else if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + } + string Acig = ""; + string Bcig = ""; + for (int i = 0; i < reads[A].seq.size(); i++) { + char Ab = reads[A].cigarString.c_str()[i]; + char Bb = reads[B].cigarString.c_str()[i]; + if ((reads[A].cigarString.c_str()[i] == 'M' or reads[A].cigarString.c_str()[i] == 'X') and + (reads[B].cigarString.c_str()[i] == 'S' or reads[B].cigarString.c_str()[i] == 'H')) + Bb = 'U'; + if ((reads[B].cigarString.c_str()[i] == 'M' or reads[B].cigarString.c_str()[i] == 'X') and + (reads[A].cigarString.c_str()[i] == 'S' or reads[A].cigarString.c_str()[i] == 'H')) + Ab = 'U'; + Acig += Ab; + Bcig += Bb; + + } + reads[A].cigarString = Acig; + reads[B].cigarString = Bcig; +// cout << "invertion adjust string"; +// reads[A].write(); +// reads[B].write(); + } else if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5") or + (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5")) { + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0 - if( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1) and ( reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0) - { - Translocations << "mobil elemnt inverted" << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - } - else - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); + //if( /*1==1 or*/ reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1 or reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0 + if ( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and Abreak > 0 and + Bbreak > 0) { + Translocations << "mobil elemnt inverted" << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 << "\t" + << reads[A].Positions[Abreak] + 200 << endl << reads[B].chr << "\t" + << reads[B].Positions[Bbreak] - 200 << "\t" << reads[B].Positions[Bbreak] + 200 + << endl; + } + } else { + int Abreak = findBreak(reads[A]); + int Bbreak = findBreak(reads[B]); // cout << " if( "< 0 and Bbreak > 0 - if( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1) and ( reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0) - { - Translocations << "we got a translocation and invertion" << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - } + //if( /*1==1 or*/ reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1 or reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0 + if ( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak - 1] == 1) and + (reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak - 1] == 1) and Abreak > 0 and + Bbreak > 0) { + Translocations << "we got a translocation and invertion" << endl; + reads[A].writetofile(Translocations); + reads[B].writetofile(Translocations); + Translocations << endl << endl; + Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak] - 200 << "\t" + << reads[A].Positions[Abreak] + 200 << endl << reads[B].chr << "\t" + << reads[B].Positions[Bbreak] - 200 << "\t" << reads[B].Positions[Bbreak] + 200 + << endl; + } + } - -// cout << "*********SKIPPING************\ndifference strands" << endl; - BEDNotHandled << "Different strands" << endl; - BEDNotHandled << reads[A].chr << "\t" << reads[A].pos << "\t" << reads[A].pos+reads[A].seq.size() << "\t" << reads[A].name << "\t" << reads[A].cigar << endl; - reads[A].writetofile(BEDNotHandled); - BEDNotHandled << reads[B].chr << "\t" << reads[B].pos << "\t" << reads[B].pos+reads[B].seq.size() << "\t" << reads[B].name << "\t" << reads[B].cigar << endl; - reads[B].writetofile(BEDNotHandled); - - BEDNotHandled << endl << endl; +// cout << "*********SKIPPING************\ndifference strands" << endl; + BEDNotHandled << "Different strands" << endl; + BEDNotHandled << reads[A].chr << "\t" << reads[A].pos << "\t" << reads[A].pos + reads[A].seq.size() << "\t" + << reads[A].name << "\t" << reads[A].cigar << endl; + reads[A].writetofile(BEDNotHandled); + BEDNotHandled << reads[B].chr << "\t" << reads[B].pos << "\t" << reads[B].pos + reads[B].seq.size() << "\t" + << reads[B].name << "\t" << reads[B].cigar << endl; + reads[B].writetofile(BEDNotHandled); + + BEDNotHandled << endl << endl; + + + Invertions << reads[A].chr << "\t" << reads[A].pos << "\t" << reads[B].pos << "\t" + << reads[B].pos - reads[A].pos << endl; + + } + cout << "made it here" << endl; + //**********************Adding K-mer lookup stuff here ********************************* + + //************************************************************************************** + //reads[A].FixTandemRef(); + if (reads[B].phase != "none" && reads[A].phase == "none") { + reads[A].phase == reads[B].phase; + } + //cout << "starting kmer lookup" << endl; + reads[A].LookUpKmers(); + //cout << "ReAdjustedKmers" < longest) { longest = count; } + count = 0; + } - } - cout << "made it here" << endl; - //**********************Adding K-mer lookup stuff here ********************************* - - //************************************************************************************** - //reads[A].FixTandemRef(); - if (reads[B].phase != "none" && reads[A].phase == "none") - { - reads[A].phase == reads[B].phase; - } - //cout << "starting kmer lookup" << endl; - reads[A].LookUpKmers(); - //cout << "ReAdjustedKmers" < longest) { longest = count; } + return longest; } -int SamRead::CheckBasesAligned() -{ - int longest = 0; - int count = 0; - for ( int j = 0; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] != 'H' and cigarString.c_str()[j] != 'S') - {count++; } - else - { - if (count > longest){longest = count;} - count = 0; - } - - } - if (count > longest){longest = count;} - return longest; + +bool SamRead::CheckEndsAlign() { + int StartAlign = 0; + int j; + for (j = 10; j < cigarString.size(); j++) { + if (cigarString.c_str()[j] != 'H' and cigarString.c_str()[j] != 'S') { StartAlign++; } + else { break; } + } + int EndAlign = 0; + int i; + for (i = cigarString.size() - 10; i >= 0; i--) { + if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') { EndAlign++; } + else { break; } + } + + if (StartAlign > 20 or EndAlign > 20) { + return true; + } + + return false; } -bool SamRead::CheckEndsAlign() -{ - int StartAlign = 0; - int j; - for ( j = 10; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] != 'H' and cigarString.c_str()[j] != 'S') - {StartAlign++;} - else - {break;} - } - int EndAlign = 0; - int i; - for ( i = cigarString.size()-10; i>=0; i--) - { - if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') - {EndAlign++;} - else - {break;} - } - if (StartAlign > 20 or EndAlign > 20) - { - return true; - } -return false; +bool SamRead::StartsWithAlignAtPeak(int &pos, string &insert, int &Kdepth) { + //cout << "starst with " << endl; + /////////////////// + int EndClip = 0; + int i; + int PeakBases = 0; + for (i = cigarString.size() - 1; i >= 0; i--) { + if (cigarString.c_str()[i] == 'H' or cigarString.c_str()[i] == 'S') { + EndClip++; + if (PeakMap[i] == 1) { PeakBases++; } + } + else { break; } + } + //get the inserted sequence + for (int s = i; s < cigarString.size(); s++) { + insert = insert + seq[s]; + } + ///////////////////// + int StartAlign = 0; + int j; + for (j = 0; j < cigarString.size(); j++) { + if (cigarString.c_str()[j] != 'H' and cigarString.c_str()[j] != 'S') { StartAlign++; } + else { break; } + } + ///////////////////// + //cout << "pos = " << j << " - " << Positions[j] << endl; + pos = Positions[j]; + Kdepth = (int) qual.c_str()[i] - 33; + if (EndClip > 40 && StartAlign > 40) { + if ((PeakMap[i - 1] or PeakMap[i] or PeakMap[i + 1]) and + (PeakMap[j - 1] or PeakMap[j] or PeakMap[j + 1]) or PeakBases > 10) { return true; } + } + + + return false; } +bool SamRead::StartsWithAlign(int &pos, string &insert) { + //cout << "starst with " << endl; + /////////////////// + int EndClip = 0; + int i; + for (i = cigarString.size() - 1; i >= 0; i--) { + if (cigarString.c_str()[i] == 'H' or cigarString.c_str()[i] == 'S') { EndClip++; } + else { break; } + } + //get the inserted sequence + for (int s = i; s < cigarString.size(); s++) { + insert = insert + seq[s]; + } + ///////////////////// + int StartAlign = 0; + int j; + for (j = 0; j < cigarString.size(); j++) { + if (cigarString.c_str()[j] != 'H' and cigarString.c_str()[j] != 'S') { StartAlign++; } + else { break; } + } + ///////////////////// + //cout << "pos = " << j << " - " << Positions[j] << endl; + pos = Positions[j]; + if (EndClip > 40 && StartAlign > 40) { + + { return true; } + } + + + return false; +} -bool SamRead::StartsWithAlignAtPeak(int &pos, string &insert, int &Kdepth) -{ - //cout << "starst with " << endl; - /////////////////// - int EndClip = 0; - int i; - int PeakBases = 0; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] == 'H' or cigarString.c_str()[i] == 'S') - {EndClip++;if (PeakMap[i]==1){PeakBases++;}} - else - {break;} - } - //get the inserted sequence - for (int s = i; s 40 && StartAlign > 40) - { - if ((PeakMap[i-1] or PeakMap[i] or PeakMap[i+1]) and (PeakMap[j-1] or PeakMap[j] or PeakMap[j+1])or PeakBases > 10) - {return true;} - } - - - return false; - } -bool SamRead::StartsWithAlign(int &pos, string &insert) -{ - //cout << "starst with " << endl; - /////////////////// - int EndClip = 0; - int i; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] == 'H' or cigarString.c_str()[i] == 'S') - {EndClip++;} - else - {break;} - } - //get the inserted sequence - for (int s = i; s 40 && StartAlign > 40) - { - - {return true;} - } - - - return false; - } -bool SamRead::EndsWithAlignAtPeak(int &pos, string &insert, int &Kdepth) -{ - //cout << "Running EndsWithAlign" << endl; - //////////////////// - int EndAlign = 0; - int i; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') - {EndAlign++;} - else - {break;} - } - pos = Positions[i+1]; - //cout << "EndAlign = " << EndAlign << endl; - /////////////////// - int StartClip = 0; - int j; - int PeakBases = 0; - for ( j = 0; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] == 'H' or cigarString.c_str()[j] == 'S') - {StartClip++; if (PeakMap[j]==1){PeakBases++;}} - else - {break;} - } - //cout << "StartClip = " << StartClip << endl; - - for (int s = 0; s 40 && StartClip > 40) - { - if ((PeakMap[i-1] or PeakMap[i] or PeakMap[i+1]) and (PeakMap[j-1] or PeakMap[j] or PeakMap[j+1])or PeakBases > 10 ) - {return true;} - } - - - return false; - } -bool SamRead::EndsWithAlign(int &pos, string &insert) -{ - //cout << "Running EndsWithAlign" << endl; - //////////////////// - int EndAlign = 0; - int i; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') - {EndAlign++;} - else - {break;} - } - pos = Positions[i+1]; - //cout << "EndAlign = " << EndAlign << endl; - /////////////////// - int StartClip = 0; - int j; - for ( j = 0; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] == 'H' or cigarString.c_str()[j] == 'S') - {StartClip++; } - else - {break;} - } - //cout << "StartClip = " << StartClip << endl; - for (int s = 0; s 40 && StartClip > 40) - { - - {return true;} - } +bool SamRead::EndsWithAlignAtPeak(int &pos, string &insert, int &Kdepth) { + //cout << "Running EndsWithAlign" << endl; + //////////////////// + int EndAlign = 0; + int i; + for (i = cigarString.size() - 1; i >= 0; i--) { + if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') { EndAlign++; } + else { break; } + } + pos = Positions[i + 1]; + //cout << "EndAlign = " << EndAlign << endl; + /////////////////// + int StartClip = 0; + int j; + int PeakBases = 0; + for (j = 0; j < cigarString.size(); j++) { + if (cigarString.c_str()[j] == 'H' or cigarString.c_str()[j] == 'S') { + StartClip++; + if (PeakMap[j] == 1) { PeakBases++; } + } + else { break; } + } + //cout << "StartClip = " << StartClip << endl; + for (int s = 0; s < j; s++) { insert = insert + seq[s]; } + Kdepth = (int) qual.c_str()[i] - 33; + if (EndAlign > 40 && StartClip > 40) { + if ((PeakMap[i - 1] or PeakMap[i] or PeakMap[i + 1]) and + (PeakMap[j - 1] or PeakMap[j] or PeakMap[j + 1]) or PeakBases > 10) { return true; } + } - return false; - } -bool CheckTranslocation(SamRead read) -{ - return false; + return false; } -bool CheckMob(SamRead read) -{ - return false; -} -bool CheckPolyATail(SamRead read) -{ - return false; + +bool SamRead::EndsWithAlign(int &pos, string &insert) { + //cout << "Running EndsWithAlign" << endl; + //////////////////// + int EndAlign = 0; + int i; + for (i = cigarString.size() - 1; i >= 0; i--) { + if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') { EndAlign++; } + else { break; } + } + pos = Positions[i + 1]; + //cout << "EndAlign = " << EndAlign << endl; + /////////////////// + int StartClip = 0; + int j; + for (j = 0; j < cigarString.size(); j++) { + if (cigarString.c_str()[j] == 'H' or cigarString.c_str()[j] == 'S') { StartClip++; } + else { break; } + } + //cout << "StartClip = " << StartClip << endl; + for (int s = 0; s < j; s++) { insert = insert + seq[s]; } + + if (EndAlign > 40 && StartClip > 40) { + + { return true; } + } + + + return false; } -bool CheckLargeInsert(SamRead read) -{ - return false; + +bool CheckTranslocation(SamRead read) { + return false; } -string InterpretTargetSize(int size) -{ - if( size == 1) - return "I"; - else if(size == -1) - return "Y"; - else if(size == 0) - return ""; - else if(size == 2) - return "YY"; - else if(size == -2) - return "DD"; - else if(size >2) - { - stringstream ss; - ss << abs(size) << "Y"; - return ss.str(); - } - else if(size <-2) - { - stringstream ss; - ss << abs(size) << "D"; - return ss.str(); - } - else - cout << "ERROR not handeled insert size" << endl; - return "ERROR"; + +bool CheckMob(SamRead read) { + return false; } -bool checkMobSupAalign(vector R ) -{ - //if (reads[i].alignments.size()> 1) - //{ - // bool good = false; - // for (int j = 1; j< reads[i].alignments.size(); j++) - // { - // if (reads[reads[i].alignments[j]].mapQual > 30) - // good = true; - // } - // if (good) - // return false; - // else - // return true; - //} - //else return true; - return true; + +bool CheckPolyATail(SamRead read) { + return false; } -string GetUnalignedCenter(SamRead A, SamRead B) -{ - //need to test before you call this that the contigs are on the same strand and have the proper clipPattern - //cout << "GetUnalignedCenter" << endl; - //A.write(); - //B.write(); - bool internal = false; - bool Afirst = false; - bool Bfirst = false; - string Return = ""; - if (A.seq.size() == B.seq.size()) - { - int i = 0; - for(i = 0; i < A.seq.size(); i++) - { - if ((A.cigarString.c_str()[i] != 'S' && A.cigarString.c_str()[i] != 'H') && (B.cigarString.c_str()[i] == 'S' || B.cigarString.c_str()[i] == 'H')) - { - Afirst = true; - break; - } - else if ((B.cigarString.c_str()[i] != 'S' && B.cigarString.c_str()[i] != 'H') && (A.cigarString.c_str()[i] == 'S' || A.cigarString.c_str()[i] == 'H')) - { - Bfirst = true; - break; - } - } - for( i = i; i < A.seq.size(); i++) - { - if (Afirst) - { - if ((A.cigarString.c_str()[i] != 'S' && A.cigarString.c_str()[i] != 'H') && (B.cigarString.c_str()[i] == 'S' || B.cigarString.c_str()[i] == 'H')) - {} - else if ((A.cigarString.c_str()[i] == 'S' || A.cigarString.c_str()[i] != 'H') && (B.cigarString.c_str()[i] == 'S' || B.cigarString.c_str()[i] == 'H')) - { - Return += A.seq.c_str()[i]; - } - else - return Return; - } - else if (Bfirst) - { - if ((B.cigarString.c_str()[i] != 'S' && B.cigarString.c_str()[i] != 'H') && (A.cigarString.c_str()[i] == 'S' || A.cigarString.c_str()[i] == 'H')) - {} - else if ((B.cigarString.c_str()[i] == 'S' || B.cigarString.c_str()[i] != 'H') && (A.cigarString.c_str()[i] == 'S' || A.cigarString.c_str()[i] == 'H')) - { - Return += A.seq.c_str()[i]; - } - else - return Return; - } - else - { - cout << "WARNING GetUnaligedCenter no one is first" << endl; - return ""; - } - } - } - else - { - cout << "GetUnalignedCenter WARNING, seq not the same size" << endl; - } - - return ""; +bool CheckLargeInsert(SamRead read) { + return false; } -string InterpretInsertSize(string s) -{ - if (s.size() ==0) - return ""; - else if (s.size() ==1) - return "I"; - else if (s.size() == 2) - return "II"; - else if (s.size() > 2) - { - stringstream a; - a << s.size(); - a << "I"; - return a.str(); - } - return ""; + +string InterpretTargetSize(int size) { + if (size == 1) + return "I"; + else if (size == -1) + return "Y"; + else if (size == 0) + return ""; + else if (size == 2) + return "YY"; + else if (size == -2) + return "DD"; + else if (size > 2) { + stringstream ss; + ss << abs(size) << "Y"; + return ss.str(); + } else if (size < -2) { + stringstream ss; + ss << abs(size) << "D"; + return ss.str(); + } else + cout << "ERROR not handeled insert size" << endl; + return "ERROR"; } -bool MobAllA(MobRead R) -{ -// cout << "checking all A" << endl; - //R.write(); - bool allA = true; - char base = 'Z'; - for (int i = 0; i < R.seq.size(); i++) - { -// cout << i << "\t" << R.seq.c_str()[i] << "\t" << R.cigarString.c_str()[i] << "\t" << base; - if (R.cigarString.c_str()[i] != 'H' && R.cigarString.c_str()[i] != 'S') - { - if (base == 'Z') - base = R.seq.c_str()[i]; +bool checkMobSupAalign(vector R) { + //if (reads[i].alignments.size()> 1) + //{ + // bool good = false; + // for (int j = 1; j< reads[i].alignments.size(); j++) + // { + // if (reads[reads[i].alignments[j]].mapQual > 30) + // good = true; + // } + // if (good) + // return false; + // else + // return true; + //} + //else return true; + return true; +} - if (base == R.seq.c_str()[i]) - { -// cout << "yup"; - } - else - { -// cout << "nope"; - allA = false; - } - } -// cout << endl; - } -// cout << "true = " << true << endl; -// cout << "yay done and allA = " << allA << endl; - return allA; +string GetUnalignedCenter(SamRead A, SamRead B) { + //need to test before you call this that the contigs are on the same strand and have the proper clipPattern + //cout << "GetUnalignedCenter" << endl; + //A.write(); + //B.write(); + bool internal = false; + bool Afirst = false; + bool Bfirst = false; + string Return = ""; + if (A.seq.size() == B.seq.size()) { + int i = 0; + for (i = 0; i < A.seq.size(); i++) { + if ((A.cigarString.c_str()[i] != 'S' && A.cigarString.c_str()[i] != 'H') && + (B.cigarString.c_str()[i] == 'S' || B.cigarString.c_str()[i] == 'H')) { + Afirst = true; + break; + } else if ((B.cigarString.c_str()[i] != 'S' && B.cigarString.c_str()[i] != 'H') && + (A.cigarString.c_str()[i] == 'S' || A.cigarString.c_str()[i] == 'H')) { + Bfirst = true; + break; + } + } + for (i = i; i < A.seq.size(); i++) { + if (Afirst) { + if ((A.cigarString.c_str()[i] != 'S' && A.cigarString.c_str()[i] != 'H') && + (B.cigarString.c_str()[i] == 'S' || B.cigarString.c_str()[i] == 'H')) {} + else if ((A.cigarString.c_str()[i] == 'S' || A.cigarString.c_str()[i] != 'H') && + (B.cigarString.c_str()[i] == 'S' || B.cigarString.c_str()[i] == 'H')) { + Return += A.seq.c_str()[i]; + } else + return Return; + } else if (Bfirst) { + if ((B.cigarString.c_str()[i] != 'S' && B.cigarString.c_str()[i] != 'H') && + (A.cigarString.c_str()[i] == 'S' || A.cigarString.c_str()[i] == 'H')) {} + else if ((B.cigarString.c_str()[i] == 'S' || B.cigarString.c_str()[i] != 'H') && + (A.cigarString.c_str()[i] == 'S' || A.cigarString.c_str()[i] == 'H')) { + Return += A.seq.c_str()[i]; + } else + return Return; + } else { + cout << "WARNING GetUnaligedCenter no one is first" << endl; + return ""; + } + } + } else { + cout << "GetUnalignedCenter WARNING, seq not the same size" << endl; + } + return ""; } -float AlignmentAllA(SamRead R) -{ - //cout << "checking all A" << endl; - //R.write(); - - bool allA = true; - char base = 'Z'; - int A = 0; - int T = 0; - float size = 0; - for (int i = 0; i < R.seq.size(); i++) - { -// cout << i << "\t" << R.seq.c_str()[i] << "\t" << R.cigarString.c_str()[i] << "\t" << base; - if (R.cigarString.c_str()[i] != 'H' && R.cigarString.c_str()[i] != 'S') - { - size = size +1; - if (base == 'Z') - base = R.seq.c_str()[i]; - if (base == R.seq.c_str()[i]) - { -// cout << "yup"; - } - else - { -// cout << "nope"; - allA = false; - } - if (R.seq.c_str()[i] == 'A') - A++; - else if (R.seq.c_str()[i] == 'T') - T++; - } -// cout << endl; - } - - - // cout << "true = " << true << endl; - // cout << "yay done and allA = " << allA << endl; - // cout << "A = " << A <<" T = " << T << " Aprop = " << (float) A / size << " Tprop = " << (float) T / size << endl; - //if (allA) - //{ cout << "returning 1" << endl; return 1; } - //else if ( A > T) - //{cout << "returning " << (float) A / size << endl;return (float) A / size; } - //else - //{cout << "returning " << (float) T / size << endl;return (float) T / size; } - +string InterpretInsertSize(string s) { + if (s.size() == 0) + return ""; + else if (s.size() == 1) + return "I"; + else if (s.size() == 2) + return "II"; + else if (s.size() > 2) { + stringstream a; + a << s.size(); + a << "I"; + return a.str(); + } + return ""; } -int MobAligneBases(MobRead M, SamRead R) -{ - cout << "CheckingMobBase" << endl; - - SamRead Read = R; - if (GetReadOrientation(R.flag) != GetReadOrientation(M.flag)) - { - cout << "flipping" << endl; - Read.flipRead(); - } -// R.write(); -// M.write(); - int MobBase = 0; - int MD = 0; - int RD = 0; - for (int i = 0; i + RD < Read.seq.size() && i+MD < M.seq.size(); i++) - { - while (M.seq.c_str()[i+MD] =='-') - { - MD++; - } - while (Read.seq.c_str()[i+RD] =='-') - { - RD++; +bool MobAllA(MobRead R) { +// cout << "checking all A" << endl; + //R.write(); + + bool allA = true; + char base = 'Z'; + for (int i = 0; i < R.seq.size(); i++) { +// cout << i << "\t" << R.seq.c_str()[i] << "\t" << R.cigarString.c_str()[i] << "\t" << base; + if (R.cigarString.c_str()[i] != 'H' && R.cigarString.c_str()[i] != 'S') { + if (base == 'Z') + base = R.seq.c_str()[i]; + + if (base == R.seq.c_str()[i]) { +// cout << "yup"; + } else { +// cout << "nope"; + allA = false; + } + } +// cout << endl; + } +// cout << "true = " << true << endl; +// cout << "yay done and allA = " << allA << endl; + return allA; - } - if (Read.seq.c_str()[i+RD] != M.seq.c_str()[i+MD]) - cout << "out of sync somehow " << Read.seq.c_str()[i+RD] <<"-" << Read.cigarString.c_str()[i+RD] << "\t" << M.seq.c_str()[i+MD] << "-" << M.cigarString.c_str()[i+MD] << "\t" << i+RD << " - " << i+MD ; - else - cout << "yay" << Read.seq.c_str()[i+RD] <<"-" << Read.cigarString.c_str()[i+RD] << "\t" << M.seq.c_str()[i+MD] << "-" << M.cigarString.c_str()[i+MD] << "\t" << i+RD << " - " << i+MD ; - if ( (Read.cigarString.c_str()[i+RD] == 'H' || Read.cigarString.c_str()[i+RD] =='S' ) && (M.cigarString.c_str()[i+MD] !='H' && M.cigarString.c_str()[i+MD] != 'S')) - { - MobBase++; - cout << "\tMOBbase" << endl; - } - else - cout << "\tnone" << endl; - } -// Read.write(); -// M.write(); - cout << "MobBases alibned to this read = " << MobBase << endl; - return MobBase; } -void FindFirstAndLast(vector& R, int& A, int& B) -{ - - cout << "finding flanking aligments for this read " << R.size() << endl; - - long shortest = 30000000000; - vector considering; - for (int j = 0; j 0) - considering.push_back(true); - else - considering.push_back(false); - - } - - ////find start alignemtn - for (int i =0; i < shortest; i++) - { - for (int j = 0; j T) { + cout << "returning " << (float) A / size << endl; + return (float) A / size; + } + else { + cout << "returning " << (float) T / size << endl; + return (float) T / size; + } - ////find end alignemtn - - for (int i =0; i < shortest; i++) - { - for (int j = 0; j& reads, int i, int A, int B, int& CurrentSVeventID) -{ - int bp = reads[reads[i].alignments[A]].BreakPoint(); - int sbp = reads[reads[i].alignments[B]].BreakPoint(); - if (bp > 0) - cout << "Passed SigBreakpoint check LastDitch" << endl; - cout << "bp = " << bp << " sbp = " << sbp << endl; - //int start = reads[reads[i].alignments[A]].pos + bp; - CurrentSVeventID++; - for(int k = 0; k < reads[reads[i].alignments[A]].alignments.size(); k++) - {reads[reads[reads[i].alignments[A]].alignments[k]].SVeventid = CurrentSVeventID;} - cout << "here" << endl; - - string GenotypeField; - GenotypeField = reads[reads[i].alignments[A]].createStructGenotype(bp); - stringstream Format; - stringstream alt ; - cout << "here2 " << endl; - Format << "OrphanBND"; - Format << "-LC=" << reads[reads[i].alignments[A]].SVCheckParentsForLowCov(bp); - string ref = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos+bp -1 ,1); - reads[reads[i].alignments[A]].BNDid = MaxBND+1; MaxBND++; - reads[reads[i].alignments[B]].BNDid = MaxBND+1; MaxBND++; - string SVDES = ""; - if ( reads[reads[i].alignments[A]].clipPattern == "mc") - { - cout << "here 3" << endl; - ref = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos+bp -1 , 1 ); - string altseq = Reff.getSubSequence(reads[i].chr, reads[i].pos+bp -1 -1 , 1 ); - if( reads[reads[i].alignments[A]].clipPattern == "mc" && GetReadOrientation(reads[reads[i].alignments[A]].flag) == GetReadOrientation(reads[reads[i].alignments[B]].flag)) - { - cout << "here 4" << endl; - string insertseq = GetUnalignedCenter(reads[reads[i].alignments[A]], reads[reads[i].alignments[B]]); - alt << altseq << insertseq; - alt << "[" << reads[reads[i].alignments[B]].chr << ":" << reads[reads[i].alignments[B]].pos+sbp -1 << "["; - Format << "bnd_" << reads[reads[i].alignments[A]].BNDid; - SVDES = "Translocation"; - } - else if ( reads[reads[i].alignments[A]].clipPattern == "mc" && GetReadOrientation(reads[reads[i].alignments[A]].flag) !=GetReadOrientation( reads[reads[i].alignments[B]].flag)) - { - cout << "here 5" << endl; - SamRead temp = reads[reads[i].alignments[B]]; - temp.flipRead(); - string insertseq = GetUnalignedCenter(reads[reads[i].alignments[A]], temp); - alt << altseq << insertseq; - alt << "]" << reads[reads[i].alignments[B]].chr << ":" << reads[reads[i].alignments[B]].pos+sbp -1 << "]"; - Format << "bnd_" << reads[reads[i].alignments[A]].BNDid; - SVDES = "InvertedTranslocation"; - } - } - else if ( reads[reads[i].alignments[A]].clipPattern == "cm") - { - cout << "here 3b" << endl; - ref = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos+bp -1 ,1); - string altseq = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos+bp -1 ,1); - if ( reads[reads[i].alignments[A]].clipPattern == "cm" && GetReadOrientation(reads[reads[i].alignments[A]].flag) == GetReadOrientation(reads[reads[i].alignments[B]].flag)) - { - cout << "here 4b" << endl; - alt << "]" << reads[reads[i].alignments[B]].chr << ":" << reads[reads[i].alignments[B]].pos + sbp /*check could be +1*/ << "]" << altseq; - Format << "bnd_" << reads[reads[i].alignments[A]].BNDid ; - SVDES = "Translocation"; - } - else if ( reads[reads[i].alignments[A]].clipPattern == "cm" && GetReadOrientation(reads[reads[i].alignments[A]].flag) != GetReadOrientation(reads[reads[i].alignments[B]].flag)) - { - cout << "here 5b" << endl; - alt << "[" << reads[reads[i].alignments[B]].chr << ":" << reads[reads[i].alignments[B]].pos+ sbp -1 /*check could be +1*/ << "[" << altseq; - Format << "bnd_" << reads[reads[i].alignments[A]].BNDid ; - SVDES = "InvertedTranslocation"; - } - } - else - { - cout << "here 4c" << endl; - ref = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos+bp -1 ,1); - string altseq = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos+bp -1 ,1); - string insertseq = GetUnalignedCenter(reads[reads[i].alignments[A]], reads[reads[i].alignments[B]]); - alt << altseq << insertseq; - alt << "[" << reads[reads[i].alignments[B]].chr << ":" << reads[reads[i].alignments[B]].pos+sbp -1 << "["; - Format << "bnd_" << reads[reads[i].alignments[A]].BNDid; - SVDES = "MessyTranslocations"; - } - cout << "here 6" << endl; - - string FullfilterA = reads[reads[i].alignments[A]].filterSV(); - int GMap = 0; - int minMapQual = 30; - if (reads[reads[i].alignments[A]].mapQual > minMapQual) - GMap++; - - string InfoFilter = ""; - string Filter = ""; - cout << "here 7"<< endl; - if (reads[reads[i].alignments[A]].SVCheckParentsForLowCov(reads[reads[i].alignments[A]].sigBreakPoint()) >= 1) - { - Format << "-Inherited"; - InfoFilter = "Inherited"; - Filter = "LCH"; - } - else if (GMap < 1) - { - Format << "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "" ) - { - Format<<"-DeNovo"; - InfoFilter = "Pass"; - Filter = "PASS"; - } - else - { - Format<<"-" << FullfilterA; - InfoFilter = FullfilterA; - Filter = "fail"; - } - //make quality stuff - int readAmut=0; - int readApos=0; - reads[reads[i].alignments[A]].GetQualityHashes(readAmut, readApos, bp); - float qual = -100; - if ((readApos) > 0) - qual = ((float)readAmut) / ((float)readApos) * 100.0; - else - qual = 0; - stringstream info; - info << "SVTYPE=BND;MATEID=bnd_" << reads[reads[i].alignments[B]].BNDid << ";"; - string phase="none"; - if (reads[reads[i].alignments[A]].phase != "none") - phase = reads[reads[i].alignments[A]].phase; - info << "PH=" << phase << ";"; - info << "FEX=" << InfoFilter << ";"; - int SupportingHashes = readAmut; - int possibleHashes = readApos; - info << "FS=" << SupportingHashes << "/" < holder; - vector temp = Split(line, '\t'); - for(int i =0; i < temp.size()-1; i++) - { - DistGlobal.push_back(holder); - } - for(int i =1; i < temp.size(); i++) - { - DistGlobal[i].push_back(atof(temp[i].c_str())); - } - while( getline(ModelFile, line)) - { - temp = Split(line, '\t'); - for(int i =1; i < temp.size(); i++) - { - DistGlobal[i-1].push_back(atof(temp[i].c_str())); - } - } - ///////flip it good -// vector> holder2; -// for (int i = 0; i < DistGlobal[0].size(); i++) -// { -// vector g; -// for (int j = 0; j < DistGlobal.size(); j++) -// { -// g.push_back(DistGlobal[j][i]); -// } -// holder2.push_back(g); -// } -// DistGlobal = holder2; - GenPrior.push_back(0.5); - GenPrior.push_back(0.5); - for (int i = 2; i < DistGlobal.size(); i++) - { - GenPrior.push_back(1.0/((double) i)); - } -} + } + while (Read.seq.c_str()[i + RD] == '-') { + RD++; -vector GetHighAndLowForDist(int copy, double percent) -{ - double maxP = -1; - int maxK = -1; - double sum = 0; - for(int i =0; i < DistGlobal[copy].size(); i++) - { - sum+=DistGlobal[copy][i]; - if (DistGlobal[copy][i] > maxP) - { - maxP = DistGlobal[copy][i]; - maxK = i; - } - } - double cumulative = DistGlobal[copy][maxK]; - int lower = maxK; - int upper = maxK; - while ( lower > 0 && upper < DistGlobal[copy].size() && cumulative/sum < percent) - { - lower+= -1; - upper++; - cumulative+= DistGlobal[copy][lower]; - cumulative+= DistGlobal[copy][upper]; - } - while ( lower > 0 && cumulative/sum < percent) - { - lower+= -1; - cumulative+= DistGlobal[copy][lower]; - } - while ( upper < DistGlobal[copy].size() && cumulative/sum < percent) - { - upper++; - cumulative+= DistGlobal[copy][upper]; - } - vector limits; - limits.push_back(lower); - limits.push_back(upper); - return limits; + } + if (Read.seq.c_str()[i + RD] != M.seq.c_str()[i + MD]) + cout << "out of sync somehow " << Read.seq.c_str()[i + RD] << "-" << Read.cigarString.c_str()[i + RD] + << "\t" << M.seq.c_str()[i + MD] << "-" << M.cigarString.c_str()[i + MD] << "\t" << i + RD << " - " + << i + MD; + else + cout << "yay" << Read.seq.c_str()[i + RD] << "-" << Read.cigarString.c_str()[i + RD] << "\t" + << M.seq.c_str()[i + MD] << "-" << M.cigarString.c_str()[i + MD] << "\t" << i + RD << " - " << i + MD; + if ((Read.cigarString.c_str()[i + RD] == 'H' || Read.cigarString.c_str()[i + RD] == 'S') && + (M.cigarString.c_str()[i + MD] != 'H' && M.cigarString.c_str()[i + MD] != 'S')) { + MobBase++; + cout << "\tMOBbase" << endl; + } else + cout << "\tnone" << endl; + } +// Read.write(); +// M.write(); + cout << "MobBases alibned to this read = " << MobBase << endl; + return MobBase; } -void ProcessHighAndLowDist() -{ - for ( int i = 0; i < DistGlobal.size(); i++) - { - DistLimitsGlobal.push_back(GetHighAndLowForDist(i, 0.997)); - } - if (DistLimitsGlobal.size() > 3) - Dist1XCutoff = DistLimitsGlobal[2][1]; - else - Dist1XCutoff = 100000; - +void FindFirstAndLast(vector &R, int &A, int &B) { + + cout << "finding flanking aligments for this read " << R.size() << endl; + + long shortest = 30000000000; + vector considering; + for (int j = 0; j < R.size(); j++) { + if (GetReadOrientation(R[0].flag) != GetReadOrientation(R[j].flag)) { + R[j].flipRead(); + } + if (R[j].seq.size() < shortest) + shortest = R[j].seq.size(); + R[j].write(); + if (R[j].sigBreakPoint() > 0) + considering.push_back(true); + else + considering.push_back(false); + + } + + + ////find start alignemtn + for (int i = 0; i < shortest; i++) { + for (int j = 0; j < R.size(); j++) { + if (R[j].cigarString.c_str()[i] != 'H' && R[j].cigarString.c_str()[i] != 'S' && considering[j]) { + A = j; + break; + } + } + if (A != -1) + break; + } + cout << "Start alignment is " << A << endl; + ////flip to find end + for (int j = 0; j < R.size(); j++) { + R[j].flipRead(); + + } + + ////find end alignemtn + + for (int i = 0; i < shortest; i++) { + for (int j = 0; j < R.size(); j++) { + if (R[j].cigarString.c_str()[i] != 'H' && R[j].cigarString.c_str()[i] != 'S' && considering[j]) { + B = j; + break; + } + } + if (B != -1) + break; + } + cout << "end alignemtn is " << B << endl; + return; + } -int main (int argc, char *argv[]) -{ -cout << "###########################RUNNING THIS ONE#########################" << endl; -cout << "Modes chr pos type reff alt MutRef MutAlt Par1Ref Par2Ref" << endl; -// ifstream testthis [100]; -// testthis[0].open("./test.txt"); -// string boom2; -// while (getline(testthis[0], boom2)) -// { -// cout << boom2 << endl; -// } -// return 0; - //************************************************ - //my arg parser - - string helptext; - helptext = \ -"\ -RUFUS.interpret: converts RUFUS aligned contigs into a VCF \n\ -By Andrew Farrell\n\ - The Marth Lab\n\ -\n\ -options:\ - -h [ --help ] Print help message\n\ - -sam arg Path to input SAM file, omit for stdin\n\ - -r arg Path to reference file \n\ - -hf arg Path to HashFile from RUFUS.build\n\ - -hS arg Hash Size\n\ - -o arg Output stub\n\ - -m arg Maximum varient size: default 1Mb\n\ -(Sorry it has to be a num, no 1kb, must be 1000\n\ - -c arg Path to sorted.tab file for the parent sample\n\ - -s arg Path to sorted.tab file for the subject sample\n\ - -cR arg Path to the sorted.tab file fo the parnt sample hashes in the reference\n\ - -sR arg Path to the sorted.tab file fo the subject sample hashes in the reference\n\ - -mQ arg Minimum map quality to consider varients in\n\ - -mod arg Path to the model file from RUFUS.model\n\ - -e arg Path to Kmer file to exlude from LowCov check\n\ - -mob arg Path to a bam file of the aligned contigs to a mobil element list\n\ - -as arg alignemnt segments threshold (default: 10)\n\ -"; - - string MutHashFilePath = "" ; - string MutHashFilePathReference = ""; - //MaxVarentSize = 1000000; - string RefFile = ""; - string HashListFile = "" ; - string samFile = "stdin"; - string outStub= ""; - string ModelFilePath = ""; - string ExcludeFilePath = ""; - string MobBam = ""; - SegThreshold = 10; - int MinMapQual = 40; - for(int i = 1; i< argc; i++) - { - cout << i << " = " << argv[i] << endl; - } - cout <<"****************************************************************************************" << endl; - vector ParentHashFilePaths; - vector ParentHashFilePathsReference; - for(int i = 1; i< argc; i++) - { - string p = argv[i]; - cout << i << " = " << argv[i]<< endl; - if( p == "-h") - { - //print help - cout << helptext << endl; - return 0; - } - else if (p == "-r") - { - RefFile = argv[i+1]; - i=i+1; - cout << "YAAAY added RefFile = " << RefFile << endl; - } - else if (p == "-sam") - { - samFile = argv[i+1]; - i++; - } - else if (p == "-o") - { - outStub = argv[i+1]; - i++; - } - else if (p == "-hf") - { - HashListFile = argv[i+1]; - i++; - } - else if (p == "-hs") - { - HashSize = atoi(argv[i+1]); - i++; - } - else if (p == "-m") - { - MaxVarentSize = atoi(argv[i+1]); - i++; - cout << "YAAAY added MaxVarSize = " << MaxVarentSize << endl; - } - else if (p == "-as") - { - SegThreshold = atoi(argv[i+1]); - SegThresholdCigar = atoi(argv[i+1]); - i++; - cout << "AlignmentSegmentThreshold = " << SegThreshold << endl; - } - else if (p == "-c") - { - cout << "Par Hash = " << argv[i+1] << endl; - ParentHashFilePaths.push_back(i+1); - i=i+1; - } - else if (p == "-cR") - { - cout << "Par Ref Hash = " << argv[i+1] << endl; - ParentHashFilePathsReference.push_back(i+1); - i=i+1; - } - else if (p == "-s") - { - cout << "Sub Hash = " << argv[i+1] << endl; - MutHashFilePath = argv[i+1]; - i+=1; - } - else if (p == "-sR") - { - cout << "Sub Hash = " << argv[i+1] << endl; - MutHashFilePathReference = argv[i+1]; - i+=1; - } - else if (p == "-mod") - { - cout << "model file = " << argv[i+1] << endl; - ModelFilePath = argv[i+1]; - i+=1; - } - else if (p == "-mQ") - { - cout << "Min Mapping Qualtiy = " << argv[i+1] << endl; - MinMapQual = atoi(argv[i+1]); - i+=1; - } - else if(p == "-e") - { - cout << "Exclue File Path = " << argv[i+1] << endl; - ExcludeFilePath = argv[i+1]; - i+=1; - } - else if (p == "-mob") - { - cout << "Mobil Eelement aligned sam file = " << argv[i+1] << endl; - MobBam = argv[i+1]; - i+=1; - } - else - { - cout << "ERROR: unkown command line paramater -" << argv[i] << "-"<< endl; - return 0; - } - - } - //check values - if (RefFile == "") - { - cout << "ERROR Reference required" << endl; - return 0; - } - if (HashListFile == "") - { - cout << "Error HashList required" << endl; - return 0; - } - if (outStub == "") - { - if (samFile != "stdin") - outStub = samFile; - else - { - cout << "ERROR out file stub required " << endl; - return -1; - } - } - ProcessDist(ModelFilePath); - if (IsExome == false) - { ProcessHighAndLowDist(); +void LastDitch(vector &reads, int i, int A, int B, int &CurrentSVeventID) { + int bp = reads[reads[i].alignments[A]].BreakPoint(); + int sbp = reads[reads[i].alignments[B]].BreakPoint(); + if (bp > 0) + cout << "Passed SigBreakpoint check LastDitch" << endl; + cout << "bp = " << bp << " sbp = " << sbp << endl; + //int start = reads[reads[i].alignments[A]].pos + bp; + CurrentSVeventID++; + for (int k = 0; k < + reads[reads[i].alignments[A]].alignments.size(); k++) { reads[reads[reads[i].alignments[A]].alignments[k]].SVeventid = CurrentSVeventID; } + cout << "here" << endl; + + string GenotypeField; + GenotypeField = reads[reads[i].alignments[A]].createStructGenotype(bp); + stringstream Format; + stringstream alt; + cout << "here2 " << endl; + Format << "OrphanBND"; + Format << "-LC=" << reads[reads[i].alignments[A]].SVCheckParentsForLowCov(bp); + string ref = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos + bp - 1, 1); + reads[reads[i].alignments[A]].BNDid = MaxBND + 1; + MaxBND++; + reads[reads[i].alignments[B]].BNDid = MaxBND + 1; + MaxBND++; + string SVDES = ""; + if (reads[reads[i].alignments[A]].clipPattern == "mc") { + cout << "here 3" << endl; + ref = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos + bp - 1, 1); + string altseq = Reff.getSubSequence(reads[i].chr, reads[i].pos + bp - 1 - 1, 1); + if (reads[reads[i].alignments[A]].clipPattern == "mc" && + GetReadOrientation(reads[reads[i].alignments[A]].flag) == + GetReadOrientation(reads[reads[i].alignments[B]].flag)) { + cout << "here 4" << endl; + string insertseq = GetUnalignedCenter(reads[reads[i].alignments[A]], reads[reads[i].alignments[B]]); + alt << altseq << insertseq; + alt << "[" << reads[reads[i].alignments[B]].chr << ":" << reads[reads[i].alignments[B]].pos + sbp - 1 + << "["; + Format << "bnd_" << reads[reads[i].alignments[A]].BNDid; + SVDES = "Translocation"; + } else if (reads[reads[i].alignments[A]].clipPattern == "mc" && + GetReadOrientation(reads[reads[i].alignments[A]].flag) != + GetReadOrientation(reads[reads[i].alignments[B]].flag)) { + cout << "here 5" << endl; + SamRead temp = reads[reads[i].alignments[B]]; + temp.flipRead(); + string insertseq = GetUnalignedCenter(reads[reads[i].alignments[A]], temp); + alt << altseq << insertseq; + alt << "]" << reads[reads[i].alignments[B]].chr << ":" << reads[reads[i].alignments[B]].pos + sbp - 1 + << "]"; + Format << "bnd_" << reads[reads[i].alignments[A]].BNDid; + SVDES = "InvertedTranslocation"; + } + } else if (reads[reads[i].alignments[A]].clipPattern == "cm") { + cout << "here 3b" << endl; + ref = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos + bp - 1, 1); + string altseq = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, + reads[reads[i].alignments[A]].pos + bp - 1, 1); + if (reads[reads[i].alignments[A]].clipPattern == "cm" && + GetReadOrientation(reads[reads[i].alignments[A]].flag) == + GetReadOrientation(reads[reads[i].alignments[B]].flag)) { + cout << "here 4b" << endl; + alt << "]" << reads[reads[i].alignments[B]].chr << ":" + << reads[reads[i].alignments[B]].pos + sbp /*check could be +1*/ << "]" << altseq; + Format << "bnd_" << reads[reads[i].alignments[A]].BNDid; + SVDES = "Translocation"; + } else if (reads[reads[i].alignments[A]].clipPattern == "cm" && + GetReadOrientation(reads[reads[i].alignments[A]].flag) != + GetReadOrientation(reads[reads[i].alignments[B]].flag)) { + cout << "here 5b" << endl; + alt << "[" << reads[reads[i].alignments[B]].chr << ":" + << reads[reads[i].alignments[B]].pos + sbp - 1 /*check could be +1*/ << "[" << altseq; + Format << "bnd_" << reads[reads[i].alignments[A]].BNDid; + SVDES = "InvertedTranslocation"; + } + } else { + + cout << "here 4c" << endl; + ref = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, reads[reads[i].alignments[A]].pos + bp - 1, 1); + string altseq = Reff.getSubSequence(reads[reads[i].alignments[A]].chr, + reads[reads[i].alignments[A]].pos + bp - 1, 1); + string insertseq = GetUnalignedCenter(reads[reads[i].alignments[A]], reads[reads[i].alignments[B]]); + alt << altseq << insertseq; + alt << "[" << reads[reads[i].alignments[B]].chr << ":" << reads[reads[i].alignments[B]].pos + sbp - 1 << "["; + Format << "bnd_" << reads[reads[i].alignments[A]].BNDid; + SVDES = "MessyTranslocations"; + } + cout << "here 6" << endl; + + string FullfilterA = reads[reads[i].alignments[A]].filterSV(); + int GMap = 0; + int minMapQual = 30; + if (reads[reads[i].alignments[A]].mapQual > minMapQual) + GMap++; + + string InfoFilter = ""; + string Filter = ""; + cout << "here 7" << endl; + if (reads[reads[i].alignments[A]].SVCheckParentsForLowCov(reads[reads[i].alignments[A]].sigBreakPoint()) >= 1) { + Format << "-Inherited"; + InfoFilter = "Inherited"; + Filter = "LCH"; + } else if (GMap < 1) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "") { + Format << "-DeNovo"; + InfoFilter = "Pass"; + Filter = "PASS"; + } else { + Format << "-" << FullfilterA; + InfoFilter = FullfilterA; + Filter = "fail"; + } + //make quality stuff + int readAmut = 0; + int readApos = 0; + reads[reads[i].alignments[A]].GetQualityHashes(readAmut, readApos, bp); + float qual = -100; + if ((readApos) > 0) + qual = ((float) readAmut) / ((float) readApos) * 100.0; + else + qual = 0; + stringstream info; + info << "SVTYPE=BND;MATEID=bnd_" << reads[reads[i].alignments[B]].BNDid << ";"; + string phase = "none"; + if (reads[reads[i].alignments[A]].phase != "none") + phase = reads[reads[i].alignments[A]].phase; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + int SupportingHashes = readAmut; + int possibleHashes = readApos; + info << "FS=" << SupportingHashes << "/" << possibleHashes << ";"; + info << "RN=" << reads[reads[i].alignments[A]].name << ";"; + info << "MQ=" << reads[reads[i].alignments[A]].mapQual << "_and_" << reads[reads[i].alignments[B]].mapQual << ";"; + info << "cigar=" << reads[reads[i].alignments[A]].cigar << "_and_" << reads[reads[i].alignments[B]].cigar << ";"; + info << "SB=" << reads[reads[i].alignments[A]].StrandBias << ";"; + info << "AS=" << reads[reads[i].alignments[A]].AlignmentSegments << "-" + << reads[reads[i].alignments[A]].AlignmentSegmentsCigar << "_and_"; + stringstream call; + cout << "in this one" << endl; + call << reads[reads[i].alignments[A]].chr << "\t" << reads[reads[i].alignments[A]].pos + bp - 1 << "\t" + << Format.str() << "\t" << ref << "\t" << alt.str() << "\t" << qual << "\t" << Filter << "\t" << info.str() + << "\t" << "GT:DP:RO:AO\t" << GenotypeField; + cout << call.str() << endl; + VCFOutFile << call.str(); + VCFOutFile << endl; - cout << "checking Dist File" << endl; - /*for (int copy =0; copy < 5; copy++) + +} + +/* + * I think this is processing distribution from jellyfish model file for CN estimation? + */ +void ProcessDist(string ModelFilePath) { + ifstream ModelFile; + ModelFile.open(ModelFilePath); + if (ModelFile.is_open()) { cout << "ModelFile is open"; } + else { + cout << "Error no model file given, not worring abou this now" << endl; + return; + } + string line; + getline(ModelFile, line); + if (line == "exome") { + cout << "exome data given, skipping bayes genotyping" << endl; + IsExome = true; + return; + } + getline(ModelFile, line); + int lower = atoi(line.c_str()); + getline(ModelFile, line); + getline(ModelFile, line); + ScGlobal = atoi(line.c_str()); + getline(ModelFile, line); + getline(ModelFile, line); + getline(ModelFile, line); + vector holder; + vector temp = Split(line, '\t'); + for (int i = 0; i < temp.size() - 1; i++) { + DistGlobal.push_back(holder); + } + for (int i = 1; i < temp.size(); i++) { + DistGlobal[i].push_back(atof(temp[i].c_str())); + } + while (getline(ModelFile, line)) { + temp = Split(line, '\t'); + for (int i = 1; i < temp.size(); i++) { + DistGlobal[i - 1].push_back(atof(temp[i].c_str())); + } + } + ///////flip it good +// vector> holder2; +// for (int i = 0; i < DistGlobal[0].size(); i++) +// { +// vector g; +// for (int j = 0; j < DistGlobal.size(); j++) +// { +// g.push_back(DistGlobal[j][i]); +// } +// holder2.push_back(g); +// } +// DistGlobal = holder2; + GenPrior.push_back(0.5); + GenPrior.push_back(0.5); + for (int i = 2; i < DistGlobal.size(); i++) { + GenPrior.push_back(1.0 / ((double) i)); + } +} + +vector GetHighAndLowForDist(int copy, double percent) { + double maxP = -1; + int maxK = -1; + double sum = 0; + for (int i = 0; i < DistGlobal[copy].size(); i++) { + sum += DistGlobal[copy][i]; + if (DistGlobal[copy][i] > maxP) { + maxP = DistGlobal[copy][i]; + maxK = i; + } + } + double cumulative = DistGlobal[copy][maxK]; + int lower = maxK; + int upper = maxK; + while (lower > 0 && upper < DistGlobal[copy].size() && cumulative / sum < percent) { + lower += -1; + upper++; + cumulative += DistGlobal[copy][lower]; + cumulative += DistGlobal[copy][upper]; + } + while (lower > 0 && cumulative / sum < percent) { + lower += -1; + cumulative += DistGlobal[copy][lower]; + } + while (upper < DistGlobal[copy].size() && cumulative / sum < percent) { + upper++; + cumulative += DistGlobal[copy][upper]; + } + vector limits; + limits.push_back(lower); + limits.push_back(upper); + return limits; + +} + +void ProcessHighAndLowDist() { + for (int i = 0; i < DistGlobal.size(); i++) { + DistLimitsGlobal.push_back(GetHighAndLowForDist(i, 0.997)); + } + if (DistLimitsGlobal.size() > 3) + Dist1XCutoff = DistLimitsGlobal[2][1]; + else + Dist1XCutoff = 100000; + +} + +int main(int argc, char *argv[]) { + cout << "***Begin Interpret***" << endl; + cout << "Modes chr pos type ref alt MutRef MutAlt Par1Ref Par2Ref" << endl; + string helptext = "RUFUS.interpret: converts RUFUS aligned contigs into a VCF \n" + "By Andrew Farrell\n" + "The Marth Lab\n\n" + "options:" + "-h [ --help ] Print help message\n" + "-sam arg Path to input SAM file, omit for stdin\n" + "-r arg Path to reference file \n" + "-hf arg Path to HashFile from RUFUS.build\n" + "-hS arg Hash Size\n" + "-o arg Output stub\n" + "-m arg Maximum variant size: default 1Mb\n" + "(Sorry it has to be a num, no 1kb, must be 1000\n" + "-c arg Path to sorted.tab file for the parent sample\n" + "-s arg Path to sorted.tab file for the subject sample\n" + "-cR arg Path to the sorted.tab file for the parent sample hashes in the reference\n" + "-sR arg Path to the sorted.tab file for the subject sample hashes in the reference\n" + "-mQ arg Minimum map quality to consider variants in\n" + "-mod arg Path to the model file from RUFUS.model\n" + "-e arg Path to Kmer file to exclude from LowCov check\n" + "-mob arg Path to a bam file of the aligned contigs to a mobil element list\n" + "-as arg alignment segments threshold (default: 10)\n" + "-rp arg Path to rufus run directory\n" + "-ip arg Path to text file where invocation & versioning info lives\n" + "-w arg Indicates windowed mode run"; + + string MutHashFilePath = ""; + string MutHashFilePathReference = ""; + string RefFile = ""; + string HashListFile = ""; + string samFile = "stdin"; + string outStub = ""; + string ModelFilePath = ""; + string ExcludeFilePath = ""; + string MobBam = ""; + string rufusPath = ""; + string rufusInvocFile = ""; + bool isWindowed = false; + + SegThreshold = 10; + int MinMapQual = 40; + for (int i = 1; i < argc; i++) { + cout << i << " = " << argv[i] << endl; + } + cout << "****************************************************************************************" << endl; + vector ParentHashFilePaths; + vector ParentHashFilePathsReference; + for (int i = 1; i < argc; i++) { + string p = argv[i]; + cout << i << " = " << argv[i] << endl; + if (p == "-h") { + //print help + cout << helptext << endl; + return 0; + } else if (p == "-r") { + RefFile = argv[i + 1]; + i = i + 1; + cout << "YAAAY added RefFile = " << RefFile << endl; + } else if (p == "-sam") { + samFile = argv[i + 1]; + i++; + } else if (p == "-o") { + outStub = argv[i + 1]; + i++; + } else if (p == "-hf") { + HashListFile = argv[i + 1]; + i++; + } else if (p == "-hs") { + HashSize = atoi(argv[i + 1]); + i++; + } else if (p == "-m") { + MaxVarentSize = atoi(argv[i + 1]); + i++; + cout << "YAAAY added MaxVarSize = " << MaxVarentSize << endl; + } else if (p == "-as") { + SegThreshold = atoi(argv[i + 1]); + SegThresholdCigar = atoi(argv[i + 1]); + i++; + cout << "AlignmentSegmentThreshold = " << SegThreshold << endl; + } else if (p == "-c") { + cout << "Par Hash = " << argv[i + 1] << endl; + ParentHashFilePaths.push_back(i + 1); + i = i + 1; + } else if (p == "-cR") { + cout << "Par Ref Hash = " << argv[i + 1] << endl; + ParentHashFilePathsReference.push_back(i + 1); + i = i + 1; + } else if (p == "-s") { + cout << "Sub Hash = " << argv[i + 1] << endl; + MutHashFilePath = argv[i + 1]; + i += 1; + } else if (p == "-sR") { + cout << "Sub Hash = " << argv[i + 1] << endl; + MutHashFilePathReference = argv[i + 1]; + i += 1; + } else if (p == "-mod") { + cout << "model file = " << argv[i + 1] << endl; + ModelFilePath = argv[i + 1]; + i += 1; + } else if (p == "-mQ") { + cout << "Min Mapping Qualtiy = " << argv[i + 1] << endl; + MinMapQual = atoi(argv[i + 1]); + i += 1; + } else if (p == "-e") { + cout << "Exclue File Path = " << argv[i + 1] << endl; + ExcludeFilePath = argv[i + 1]; + i += 1; + } else if (p == "-mob") { + cout << "Mobil Eelement aligned sam file = " << argv[i + 1] << endl; + MobBam = argv[i + 1]; + i += 1; + } else if (p == "-rp") { + cout << "RUFUS parent path = " << argv[i + 1] << endl; + rufusPath = argv[i + 1]; + i += 1; + } else if (p == "-ip") { + cout << "RUFUS invoc file = " << argv[i + 1] << endl; + rufusInvocFile = argv[i + 1]; + i += 1; + } else if (p == "-w") { + cout << "Windowed mode indicated " << endl; + isWindowed = true; + } else if (p == "-plct") { + ParLowCovThreshold = atoi(argv[i + 1]); + cout << "ParLowCovThreshold = " << ParLowCovThreshold << endl; + i += 1; + } else { + cout << "ERROR: unkown command line paramater -" << argv[i] << "-" << endl; + return 0; + } + } + + //check values + if (RefFile == "") { + cout << "ERROR Reference required" << endl; + return 0; + } + if (HashListFile == "") { + cout << "Error HashList required" << endl; + return 0; + } + if (outStub == "") { + if (samFile != "stdin") + outStub = samFile; + else { + cout << "ERROR out file stub required " << endl; + return -1; + } + } + + ProcessDist(ModelFilePath); + if (IsExome == false) { + ProcessHighAndLowDist(); + cout << "checking Dist File" << endl; + /*for (int copy =0; copy < 5; copy++) { for (int k = 0; k < 11; k++) { cout << DistGlobal[copy][k] << " "; } cout << endl; - + }*/ - cout << "done checking dist file " << endl; - cout << "checking priors " << endl; - /*for (int i = 0; i < GenPrior.size(); i++) + cout << "done checking dist file " << endl; + cout << "checking priors " << endl; + /*for (int i = 0; i < GenPrior.size(); i++) { - cout << "GenePrior " << i << " = " << GenPrior[i] << endl; + cout << "GenePrior " << i << " = " << GenPrior[i] << endl; }*/ - } - unordered_map mobs; - if (MobBam != "") - { - cout << "mob aligned contigs provided: " << MobBam << endl; - cout << "reading in sam file " << endl; - ifstream reader; - reader.open(MobBam); - string line; - while (getline(reader, line)) - { - if (line.c_str()[0] == '@') - { + } + + // Parse mobile elements into hashmap + unordered_map mobs; + if (MobBam != "") { + cout << "mob aligned contigs provided: " << MobBam << endl; + cout << "reading in sam file " << endl; + ifstream reader; + reader.open(MobBam); + string line; + while (getline(reader, line)) { + if (line.c_str()[0] == '@') { // cout << " HEADER LINE = " << line << endl; - } - else - { - MobRead temp; - - temp.parse(line); - if (temp.chr !="*" && MobAllA(temp) == false) - { - if (mobs.count(temp.name) > 0) - { - if (mobs[temp.name].AS < temp.AS) - { + } else { + MobRead temp; + + temp.parse(line); + if (temp.chr != "*" && MobAllA(temp) == false) { + if (mobs.count(temp.name) > 0) { + if (mobs[temp.name].AS < temp.AS) { // cout << " Writing over mob with better one " << line << endl; - mobs[temp.name] = temp; - } - } - else - { + mobs[temp.name] = temp; + } + } else { // cout << " Adding Mob Alignment " << line << endl; - mobs[temp.name] = temp; - } - } - } - } - } - cout << "yaya finished mob " << endl; - #pragma omp parallel sections - { - #pragma omp section - { - for (int i = 0; i < ParentHashFilePaths.size(); i++) - { - cout << "adding a entry to ParentHashes " << i << endl; - unordered_map hl; - ParentHashes.push_back(hl); - } - #pragma omp parallel for shared(ParentHashes) - for (int i = 0; i < ParentHashFilePaths.size(); i++) - { - cout << " reading in parent " << i << " alt hashes" << endl; - ifstream reader; - reader.open (argv[ParentHashFilePaths[i]]); - string line = ""; - unordered_map hl; - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - hl[hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - hl[hash] = atoi(temp[1].c_str()); - } - cout << "pushing back " << i << " size of parent hash is " << ParentHashes.size() << endl; - #pragma omp critical - { - ParentHashes[i] = hl; - cout << "done pushing back " << i << endl; - reader.close(); - } - } - cout << "done with parent Alt Hashes, starting Ref " << endl; - #pragma omp parallel for - for (int i = 0; i < ParentHashFilePathsReference.size(); i++) - { - cout << " reading in parent " << i << " ref hashes" << endl; - ifstream reader; - reader.open (argv[ParentHashFilePathsReference[i]]); - string line = ""; - //unordered_map hl; - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - ParentHashes[i][hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - ParentHashes[i][hash] = atoi(temp[1].c_str()); - } - reader.close(); - } - - cout << "check parent thing" << endl; - for(int i =0; i < ParentHashes.size(); i++) - { - cout << "sample " << i << endl; - - } - } - #pragma omp section - { + mobs[temp.name] = temp; + } + } + } + } + } + cout << "yaya finished mob " << endl; - cout << "reading in mutant alt hashes" << endl; - ifstream reader; - reader.open (MutHashFilePath); - string line = ""; - while (getline(reader, line)) - { - - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - MutantHashes[hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - MutantHashes[hash] = atoi(temp[1].c_str()); - } - reader.close(); - - cout << "reading in mutant ref hashes" << endl; - reader.open (MutHashFilePathReference); - line = ""; - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - MutantHashes[hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - MutantHashes[hash] = atoi(temp[1].c_str()); - } - reader.close(); - } - #pragma omp section - { - ifstream reader; - string line; - reader.open(ExcludeFilePath); - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - //cout << "adding " << temp[0] << " with C=" << temp[1] << endl; - ExcludeHashes[hash] = atoi(temp[1].c_str()); - //hash = HashToLong(RevComp(temp[0])); - //ExcludeHashes[hash] = atoi(temp[1].c_str()); - } - reader.close(); - } - } - //*********************************************** - //cout << "Call is Reference Contigs.fa OutStub HashList MaxVarientSize" << endl; - double vm, rss, MAXvm, MAXrss; - MAXvm = 0; - MAXrss = 0; - process_mem_usage(vm, rss, MAXvm, MAXrss); - cout << "VM: " << vm << "; RSS: " << rss << endl; + #pragma omp parallel sections + { + #pragma omp section + { + // Parse parent hash files into local data structures + for (int i = 0; i < ParentHashFilePaths.size(); i++) { + cout << "adding a entry to ParentHashes " << i << endl; + unordered_map hl; + ParentHashes.push_back(hl); + } + // #pragma omp parallel for shared(ParentHashes) + for (int i = 0; i < ParentHashFilePaths.size(); i++) { + cout << " reading in parent " << i << " alt hashes" << endl; + ifstream reader; + reader.open(argv[ParentHashFilePaths[i]]); + string line = ""; + unordered_map hl; + while (getline(reader, line)) { + vector temp = Split(line, ' '); + unsigned long hash = HashToLong(temp[0]); + hl[hash] = atoi(temp[1].c_str()); + hash = HashToLong(RevComp(temp[0])); + hl[hash] = atoi(temp[1].c_str()); + } + // todo: technically ParentHashes might have race condition here + cout << "pushing back " << i << " size of parent hash is " << ParentHashes.size() << endl; + // #pragma omp critical + // { + ParentHashes[i] = hl; + cout << "done pushing back " << i << endl; + reader.close(); + // } + } + + cout << "done with parent Alt Hashes, starting Ref " << endl; + // #pragma omp parallel for + for (int i = 0; i < ParentHashFilePathsReference.size(); i++) { + cout << " reading in parent " << i << " ref hashes" << endl; + ifstream reader; + reader.open(argv[ParentHashFilePathsReference[i]]); + string line = ""; + //unordered_map hl; + while (getline(reader, line)) { + vector temp = Split(line, ' '); + unsigned long hash = HashToLong(temp[0]); + ParentHashes[i][hash] = atoi(temp[1].c_str()); + hash = HashToLong(RevComp(temp[0])); + ParentHashes[i][hash] = atoi(temp[1].c_str()); + } + reader.close(); + } + + cout << "check parent thing" << endl; + for (int i = 0; i < ParentHashes.size(); i++) { + cout << "sample " << i << endl; + + } + } + + #pragma omp section + { + // Parse sample hash files into local data structures + cout << "reading in mutant alt hashes" << endl; + ifstream reader; + reader.open(MutHashFilePath); + string line = ""; + while (getline(reader, line)) { + vector temp = Split(line, ' '); + unsigned long hash = HashToLong(temp[0]); + MutantHashes[hash] = atoi(temp[1].c_str()); + hash = HashToLong(RevComp(temp[0])); + MutantHashes[hash] = atoi(temp[1].c_str()); + } + reader.close(); + + cout << "reading in mutant ref hashes" << endl; + reader.open(MutHashFilePathReference); + line = ""; + while (getline(reader, line)) { + + vector temp = Split(line, ' '); + unsigned long hash = HashToLong(temp[0]); + MutantHashes[hash] = atoi(temp[1].c_str()); + hash = HashToLong(RevComp(temp[0])); + MutantHashes[hash] = atoi(temp[1].c_str()); + } + reader.close(); + } + + #pragma omp section + { + // Parse exclude hash into local data structure + ifstream reader; + string line; + reader.open(ExcludeFilePath); + while (getline(reader, line)) { + vector temp = Split(line, ' '); + unsigned long hash = HashToLong(temp[0]); + //cout << "adding " << temp[0] << " with C=" << temp[1] << endl; + ExcludeHashes[hash] = atoi(temp[1].c_str()); + //hash = HashToLong(RevComp(temp[0])); + //ExcludeHashes[hash] = atoi(temp[1].c_str()); + } + reader.close(); + } + } + //*********************************************** + //cout << "Call is Reference Contigs.fa OutStub HashList MaxVarientSize" << endl; + + // Implicit boundary here for parallel sections to complete prior to executing + double vm, rss, MAXvm, MAXrss; + MAXvm = 0; + MAXrss = 0; + process_mem_usage(vm, rss, MAXvm, MAXrss); + cout << "VM: " << vm << "; RSS: " << rss << endl; + - - int BufferSize = 1000; + int BufferSize = 1000; - Reff.open(RefFile); + // todo: move this until where we actually use it? + Reff.open(RefFile); -// ifstream ModelFile; -// ModelFile.open (ModelFilePath); +// ifstream ModelFile; +// ModelFile.open (ModelFilePath); // if (ModelFile.is_open()) // { cout << "ModelFile is open";} // else @@ -5608,66 +5190,57 @@ options:\ // cout << "Error no model file given, not worring abou this now" << endl; // //return -1; // } - - ifstream HashList; - HashList.open (HashListFile); - if ( HashList.is_open()) - { cout << "HashList Open " << HashListFile << endl;} //cout << "##File Opend\n"; - else - { - cout << "Error, HashList could not be opened"; - return -1; - } - string line = ""; - getline(HashList, line); - cout << "line = " << line << endl; - char seperator = '\t'; - vector temp = Split(line, seperator); - if (temp.size() ==1){ - cout << "separator is not tab" << endl; - seperator = ' '; - temp = Split(line, seperator); - } - else if (temp.size() == 0) - { - cout << "Hash List is empty, aborting" << endl; - return -1; - } - else - cout << "separator is tab" << endl; - - cout << "split = " << temp[0] << " and " << temp[1] << endl; - HashSize = temp[0].size(); - if (temp.size() ==4) - { - HashSize = temp[3].length(); - Hash.insert(pair(temp[3], atoi(temp[2].c_str()))); - - while ( getline(HashList, line)) - { - vector temp = Split(line, seperator); - Hash.insert(pair(temp[3], atoi(temp[2].c_str()))); - Hash.insert(pair(RevComp(temp[3]), atoi(temp[2].c_str()))); - //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; - } - HashList.close(); - cout << "done with HashList" << endl; - } - else if (temp.size() ==2) - { - HashSize = temp[0].length(); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - Hash.insert(pair(RevComp(temp[0]), atoi(temp[1].c_str()))); - while ( getline(HashList, line)) - { - vector temp = Split(line, seperator); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; - } - HashList.close(); - cout << "done with HashList" << endl; - } - /*else if (temp.size() ==1) + + // todo: left off here + ifstream HashList; + HashList.open(HashListFile); + if (HashList.is_open()) { cout << "HashList Open " << HashListFile << endl; } + else { + cout << "Error, HashList could not be opened"; + return -1; + } + string line = ""; + getline(HashList, line); + cout << "line = " << line << endl; + char seperator = '\t'; + vector temp = Split(line, seperator); + if (temp.size() == 1) { + cout << "separator is not tab" << endl; + seperator = ' '; + temp = Split(line, seperator); + } else if (temp.size() == 0) { + cout << "Hash List is empty, aborting" << endl; + return -1; + } else + cout << "separator is tab" << endl; + + cout << "split = " << temp[0] << " and " << temp[1] << endl; + HashSize = temp[0].size(); + if (temp.size() == 4) { + HashSize = temp[3].length(); + Hash.insert(pair(temp[3], atoi(temp[2].c_str()))); + + while (getline(HashList, line)) { + vector temp = Split(line, seperator); + Hash.insert(pair(temp[3], atoi(temp[2].c_str()))); + Hash.insert(pair(RevComp(temp[3]), atoi(temp[2].c_str()))); + //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; + } + HashList.close(); + cout << "done with HashList" << endl; + } else if (temp.size() == 2) { + HashSize = temp[0].length(); + Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); + Hash.insert(pair(RevComp(temp[0]), atoi(temp[1].c_str()))); + while (getline(HashList, line)) { + vector temp = Split(line, seperator); + Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); + //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; + } + HashList.close(); + cout << "done with HashList" << endl; + } + /*else if (temp.size() ==1) { vector temp = Split(line, ' '); HashSize = temp[0].length(); @@ -5683,2054 +5256,2133 @@ options:\ HashList.close(); cout << "done with HashList" << endl; }*/ - //map::iterator it; - //for ( it = Hash.begin(); it != Hash.end(); it++ ) - //{ - // cout << "-"<first<<"-" << "\t" << it->second << endl; - //} - - ifstream SamFile; - if (samFile == "stdin") - { - cout << "Sam File is STDIN" << endl; - SamFile.open ("/dev/stdin"); - } - else - { - cout << "Sam File is " << samFile << endl; - SamFile.open (samFile); - } - if ( SamFile.is_open()) - { cout << "Sam File Opend\n";} - else - { - cout << "Error, SamFile could not be opened"; - return 0; - } + //map::iterator it; + //for ( it = Hash.begin(); it != Hash.end(); it++ ) + //{ + // cout << "-"<first<<"-" << "\t" << it->second << endl; + //} + + ifstream SamFile; + if (samFile == "stdin") { + cout << "Sam File is STDIN" << endl; + SamFile.open("/dev/stdin"); + } else { + cout << "Sam File is " << samFile << endl; + SamFile.open(samFile); + } + if (SamFile.is_open()) { cout << "Sam File Opend\n"; } + else { + cout << "Error, SamFile could not be opened"; + return 0; + } + + string boom = outStub; + const char* workDirEnv = std::getenv("WORK_DIR"); + if (!workDirEnv) { + std::cerr << "ERROR: WORK_DIR environment variable not set\n"; + return 1; // or throw + } + string workDir(workDirEnv); + string base = workDir + "/" + boom; + + VCFOutFile.open(base + ".vcf"); + BEDOutFile.open(base + ".vcf.bed"); + boom = workDir + "/Intermediates/" + boom; + BEDBigStuff.open(boom + ".vcf.Big.bed"); + BEDNotHandled.open(boom + ".vcf.NotHandled.bed"); + Invertions.open(boom + ".vcf.invertions.bed"); + Translocations.open(boom + ".vcf.Translocations"); + Translocationsbed.open(boom + ".vcf.Translocations.bed"); + Unaligned.open(boom + ".vcf.Unaligned"); + + //write VCF header + // TODO: update to v4.3 + VCFOutFile << "##fileformat=VCFv4.1" << endl; + VCFOutFile << "##fileDate=" << time(0) << endl; + + string vcfHeaderFilePath = rufusPath + "/resources/vcf_header.txt"; + ifstream vcfHeader; + vcfHeader.open(vcfHeaderFilePath); + if (!vcfHeader.is_open()) { + cout << "ERROR: Could not open vcf header text file; vcf file may be corrupted" << endl; + } + while (getline(vcfHeader, line)) { + // TODO: Trim off any whitespace at end of line + VCFOutFile << line << endl; + } + + string rufusBranch = ""; + string rufusVersion = ""; + string rufusCommandLineInvoc = ""; + ifstream ArgFile; + string samplename = outStub.substr(0, outStub.find(".generator")); + const string marker = ".chr"; + auto pos = samplename.rfind(marker); + string stripped_name; + string region; + if (pos != std::string::npos) { + stripped_name = samplename.substr(0, pos); + region = samplename.substr(pos + 1); // skip the '.' + } else { + stripped_name = samplename; // fallback + } + cout << "region is " << region << endl; + // Testing + ArgFile.open(rufusInvocFile); + if (ArgFile.is_open()) { + int lineIdx = 0; + while(getline(ArgFile, line)) { + if (lineIdx == 0) { + rufusBranch = line; + } else if (lineIdx == 1) { + rufusVersion = line; + } else { + rufusCommandLineInvoc = line; + } + lineIdx++; + } + } + else { + cout << "Error, ArgFile could not be opened"; + } - string boom = outStub; - VCFOutFile.open(boom+ ".vcf"); - BEDOutFile.open(boom+ ".vcf.bed"); - boom = "Intermediates/" + boom; - BEDBigStuff.open(boom+ ".vcf.Big.bed"); - BEDNotHandled.open(boom+ ".vcf.NotHandled.bed"); - Invertions.open(boom+".vcf.invertions.bed"); - Translocations.open(boom+ ".vcf.Translocations"); - Translocationsbed.open(boom+ ".vcf.Translocations.bed"); - Unaligned.open(boom+"vcf.Unaligned"); - - //write VCF header - VCFOutFile << "##fileformat=VCFv4.1" << endl; - VCFOutFile << "##fileDate=" << time(0) << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO="<"<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##FILTER=" << std::endl; - VCFOutFile << "##FILTER=" << std::endl; - VCFOutFile << "##FILTER=" << std::endl; - VCFOutFile << "##FILTER=" << std::endl; - VCFOutFile << "##ALT=" << std::endl; - VCFOutFile << "##ALT=" << std::endl; - VCFOutFile << "##ALT=" << std::endl; - - VCFOutFile << "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t"; - - string samplename = outStub.substr(0, outStub.find(".generator")); - VCFOutFile << samplename; - //VCFOutFile << outStub; - for(int i =0; i Names; + vector reads; + int counter = 0; - cout << "Reading in Sam File" << endl; - map Names; - vector reads; - int counter = 0; - while (getline(SamFile, line)) - { - if (line.c_str()[0] == '@') - { - //cout << " HEADER LINE = " << line << endl; - vector temp = Split(line, '\t'); - //cout << temp[0] << endl; - if (temp[0] == "@SQ") - { - // cout << temp[1] << endl; - vector chr = Split(temp[1], ':'); - vector len = Split(temp[2], ':'); - - // cout << "##contig="<< endl; - VCFOutFile <<"##contig=" << endl; - } - } - else - { - //cout << line << endl; - counter ++; - SamRead read; - //cout << "parse " << endl; - read.parse(line); - //if (read.mapQual > 0) - if (read.FlagBits[2] != 1) //verify if read is mapped - { - read.parsed = true; - read.getRefSeq(); - read.createPeakMap(); - read.checkMob(mobs); - if (AlignmentAllA(read) > .9) - { - read.mapQual = 0; - read.AllA = true; - } - int a; - string b; - // cout << "Aligned bases = " << read.CheckBasesAligned() << endl; - if (read.CheckBasesAligned() > 50 or read.CheckEndsAlign()) - {reads.push_back(read);} - else - {}//cout << "SKIPPING Alignment" << endl; read.write();} - if (counter%100 == 0) - cout << "read " << counter << " entries " << char(13); - } - //else do I want to track unaliged alignments? - } - } - //cout << endl; - //cout << "Read in " << reads.size() << " reads " << endl; - if (reads.size() == 0) - { - cout << "no reads were passed to RUFUS.interpret exiting" << endl; - return 0; - } + while (getline(SamFile, line)) { + if (!line.empty() && line[0] == '@') { + vector temp = Split(line, '\t'); - // VCFOutFile << "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t"; - //VCFOutFile << outStub << endl; + if (temp[0].rfind("@SQ", 0) == 0) { + string chr, len; - - cout << "procesing split reads" << endl; - for (int i = 0; i < reads.size(); i++) - { - // cout << "processing read " << reads[i].name << endl; - if (reads[i].alignments.size() == 0) - { - reads[i].alignments.push_back(i); - int count = 0; - for (int j = i+1; j < reads.size(); j++) - { - count++; - if (strcmp(reads[i].name.c_str(), reads[j].name.c_str()) == 0 && reads[i].pos )// !=reads[j].pos) - { - // cout << "found mate " << reads[j].name << endl; - - reads[i].alignments.push_back(j); - reads[j].alignments.push_back(j); - reads[j].alignments.push_back(i); - reads[j].first = false; - - } - //if (count > 100000) - // break; - } - } - //for (int j = 0; j\n"; + } + } + } else { + counter++; + SamRead read; + read.parse(line); + //if (read.mapQual > 0) + if (read.FlagBits[2] != 1) //verify if read is mapped + { + read.parsed = true; + read.getRefSeq(); + read.createPeakMap(); + read.checkMob(mobs); + if (AlignmentAllA(read) > .9) { + read.mapQual = 0; + read.AllA = true; + } + int a; + string b; + if (read.CheckBasesAligned() > 50 or read.CheckEndsAlign()) { reads.push_back(read); } + else {} + if (counter % 100 == 0) + cout << "read " << counter << " entries " << char(13); + } + //else do I want to track unaliged alignments? + } + } + if (reads.size() == 0) { + cout << "no reads were passed to RUFUS.interpret exiting" << endl; + return 0; + } + VCFOutFile << "##RUFUSCommandLine=" << endl; + // Write out final header line with sample names + VCFOutFile << "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t"; + + VCFOutFile << stripped_name; + for (int i = 0; i < ParentHashFilePaths.size(); i++) { + string ParPath = argv[ParentHashFilePaths[i]]; + string Par = ParPath; + const string parMarker = "overlap.asembly.hash.fastq."; + auto markerPos = Par.find(parMarker); + if (markerPos != std::string::npos) { + Par = Par.substr(markerPos + parMarker.size()); + } + auto lastSlash = Par.rfind('/'); + if (lastSlash != std::string::npos) { + Par = Par.substr(lastSlash + 1); + } + auto chrPos = Par.rfind(".chr"); + if (chrPos != std::string::npos) { + Par = Par.substr(0, chrPos); + } + ParNames.push_back(Par); + VCFOutFile << "\t" << Par; + } + VCFOutFile << endl; + + cout << "procesing split reads" << endl; + for (int i = 0; i < reads.size(); i++) { + // cout << "processing read " << reads[i].name << endl; + if (reads[i].alignments.size() == 0) { + reads[i].alignments.push_back(i); + int count = 0; + for (int j = i + 1; j < reads.size(); j++) { + count++; + if (strcmp(reads[i].name.c_str(), reads[j].name.c_str()) == 0 && reads[i].pos)// !=reads[j].pos) + { + // cout << "found mate " << reads[j].name << endl; - cout << "finding multi contig events, " << reads.size() << endl; - //find multi contig events insertionsf - for (int i = 0; i < reads.size()-1; i++) - { - int pos, pos2, kdep, kdep2; - string InsStart, InsEnd; - // cout << "########################################STARTING NEW LOOP MOB#############################" << endl; - // cout << "i = " << i << endl; - // reads[i].write(); - //check mobil elements first - if (reads[i].isSplitRead > 0 && reads[i].MobAligned) - { - bool found = false; - // cout << "Posible multi read mobil element" << endl; - //reads[i].write(); - - // do I have a breakpoint supporoted by hashes - int bp = reads[i].sigBreakPoint(); - // cout << "HEREbp = " << bp << endl; - if (bp > 0) - { - // cout << "Passed SigBreakpoint check MobLoop" << endl; - int start = -2; - while (start + i < 0) - {start ++;} - // cout << "start = " << start << endl; - for ( int j = start; j<= 2 && j+i >= 0 && j+i < reads.size() ; j++) - { - // cout << " checking " << j << " = " << reads[i+j].name << " " << reads[i].chr << " == " << reads[i+j].chr <<" && abs( " << reads[i].pos << " - " << reads[i+j].pos << ") < 2000 = " << reads[i].pos-reads[i+j].pos << endl; - - if (j != 0 /*&& reads[i].name != reads[i+j].name*/ && reads[i].chr == reads[i+j].chr && abs(reads[i].pos - reads[i+j].pos) < 2000 ) - { - vector temp; - for (int k = 0; k < reads[i+j].alignments.size(); k++) - { - if (reads[i+j].alignments[k] != i+j && reads[reads[i+j].alignments[k]].mapQual > 30) - { - temp.push_back(reads[reads[i+j].alignments[k]]); - } - } - int polyAbp = reads[i+j].isPolyA(temp); - - // cout << "Poly A pos = " << polyAbp << "read A pos = " << reads[i].pos+bp << " and read B pos = " << reads[i+j].pos + polyAbp << " with abs " << abs((reads[i].pos+bp) - (reads[i+j].pos+polyAbp))<< endl; - - if ( polyAbp > -1 && abs((reads[i].pos+bp) - (reads[i+j].pos+polyAbp)) < 50 ) - { - if ((reads[i].clipPattern == "cm" && reads[i+j].clipPattern == "mc" ) || (reads[i].clipPattern == "mc" && reads[i+j].clipPattern == "cm" ) ) - { - // cout << "FOUND MOB" << endl; - if (reads[i].SVeventid ==0) - { - CurrentSVeventID++; - - int targetsize = 0; - if (reads[i].clipPattern == "mc") - { - int start = reads[i].pos + bp; - int end = reads[i+j].pos + reads[i+j].sigBreakPoint(); - targetsize = start - end; - } - else - { - int end = reads[i].pos + bp; - int start = reads[i+j].pos + reads[i+j].sigBreakPoint(); - targetsize = start - end; - } - //if (targetsize >0) - { - - string GenotypeField; - if (CheckGenotypes(reads[i].createStructGenotype(reads[i].sigBreakPoint()))) - GenotypeField = reads[i].createStructGenotype(reads[i].sigBreakPoint()); - else - GenotypeField = reads[i+j].createStructGenotype(reads[i+j].sigBreakPoint()); - - - stringstream Format ; - Format << InterpretTargetSize(targetsize); - Format << "MOB"; - Format << "-"; - Format << "LCa-" << reads[i].SVCheckParentsForLowCov(reads[i].sigBreakPoint()) << "-LCb-" << reads[i+j].SVCheckParentsForLowCov(reads[i+j].sigBreakPoint()) << "-" ; - Format << reads[i].MobAS; - string ref = Reff.getSubSequence(reads[i].chr, reads[i].pos+bp -1 ,1); - - stringstream alt ; - alt << ""; - - string FullfilterA = reads[i].filterSV(); - string FullfilterB = "" ; //reads[i+j].filterSV(); - int GMap = 0; - int minMapQual = 30; - - - ///////// not sure this is a good idea, why am I checking all the alignemtns, im just worried about this one - // for(int k = 0; k < reads[i].alignments.size(); k++) - // { - // if ( reads[reads[i].alignments[k]].mapQual > minMapQual) - // GMap++; - // } - // for(int k = 0; k < reads[i+j].alignments.size(); k++) - // { - // if ( reads[reads[i+j].alignments[k]].mapQual > minMapQual) - // GMap++; - // } - - - if (reads[i].mapQual > minMapQual) - GMap++; - ////if (reads[reads[i].alignments[1]].mapQual > minMapQual) - //// GMap++; - if ( reads[i+j].mapQual > minMapQual) - GMap++; - ////if (reads[reads[i+j].alignments[1]].mapQual > minMapQual) - //// GMap++; - - string InfoFilter = ""; - string Filter = ""; - - if (GMap <= 0) - { - Format<< "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "" && FullfilterB == "") - { - found = true; - Format<<"-DeNovo"; - InfoFilter = "Pass"; - Filter = "PASS"; - for(int k = 0; k < reads[i].alignments.size(); k++) - {reads[reads[i].alignments[k]].SVeventid = CurrentSVeventID;} - for(int k = 0; k < reads[i+j].alignments.size(); k++) - {reads[reads[i+j].alignments[k]].SVeventid = CurrentSVeventID;} - } - else - { - Format<<"-" << FullfilterA << "," < 0) - qual = ((float)readAmut+(float)readBmut) / ((float)readApos+(float)readBpos) * 100.0; - else - qual = 0; - - //buildng up info field - stringstream info; - info << "SVTYPE=INS;END=" << reads[i].pos+bp -1 << ";"; - info << "MT=" << reads[i].MobContig << ";"; - string phase="none"; - if (reads[i].phase != "none") - phase = reads[i].phase; - else if (reads[i+j].phase != "none") - phase = reads[i+j].phase; - info << "PH=" << phase << ";"; - info << "FEX=" << InfoFilter << ";"; - int SupportingHashes = readAmut+readBmut; - int possibleHashes = readApos+readBpos; - info << "FS=" << SupportingHashes << "/" < 0 || reads[reads[i].alignments[1]].sigBreakPoint() > 0 || BreakpointInUnalignedCenter(reads[i], reads[reads[i].alignments[1]] )) - { - // cout << "one of them has a sig breakpoint" << endl; - if (((reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].BreakPoint()) - (reads[i].pos+reads[i].BreakPoint())) > MaxVarentSize) - { - // cout << "its big enough " << abs((reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].BreakPoint()) - (reads[i].pos+reads[i].BreakPoint())) << endl; - if (GetReadOrientation(reads[i].flag) == GetReadOrientation(reads[reads[i].alignments[1]].flag)) - { - // cout << "same orientation" << endl; - if (reads[i].clipPattern == "mc" && reads[reads[i].alignments[1]].clipPattern == "cm" ) - { - // cout << "correct pattern its a del " << endl; - //deletion - - CurrentSVeventID++; - //reads[i].SVeventid = CurrentSVeventID; - //reads[reads[i].alignments[1]].SVeventid = CurrentSVeventID; - - string GenotypeField; - if (CheckGenotypes(reads[i].createStructGenotype(reads[i].sigBreakPoint()))) - GenotypeField = reads[i].createStructGenotype(reads[i].sigBreakPoint()); - else - GenotypeField = reads[reads[i].alignments[1]].createStructGenotype(reads[reads[i].alignments[1]].sigBreakPoint()); - - if (GenotypeField == "") - {}//cout << "ERRORGeno DUP" << " " << GenotypeField << endl; - string insertseq = GetUnalignedCenter(reads[i], reads[reads[i].alignments[1]]); - int targetsize = ((reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].BreakPoint()) - (reads[i].pos + reads[i].BreakPoint())) *-1; - stringstream Format ; - Format << InterpretInsertSize(insertseq); - Format << InterpretTargetSize(targetsize); //////////////////////////////////// - - - string ref = Reff.getSubSequence(reads[i].chr, reads[i].pos + reads[i].BreakPoint() -1 , 1); - - stringstream alt ; - alt << insertseq; - alt << ""; - - string FullfilterA = reads[i].filterSV(); - int GMap = 0; - int minMapQual = 40; - if (reads[i].mapQual > minMapQual) - GMap++; - if (reads[reads[i].alignments[1]].mapQual > minMapQual) - GMap++; - - string InfoFilter = ""; - string Filter = ""; - - if (GMap < 1) - { - Format<< "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "") - { - Format<<"-DeNovo"; - InfoFilter = "Pass"; - Filter = "PASS"; - reads[i].SVeventid = CurrentSVeventID; - reads[reads[i].alignments[1]].SVeventid = CurrentSVeventID; - } - else - { - Format<<"-" << FullfilterA; - InfoFilter = FullfilterA; - Filter = "fail"; - } - //make quality stuff - int readAmut=0; - int readApos=0; - reads[i].GetQualityHashes(readAmut, readApos, reads[i].BreakPoint()); - - float qual = -100; - if ((readApos) > 0) - qual = ((float)readAmut) / ((float)readApos) * 100.0; - else - qual = 0; - - - //buildng up info field - stringstream info; - info << "SVTYPE=DEL;END=" << reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].BreakPoint() << ";"; - info << "SVLEN=" << targetsize*1 << ";"; - string phase="none"; - if (reads[i].phase != "none") - phase = reads[i].phase; - info << "PH=" << phase << ";"; - info << "FEX=" << InfoFilter << ";"; - int SupportingHashes = readAmut; - int possibleHashes = readApos; - info << "FS=" << SupportingHashes << "/" <"; - //cout << "here3" << endl; - string FullfilterA = reads[i].filterSV(); - int GMap = 0; - int minMapQual = 20; - if (reads[i].mapQual > minMapQual) - GMap++; - if (reads[reads[i].alignments[1]].mapQual > minMapQual) - GMap++; - //cout << "here4" << endl; - string InfoFilter = ""; - string Filter = ""; - - if (GMap < 2) - { - Format<< "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "") - { - Format<<"-DeNovo"; - InfoFilter = "Pass"; - Filter = "PASS"; - reads[i].SVeventid = CurrentSVeventID; - reads[reads[i].alignments[1]].SVeventid = CurrentSVeventID; - } - else - { - Format<<"-"<< FullfilterA; - InfoFilter = FullfilterA; - Filter = "fail"; - } - //cout << "here 5" << endl; - //make quality stuff - int readAmut=0; - int readApos=0; - reads[i].GetQualityHashes(readAmut, readApos, reads[i].BreakPoint()); - //cout << "here 6" << endl; - float qual = -100; - if ((readApos) > 0) - qual = ((float)readAmut) / ((float)readApos) * 100.0; - else - qual = 0; - - //cout << "here 7" << endl; - //buildng up info field - stringstream info; - info << "SVTYPE=DUP;END=" << reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].BreakPoint() << ";"; - //cout << "here 8" << endl; - info << "SVLEN=" << targetsize << ";"; - string phase="none"; - if (reads[i].phase != "none") - phase = reads[i].phase; - info << "PH=" << phase << ";"; - info << "FEX=" << InfoFilter << ";"; - int SupportingHashes = readAmut; - int possibleHashes = readApos; - info << "FS=" << SupportingHashes << "/" < 100000) + // break; + } + } + //for (int j = 0; j -1 && abs((reads[i].pos + bp) - (reads[i + j].pos + polyAbp)) < 50) { + if ((reads[i].clipPattern == "cm" && reads[i + j].clipPattern == "mc") || + (reads[i].clipPattern == "mc" && reads[i + j].clipPattern == "cm")) { + // cout << "FOUND MOB" << endl; + if (reads[i].SVeventid == 0) { + CurrentSVeventID++; + + int targetsize = 0; + if (reads[i].clipPattern == "mc") { + int start = reads[i].pos + bp; + int end = reads[i + j].pos + reads[i + j].sigBreakPoint(); + targetsize = start - end; + } else { + int end = reads[i].pos + bp; + int start = reads[i + j].pos + reads[i + j].sigBreakPoint(); + targetsize = start - end; + } + //if (targetsize >0) + { + + string GenotypeField; + if (CheckGenotypes(reads[i].createStructGenotype(reads[i].sigBreakPoint()))) + GenotypeField = reads[i].createStructGenotype(reads[i].sigBreakPoint()); + else + GenotypeField = reads[i + j].createStructGenotype( + reads[i + j].sigBreakPoint()); + + + stringstream Format; + Format << InterpretTargetSize(targetsize); + Format << "MOB"; + Format << "-"; + Format << "LCa-" << reads[i].SVCheckParentsForLowCov(reads[i].sigBreakPoint()) + << "-LCb-" + << reads[i + j].SVCheckParentsForLowCov(reads[i + j].sigBreakPoint()) + << "-"; + Format << reads[i].MobAS; + // TODO: is this where the REF base obtained? i.e. what is the bug + // I'm guessing just an off-by-one error here + string ref = Reff.getSubSequence(reads[i].chr, reads[i].pos + bp - 1, 1); + + stringstream alt; + alt << ""; + + string FullfilterA = reads[i].filterSV(); + string FullfilterB = ""; //reads[i+j].filterSV(); + int GMap = 0; + int minMapQual = 30; + + + ///////// not sure this is a good idea, why am I checking all the alignemtns, im just worried about this one + // for(int k = 0; k < reads[i].alignments.size(); k++) + // { + // if ( reads[reads[i].alignments[k]].mapQual > minMapQual) + // GMap++; + // } + // for(int k = 0; k < reads[i+j].alignments.size(); k++) + // { + // if ( reads[reads[i+j].alignments[k]].mapQual > minMapQual) + // GMap++; + // } + + + if (reads[i].mapQual > minMapQual) + GMap++; + ////if (reads[reads[i].alignments[1]].mapQual > minMapQual) + //// GMap++; + if (reads[i + j].mapQual > minMapQual) + GMap++; + ////if (reads[reads[i+j].alignments[1]].mapQual > minMapQual) + //// GMap++; + + string InfoFilter = ""; + string Filter = ""; + + if (GMap <= 0) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "" && FullfilterB == "") { + found = true; + Format << "-DeNovo"; + InfoFilter = "Pass"; + Filter = "PASS"; + for (int k = 0; k < + reads[i].alignments.size(); k++) { reads[reads[i].alignments[k]].SVeventid = CurrentSVeventID; } + for (int k = 0; k < reads[i + j].alignments.size(); k++) { + reads[reads[i + j].alignments[k]].SVeventid = CurrentSVeventID; + } + } else { + Format << "-" << FullfilterA << "," << FullfilterB; + InfoFilter = FullfilterA; + InfoFilter += FullfilterB; + Filter = "fail"; + } + + + //make quality stuff + int readAmut = 0; + int readApos = 0; + int readBmut = 0; + int readBpos = 0; + reads[i].GetQualityHashes(readAmut, readApos, reads[i].sigBreakPoint()); + reads[i + j].GetQualityHashes(readBmut, readBpos, reads[i + j].sigBreakPoint()); + + float qual = -100; + if ((readApos + readBpos) > 0) + qual = ((float) readAmut + (float) readBmut) / + ((float) readApos + (float) readBpos) * 100.0; + else + qual = 0; + + //buildng up info field + stringstream info; + info << "SVTYPE=INS;END=" << reads[i].pos + bp - 1 << ";"; + info << "MT=" << reads[i].MobContig << ";"; + string phase = "none"; + if (reads[i].phase != "none") + phase = reads[i].phase; + else if (reads[i + j].phase != "none") + phase = reads[i + j].phase; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + int SupportingHashes = readAmut + readBmut; + int possibleHashes = readApos + readBpos; + info << "FS=" << SupportingHashes << "/" << possibleHashes << ";"; + + info << "RN=" << reads[i].name << "_and_" << reads[i + j].name << ";"; + info << "MQ=" << reads[i].mapQual << "_and_" << reads[i + j].mapQual << ";"; + info << "cigar=" << reads[i].cigar << "_and_" << reads[i + j].cigar << ";"; + info << "SB=" << reads[i].StrandBias << "_and_" << reads[i + j].StrandBias + << ";"; + info << "AS=" << reads[i].AlignmentSegments << "-" + << reads[i].AlignmentSegmentsCigar << "_and_" + << reads[i + j].AlignmentSegments << "-" + << reads[i + j].AlignmentSegmentsCigar; + stringstream call; + call << reads[i].chr << "\t" << reads[i].pos + bp - 1 << "\t" << Format.str() + << "\t" << ref << "\t" << alt.str() << "\t" << qual << "\t" << Filter + << "\t" << info.str() << "\t" << "GT:DP:RO:AO\t" << GenotypeField << endl; + VCFOutFile << call.str(); + // break; + } + //else + // cout << "MOBS cant have deletions, " << targetsize << endl; + } + } + } + } + } + } + if (found) + continue; + } + } + for (int i = 0; i < reads.size() - 1; i++) { + int pos, pos2, kdep, kdep2; + string InsStart, InsEnd; + // cout << "########################################STARTING NEW LOOP#############################" << endl; + // reads[i].write(); + // cout << "checkingbigdel" << endl; + // reads[i].write(); + if (reads[i].alignments.size() == 2 && reads[i].SVeventid == 0) { + // cout << "possible big del" << endl; + // reads[i].write(); + // reads[reads[i].alignments[1]].write(); + if (reads[i].chr == reads[reads[i].alignments[1]].chr) { + // cout << "reads on same chr" << endl; + if (reads[i].sigBreakPoint() > 0 || reads[reads[i].alignments[1]].sigBreakPoint() > 0 || + BreakpointInUnalignedCenter(reads[i], reads[reads[i].alignments[1]])) { + // cout << "one of them has a sig breakpoint" << endl; + if (((reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].BreakPoint()) - + (reads[i].pos + reads[i].BreakPoint())) > MaxVarentSize) { + // cout << "its big enough " << abs((reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].BreakPoint()) - (reads[i].pos+reads[i].BreakPoint())) << endl; + if (GetReadOrientation(reads[i].flag) == + GetReadOrientation(reads[reads[i].alignments[1]].flag)) { + // cout << "same orientation" << endl; + if (reads[i].clipPattern == "mc" && reads[reads[i].alignments[1]].clipPattern == "cm") { + // cout << "correct pattern its a del " << endl; + //deletion + + CurrentSVeventID++; + //reads[i].SVeventid = CurrentSVeventID; + //reads[reads[i].alignments[1]].SVeventid = CurrentSVeventID; + + string GenotypeField; + if (CheckGenotypes(reads[i].createStructGenotype(reads[i].sigBreakPoint()))) + GenotypeField = reads[i].createStructGenotype(reads[i].sigBreakPoint()); + else + GenotypeField = reads[reads[i].alignments[1]].createStructGenotype( + reads[reads[i].alignments[1]].sigBreakPoint()); + + if (GenotypeField == "") {}//cout << "ERRORGeno DUP" << " " << GenotypeField << endl; + string insertseq = GetUnalignedCenter(reads[i], reads[reads[i].alignments[1]]); + int targetsize = ((reads[reads[i].alignments[1]].pos + + reads[reads[i].alignments[1]].BreakPoint()) - + (reads[i].pos + reads[i].BreakPoint())) * -1; + stringstream Format; + Format << InterpretInsertSize(insertseq); + Format << InterpretTargetSize(targetsize); //////////////////////////////////// + + + string ref = Reff.getSubSequence(reads[i].chr, reads[i].pos + reads[i].BreakPoint() - 1, + 1); + + stringstream alt; + // TODO: this is incompatible with vcf formatting - need to address + //alt << insertseq; + alt << ""; + + string FullfilterA = reads[i].filterSV(); + int GMap = 0; + int minMapQual = 40; + if (reads[i].mapQual > minMapQual) + GMap++; + if (reads[reads[i].alignments[1]].mapQual > minMapQual) + GMap++; + + string InfoFilter = ""; + string Filter = ""; + + if (GMap < 1) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "") { + Format << "-DeNovo"; + InfoFilter = "Pass"; + Filter = "PASS"; + reads[i].SVeventid = CurrentSVeventID; + reads[reads[i].alignments[1]].SVeventid = CurrentSVeventID; + } else { + Format << "-" << FullfilterA; + InfoFilter = FullfilterA; + Filter = "fail"; + } + //make quality stuff + int readAmut = 0; + int readApos = 0; + reads[i].GetQualityHashes(readAmut, readApos, reads[i].BreakPoint()); + + float qual = -100; + if ((readApos) > 0) + qual = ((float) readAmut) / ((float) readApos) * 100.0; + else + qual = 0; + + + //buildng up info field + stringstream info; + info << "SVTYPE=DEL;END=" + << reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].BreakPoint() + << ";"; + info << "SVLEN=" << targetsize * 1 << ";"; + string phase = "none"; + if (reads[i].phase != "none") + phase = reads[i].phase; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + int SupportingHashes = readAmut; + int possibleHashes = readApos; + info << "FS=" << SupportingHashes << "/" << possibleHashes << ";"; + + info << "RN=" << reads[i].name << ";"; + info << "MQ=" << reads[i].mapQual << "_and_" << reads[reads[i].alignments[1]].mapQual + << ";"; + info << "cigar=" << reads[i].cigar << "_and_" << reads[reads[i].alignments[1]].cigar + << ";"; + info << "SB=" << reads[i].StrandBias << ";"; + info << "AS=" << reads[i].AlignmentSegments << "-" << reads[i].AlignmentSegmentsCigar + << "_and_" << reads[reads[i].alignments[1]].AlignmentSegments << "-" + << reads[reads[i].alignments[1]].AlignmentSegmentsCigar; + + stringstream call; + call << reads[i].chr << "\t" << reads[i].pos + reads[i].BreakPoint() - 1 << "\t" + << Format.str() << "\t" << ref << "\t" << alt.str() << "\t" << qual << "\t" + << Filter << "\t" << info.str() << "\t" << "GT:DP:RO:AO\t" << GenotypeField + << endl; + // cout << call.str(); + VCFOutFile << call.str(); + + + } else if (reads[i].clipPattern == "cm" && + reads[reads[i].alignments[1]].clipPattern == "mc") { + // dup + // cout << "event is dup" << endl; + CurrentSVeventID++; + //reads[i].SVeventid = CurrentSVeventID; + //reads[reads[i].alignments[1]].SVeventid = CurrentSVeventID; + // cout << "here -1" << endl; + + string GenotypeField; + + int sbpA = reads[i].sigBreakPoint(); + int sbpB = reads[reads[i].alignments[1]].sigBreakPoint(); + // cout << "sbpA = " << sbpA << " sbpB = " << sbpB << endl; + + if (CheckGenotypes(reads[i].createStructGenotype(reads[i].sigBreakPoint()))) + GenotypeField = reads[i].createStructGenotype(reads[i].sigBreakPoint()); + else + GenotypeField = reads[reads[i].alignments[1]].createStructGenotype( + reads[reads[i].alignments[1]].sigBreakPoint()); + + if (GenotypeField == "") {}// cout << "ERRORGeno DUP" << " " << GenotypeField << endl; + //cout << "here" << endl; + string insertseq = GetUnalignedCenter(reads[i], reads[reads[i].alignments[1]]); + int targetsize = ((reads[reads[i].alignments[1]].pos + + reads[reads[i].alignments[1]].BreakPoint()) - + (reads[i].pos + reads[i].BreakPoint())); + stringstream Format; + Format << InterpretInsertSize(insertseq); + Format << InterpretTargetSize(targetsize); //////////////////////////////////// + //cout << "here2" << endl; + + string ref = Reff.getSubSequence(reads[i].chr, + reads[i].pos + reads[i].BreakPoint() - 1 - 1, 1); + + stringstream alt; + //falt << insertseq; + alt << ""; + //cout << "here3" << endl; + string FullfilterA = reads[i].filterSV(); + int GMap = 0; + int minMapQual = 20; + if (reads[i].mapQual > minMapQual) + GMap++; + if (reads[reads[i].alignments[1]].mapQual > minMapQual) + GMap++; + //cout << "here4" << endl; + string InfoFilter = ""; + string Filter = ""; + + if (GMap < 2) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "") { + Format << "-DeNovo"; + InfoFilter = "Pass"; + Filter = "PASS"; + reads[i].SVeventid = CurrentSVeventID; + reads[reads[i].alignments[1]].SVeventid = CurrentSVeventID; + } else { + Format << "-" << FullfilterA; + InfoFilter = FullfilterA; + Filter = "fail"; + } + //cout << "here 5" << endl; + //make quality stuff + int readAmut = 0; + int readApos = 0; + reads[i].GetQualityHashes(readAmut, readApos, reads[i].BreakPoint()); + //cout << "here 6" << endl; + float qual = -100; + if ((readApos) > 0) + qual = ((float) readAmut) / ((float) readApos) * 100.0; + else + qual = 0; + + //cout << "here 7" << endl; + //buildng up info field + stringstream info; + info << "SVTYPE=DUP;END=" + << reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].BreakPoint() + << ";"; + //cout << "here 8" << endl; + info << "SVLEN=" << targetsize << ";"; + string phase = "none"; + if (reads[i].phase != "none") + phase = reads[i].phase; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + int SupportingHashes = readAmut; + int possibleHashes = readApos; + info << "FS=" << SupportingHashes << "/" << possibleHashes << ";"; + + info << "RN=" << reads[i].name << ";"; + info << "MQ=" << reads[i].mapQual << "_and_" << reads[reads[i].alignments[1]].mapQual + << ";"; + info << "cigar=" << reads[i].cigar << "_and_" << reads[reads[i].alignments[1]].cigar + << ";"; + info << "SB=" << reads[i].StrandBias << ";"; + info << "AS=" << reads[i].AlignmentSegments << "-" << reads[i].AlignmentSegmentsCigar + << "_and_" << reads[reads[i].alignments[1]].AlignmentSegments << "-" + << reads[reads[i].alignments[1]].AlignmentSegmentsCigar; + + stringstream call; + call << reads[i].chr << "\t" << reads[i].pos + reads[i].BreakPoint() - 1 << "\t" + << Format.str() << "\t" << ref << "\t" << alt.str() << "\t" << qual << "\t" + << Filter << "\t" << info.str() << "\t" << "GT:DP:RO:AO\t" << GenotypeField + << endl; + // cout << call.str(); + VCFOutFile << call.str(); + } + } + } + } + } + } - if (read.first and read.alignments.size() > 1) - { - // cout << "picking two best alignments" << endl; - map alignScores; - for (int j = 0; j < read.alignments.size(); j++){ - float score = (float) reads[read.alignments[j]].AlignScore; - while (not (alignScores.find(score) == alignScores.end())){ - score = score * 1.0001; - } - alignScores[score] = j; - } - vector goodPos; - std::map::reverse_iterator it; - for ( it = alignScores.rbegin(); it != alignScores.rend(); it++ ) - { - // cout << it->first << " - " << it->second << endl; - goodPos.push_back(it->second); - } - // cout << "atempting colaps "<< read.name << endl; - vector R; - for(int j =0; j < read.alignments.size(); j++) //read.alignments.size(); j++) - { - //these better be sorted by position - //if (reads[read.alignments[j]].chr == read.chr) - if (j == goodPos[0] or j == goodPos[1]) - { - R.push_back(reads[read.alignments[j]]); - // cout << reads[read.alignments[j]].name << endl; - } - } - // cout << "made it out o this loop" << endl; - if (R.size() ==2 && /*R[0].chr == R[1].chr && */ (R[0].mapQual > 0 and R[1].mapQual > 0) && R[0].SVeventid == 0 ) - { - // cout << "straing better way Rsize = " << R.size() << endl; - read = BetterWay(R); - // cout << "ending better way" << endl; - } + } + cout << "###################done with multi contigs####################" << endl; + for (int i = 0; i < reads.size(); i++) { + SamRead read = reads[i]; + // cout << "starting work on " << endl; + // cout << read.name << endl; + // cout << "alignments = " << read.alignments.size() << endl; - } - else if(read.first and read.alignments.size() >2) - { - BEDNotHandled << "too many alignments" << endl; - BEDNotHandled << read.chr << "\t" << read.pos << "\t" << read.pos+read.seq.size() << "\t" << read.name << "\t" << read.cigar << endl; - // cout << "too many alignments" << endl; - // cout << read.chr << "\t" << read.pos << "\t" << read.pos+read.seq.size() << "\t" << read.name << "\t" << read.cigar << endl; - for (int j = 0; j< read.alignments.size(); j++) - { - SamRead mate = reads[read.alignments[j]]; - // cout << j << "\t" << mate.chr << "\t" << mate.pos << "\t" << mate.pos+mate.seq.size() << "\t" << mate.name << "\t" << mate.cigar << endl; - BEDNotHandled << mate.chr << "\t" << mate.pos << "\t" << mate.pos+mate.seq.size() << "\t" << mate.name << "\t" << mate.cigar << endl; - mate.writetofile(BEDNotHandled); - } - BEDNotHandled << endl << endl; - } - if (read.mapQual > MinMapQual and read.alignments.size() <=2) - { - //reads[i].CheckPhase(); - read.parseMutations(argv, reads); - } - else - { - // cout << "map qual " << read.mapQual << " less than mim map qual of " << MinMapQual << endl; - } - } - } - //cout << "finding multi contig events, " << reads.size() << endl; - //Mopping up less likey multi contig optoins - bool cleanup = true; - if (cleanup == true) - { - for (int i = 0; i < reads.size()-1; i++) - { - // chekcing translocation - if (reads[i].alignments.size()==2) - { - if ((reads[i].sigBreakPoint() > 0 || reads[reads[i].alignments[1]].sigBreakPoint() > 0 || BreakpointInUnalignedCenter(reads[i], reads[reads[i].alignments[1]] )) && reads[i].clipPattern.length()==2 && reads[reads[i].alignments[1]].clipPattern.length()==2) - { - // cout << "passed First Trans " << endl; + if (strcmp(read.chr.c_str(), "*") == 0) { + read.writetofile(Unaligned); + Unaligned << endl; + // cout << "read unaligned, skipping" << endl; + } + //if (read.first) + { + //if it looks like a simple split read alignment colaps it into a single read + + if (read.first and read.alignments.size() > 1) { + // cout << "picking two best alignments" << endl; + map alignScores; + for (int j = 0; j < read.alignments.size(); j++) { + float score = (float) reads[read.alignments[j]].AlignScore; + while (not(alignScores.find(score) == alignScores.end())) { + score = score * 1.0001; + } + alignScores[score] = j; + } + vector goodPos; + std::map::reverse_iterator it; + for (it = alignScores.rbegin(); it != alignScores.rend(); it++) { + // cout << it->first << " - " << it->second << endl; + goodPos.push_back(it->second); + } + // cout << "atempting colaps "<< read.name << endl; + vector R; + + for (int j = 0; j < read.alignments.size(); j++) //read.alignments.size(); j++) + { + //these better be sorted by position + //if (reads[read.alignments[j]].chr == read.chr) + if (j == goodPos[0] or j == goodPos[1]) { + R.push_back(reads[read.alignments[j]]); + // cout << reads[read.alignments[j]].name << endl; + } + } + // cout << "made it out o this loop" << endl; + if (R.size() == 2 && /*R[0].chr == R[1].chr && */ (R[0].mapQual > 0 and R[1].mapQual > 0) && + R[0].SVeventid == 0) { + // cout << "straing better way Rsize = " << R.size() << endl; + read = BetterWay(R); + // cout << "ending better way" << endl; + } + + } else if (read.first and read.alignments.size() > 2) { + BEDNotHandled << "too many alignments" << endl; + BEDNotHandled << read.chr << "\t" << read.pos << "\t" << read.pos + read.seq.size() << "\t" << read.name + << "\t" << read.cigar << endl; + // cout << "too many alignments" << endl; + // cout << read.chr << "\t" << read.pos << "\t" << read.pos+read.seq.size() << "\t" << read.name << "\t" << read.cigar << endl; + for (int j = 0; j < read.alignments.size(); j++) { + SamRead mate = reads[read.alignments[j]]; + // cout << j << "\t" << mate.chr << "\t" << mate.pos << "\t" << mate.pos+mate.seq.size() << "\t" << mate.name << "\t" << mate.cigar << endl; + BEDNotHandled << mate.chr << "\t" << mate.pos << "\t" << mate.pos + mate.seq.size() << "\t" + << mate.name << "\t" << mate.cigar << endl; + mate.writetofile(BEDNotHandled); + } + BEDNotHandled << endl << endl; + } + if (read.mapQual > MinMapQual and read.alignments.size() <= 2) { + //reads[i].CheckPhase(); + read.parseMutations(argv, reads); + } else { + // cout << "map qual " << read.mapQual << " less than mim map qual of " << MinMapQual << endl; + } + } + } + //cout << "finding multi contig events, " << reads.size() << endl; + //Mopping up less likey multi contig optoins + bool cleanup = true; + if (cleanup == true) { + for (int i = 0; i < reads.size() - 1; i++) { + // chekcing translocation + if (reads[i].alignments.size() == 2) { + if ((reads[i].sigBreakPoint() > 0 || reads[reads[i].alignments[1]].sigBreakPoint() > 0 || + BreakpointInUnalignedCenter(reads[i], reads[reads[i].alignments[1]])) && + reads[i].clipPattern.length() == 2 && reads[reads[i].alignments[1]].clipPattern.length() == 2) { + // cout << "passed First Trans " << endl; // reads[i].write(); - //if (reads[i].chr != reads[reads[i].alignments[1]].chr) //check if read I looks like a trans - { - // cout << "Posible translocation" << endl; + //if (reads[i].chr != reads[reads[i].alignments[1]].chr) //check if read I looks like a trans + { + // cout << "Posible translocation" << endl; // reads[reads[i].alignments[1]].write(); - //cout << "done writing possible trans" << endl; - int start = -2; - while (start + i < 0) - {start ++;} - for (int j = start; j<3 && i+j < reads.size(); j++) - { - // cout << "cheking " << j << " with i = " << i << " and max = " << reads.size() << " " << reads[i+j].name << " " << reads[i+j].alignments.size()<< endl; - if (reads[i+j].name != reads[i].name && reads[i+j].alignments.size()==2 ) - { - - // cout << " " << reads[i+j].name << " != " << reads[i].name << " " << reads[i].clipPattern << " "<< reads[reads[i].alignments[1]].clipPattern<< " && " << reads[i+j].clipPattern << " && " << reads[reads[i+j].alignments[1]].clipPattern << endl; - if (reads[i+j].clipPattern.length()==2 && reads[reads[i+j].alignments[1]].clipPattern.length()==2 && /*what the funk and I checking here I thing im saying for the remote alignment, this reads alignemnt needs to be the next one*/ (reads[i+j].alignments[1]-1 == reads[i].alignments[1] || reads[i+j].alignments[1]+1 == reads[i].alignments[1] || reads[i+j].alignments[1]+2 == reads[i].alignments[1] || reads[i+j].alignments[1]-2 == reads[i].alignments[1])) - { + //cout << "done writing possible trans" << endl; + int start = -2; + while (start + i < 0) { start++; } + for (int j = start; j < 3 && i + j < reads.size(); j++) { + // cout << "cheking " << j << " with i = " << i << " and max = " << reads.size() << " " << reads[i+j].name << " " << reads[i+j].alignments.size()<< endl; + if (reads[i + j].name != reads[i].name && reads[i + j].alignments.size() == 2) { + + // cout << " " << reads[i+j].name << " != " << reads[i].name << " " << reads[i].clipPattern << " "<< reads[reads[i].alignments[1]].clipPattern<< " && " << reads[i+j].clipPattern << " && " << reads[reads[i+j].alignments[1]].clipPattern << endl; + if (reads[i + j].clipPattern.length() == 2 && + reads[reads[i + j].alignments[1]].clipPattern.length() == 2 && + /*what the funk and I checking here I thing im saying for the remote alignment, this reads alignemnt needs to be the next one*/ ( + reads[i + j].alignments[1] - 1 == reads[i].alignments[1] || + reads[i + j].alignments[1] + 1 == reads[i].alignments[1] || + reads[i + j].alignments[1] + 2 == reads[i].alignments[1] || + reads[i + j].alignments[1] - 2 == reads[i].alignments[1])) { // reads[i+j].write(); -// reads[reads[i+j].alignments[1]].write(); - // cout<< "passed alignments check " << reads[i+j].sigBreakPoint() << " " << reads[reads[i+j].alignments[1]].sigBreakPoint() < 0 || reads[reads[i+j].alignments[1]].sigBreakPoint() > 0 || BreakpointInUnalignedCenter(reads[i+j], reads[reads[i+j].alignments[1]] ))) // check if read I+J looks like a trans - { - // cout << "passig sig break point check " << endl; - if ((reads[i+j].chr == reads[i].chr && reads[reads[i+j].alignments[1]].chr == reads[reads[i].alignments[1]].chr) ) // chekc if readsa i and reads i+j show the same trans - { - // cout << "passed chr check" << endl; - - int breaks = 0; - if (reads[i].sigBreakPoint() > 0) - breaks++; - if (reads[reads[i].alignments[1]].sigBreakPoint() > 0) - breaks++; - if ( reads[i+j].sigBreakPoint() > 0) - breaks++; - if (reads[reads[i+j].alignments[1]].sigBreakPoint() > 0) - breaks++; - - int GMap = 0; - int minMapQual = 30; - - if (reads[i].mapQual > minMapQual) - GMap++; - if (reads[reads[i].alignments[1]].mapQual > minMapQual) - GMap++; - if ( reads[i+j].mapQual > minMapQual) - GMap++; - if (reads[reads[i+j].alignments[1]].mapQual > minMapQual) - GMap++; - - if (reads[i].sigBreakPoint() > 0 || reads[i+j].sigBreakPoint() > 0 && breaks >= 3 ) //atleast ons of the reads in this location has to have a sig break point - { - // cout << "passed sig breakcheck" << endl; - // cout << reads[i].chr << " == " << reads[reads[i].alignments[1]].chr << endl; - if (reads[i].chr != reads[reads[i].alignments[1]].chr) - { - //trans chromosomal event - if (reads[i].SVeventid == reads[i+j].SVeventid) - { - if (reads[i].SVeventid ==0) - { - CurrentSVeventID++; - reads[i].BNDid = MaxBND+1; MaxBND++; - reads[i+j].BNDid = MaxBND+1; MaxBND++; - reads[reads[i].alignments[1]].BNDid = MaxBND+1; MaxBND++; - reads[reads[i+j].alignments[1]].BNDid = MaxBND+1; MaxBND++; - } - int targetsize = 0; - int bp = reads[i].BreakPoint(); - int bpj = reads[i+j].BreakPoint(); - int sbp = reads[reads[i].alignments[1]].BreakPoint(); - int sbpj = reads[reads[i+j].alignments[1]].BreakPoint(); - - if (reads[i].clipPattern == "mc") - { - int start = reads[i].pos + bp; - int end = reads[i+j].pos + bpj; - targetsize = start - end; - } - else - { - int end = reads[i].pos + bp; - int start = reads[i+j].pos + bpj; - targetsize = start - end; - } - - // cout << "FOUND TRANSLOCATION" << endl; - // cout << "targetsize = " << targetsize << endl; - stringstream Format; - int InsCorrect = targetsize; - int DelCorrect = targetsize; - if (InsCorrect <0){InsCorrect = 0;} - if (DelCorrect >0){DelCorrect = 0;} - // cout << "Reff.getSubSequence(" << reads[i].chr << " , " < 0 || reads[i+j].mapQual > 0) && (reads[reads[i].alignments[1]].mapQual > 0 || reads[reads[i+j].alignments[1]].mapQual > 0))) - { - Format << "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "" && FullfilterB == "") - { - InfoFilter = "Pass"; - Filter = "PASS"; - Format<<"-DeNovo"; - reads[i].SVeventid = CurrentSVeventID; - reads[i+j].SVeventid = CurrentSVeventID; - reads[reads[i].alignments[1]].SVeventid = CurrentSVeventID; - reads[reads[i+j].alignments[1]].SVeventid = CurrentSVeventID; - } - else - { - InfoFilter = FullfilterA; - InfoFilter +=FullfilterB; - Filter = "fail"; - } - - int readAmut=0; - int readApos=0; - reads[i].GetQualityHashes(readAmut, readApos, bp); - - float qual = -100; - if ((readApos) > 0) - qual = ((float)readAmut) / ((float)readApos) * 100.0; - else - qual = 0; - - - //buildng up info field - stringstream info; - info << "SVTYPE=TRANS;MATEID=TRANS_" << reads[reads[i].alignments[1]].BNDid << ";"; - info << "SVID=" << CurrentSVeventID<< ";"; - if (SVDES !="") - {info << "SVDES=" << SVDES << ";";} - string phase="none"; - if (reads[i].phase != "none") - phase = reads[i].phase; - else if (reads[i+j].phase != "none") - phase = reads[i+j].phase; - info << "PH=" << phase << ";"; - info << "FEX=" << InfoFilter << ";"; - int SupportingHashes = readAmut; - int possibleHashes = readApos; - info << "FS=" << SupportingHashes << "/" < 0) - qual = ((float)readAmut) / ((float)readApos) * 100.0; - else - qual = 0; - - - //buildng up info field - if (GMap < 1|| !( (reads[i].mapQual > 0 || reads[i+j].mapQual > 0) && (reads[reads[i].alignments[1]].mapQual > 0 || reads[reads[i+j].alignments[1]].mapQual > 0))) - { - Format << "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "" && FullfilterB == "") - { - InfoFilter = "Pass"; - Filter = "PASS"; - } - else - { - InfoFilter = FullfilterA; - InfoFilter +=FullfilterB; - Filter = "fail"; - } - info << "SVTYPE=BND;MATEID=TRANS_" << reads[reads[i+j].alignments[1]].BNDid << ";"; - info << "SVID=" << CurrentSVeventID << ";"; - if (SVDES !="") - {info << "SVDES=" << SVDES << ";";} - phase="none"; - if (reads[i+j].phase != "none") - phase = reads[i+j].phase; - else if (reads[i+j].phase != "none") - phase = reads[i+j].phase; - info << "PH=" << phase << ";"; - info << "FEX=" << InfoFilter << ";"; - SupportingHashes = readAmut; - possibleHashes = readApos; - info << "FS=" << SupportingHashes << "/" <= 0) - i = i+j; - continue; - } - } - else //were dealing with an intrachromosomal event, probably a duplication chr6:162,664,265-162,666,099 and - { - // cout << "possible interchomosmal event" << endl; - int EnterA; - int ExitA; - int EnterB; - int ExitB; - int EventPos = -1; - int TargetSize =0; - string insert; - string RefSeq; - string AltSeq; - string insertchr ; - int insertstart ; - int insertend ; - int insertSize; - bool nope = false; - if( reads[i].clipPattern == "mc" && reads[reads[i].alignments[1]].clipPattern == "cm" && reads[i+j].clipPattern == "cm" && reads[reads[i+j].alignments[1]].clipPattern == "mc") - { - // cout << "yaya typeA" << endl; - EnterA = i; - ExitB = reads[i].alignments[1]; - ExitA = i+j; - EnterB = reads[i+j].alignments[1]; - } - else if( reads[i].clipPattern == "cm" && reads[reads[i].alignments[1]].clipPattern == "mc" && reads[i+j].clipPattern == "mc" && reads[reads[i+j].alignments[1]].clipPattern == "cm") - { - // cout << "yay typeB" << endl; - ExitA = i; - EnterB = reads[i].alignments[1]; - EnterA = i+j; - ExitB = reads[i+j].alignments[1]; - } - else - { - // cout << "booo dosnt fit any tyep" << endl; - nope = true; - } - if (nope == false ) - { - if (reads[EnterA].pos + reads[EnterA].BreakPoint() <= reads[ExitA].pos+reads[ExitA].BreakPoint()) - { - EventPos = reads[EnterA].pos+ reads[EnterA].BreakPoint()-1; - TargetSize = (reads[ExitA].pos + reads[ExitA].BreakPoint()) - (reads[EnterA].pos+ reads[EnterA].BreakPoint()); - } - else if (reads[EnterB].pos+ reads[EnterB].BreakPoint() <= reads[ExitB].pos+reads[ExitB].BreakPoint()) - { - EventPos = reads[EnterB].pos+ reads[EnterB].BreakPoint()-1; - TargetSize = (reads[ExitB].pos+reads[ExitB].BreakPoint()) - (reads[EnterB].pos+ reads[EnterB].BreakPoint()); - } - else - {TargetSize = -1;} - if (TargetSize >= 0 && TargetSize < 1000000) - { - RefSeq = Reff.getSubSequence(reads[EnterA].chr, EventPos-1, 1+TargetSize); - AltSeq = Reff.getSubSequence(reads[EnterA].chr, EventPos-1, 1); - - - if (reads[EnterB].pos+reads[EnterB].BreakPoint() > reads[ExitB].pos + reads[ExitB].BreakPoint()) - { - insertchr = reads[EnterB].chr; - insertstart = reads[ExitB].pos + reads[ExitB].BreakPoint(); - insertend = reads[EnterB].pos + reads[EnterB].BreakPoint(); - insertSize = insertend - insertstart; - insert = Reff.getSubSequence(reads[EnterA].chr, insertstart -1 , insertSize ); - } - else if (reads[EnterA].pos+reads[EnterA].BreakPoint() > reads[ExitA].pos + reads[ExitA].BreakPoint()) - { - insertchr = reads[EnterA].chr; - insertstart = reads[ExitA].pos + reads[ExitA].BreakPoint(); - insertend = reads[EnterA].pos + reads[EnterA].BreakPoint(); - insertSize = insertend - insertstart; - insert = Reff.getSubSequence(reads[EnterA].chr, insertstart -1 , insertSize ); - } - else - { - insertSize = -1; - } - AltSeq += insert; - if (insertSize > 0) - { - - - - string FullfilterA = reads[i].filterSV(); - string FullfilterB = reads[i+j].filterSV(); - string InfoFilter = ""; - string Filter = ""; - stringstream Format ; - Format << InterpretTargetSize(TargetSize *-1 ); - Format << insert.size(); - Format << "-"< 0 || reads[i+j].mapQual > 0) && (reads[reads[i].alignments[1]].mapQual > 0 || reads[reads[i+j].alignments[1]].mapQual > 0))) - { - Format << "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "" && FullfilterB == "") - { - InfoFilter = "Pass"; - Filter = "PASS"; - } - else - { - InfoFilter = FullfilterA; - InfoFilter +=FullfilterB; - Filter = "fail"; - } - ///////////////////////////////////do I need to add filter stuff to this one? /////////////////////////////////// - if (reads[i].SVeventid ==0) - { - CurrentSVeventID++; - for(int k = 0; k < reads[i].alignments.size(); k++) - {reads[reads[i].alignments[k]].SVeventid = CurrentSVeventID;} - for(int k = 0; k < reads[i+j].alignments.size(); k++) - {reads[reads[i+j].alignments[k]].SVeventid = CurrentSVeventID;} - - int readAmut=0; - int readApos=0; - int readBmut=0; - int readBpos=0; - reads[i].GetQualityHashes(readAmut, readApos, reads[i].sigBreakPoint()); - reads[i+j].GetQualityHashes(readBmut, readBpos, reads[i+j].sigBreakPoint()); - - float qual = -100; - if ((readApos+readBpos) > 0) - qual = ((float)readAmut+(float)readBmut) / ((float)readApos+(float)readBpos) * 100.0; - else - qual = 0; - stringstream info; - info << "SVTYPE=COPY:PASTE;" << ";"; - info << "SOURCE=" << insertchr <<":" << insertstart <<"-"<= 0) - i = i+j; - continue; - } - } - - } - } - - - } - } - } - - - else if ((reads[i+j].chr == reads[reads[i+j].alignments[1]].chr && reads[reads[i+j].alignments[1]].chr == reads[i].chr)) - { - cout << "odd backwords translocation detection, I should do something about this" << endl; - } - cout << "donewith " << j << " with i = " << i << " and max = " << reads.size() << endl; - } - } - } - // cout << "done checking this loop" << endl; - } - } - } - } - // cout << "frinsihed trans" << endl; - //checking for invertions - if ( reads[i].alignments.size() == 2 && reads[i].SVeventid ==0) - { - if(reads[i].chr == reads[reads[i].alignments[1]].chr && GetReadOrientation(reads[i].flag) != GetReadOrientation(reads[reads[i].alignments[1]].flag) && reads[i].sigBreakPoint() > 0) - { - // cout << "newpossible inversion" << endl; - // reads[i].write(); - // reads[reads[i].alignments[1]].write(); - int start = -2; - while (start + i < 0) - {start ++;} - for ( int j = start ;j<=1 && j+i >= 0 && j+i < reads.size() ; j++) - { - // cout << "checking " << reads[i].name << " - " << " VS " << reads[i+j].name << endl; - if(reads[i].chr == reads[i+j].chr) - { - // cout << "passed chr check" << endl; - if(reads[i+j].alignments.size() > 1 & j != 0 ) - { - // cout << "passed alignents check" << endl; - if(reads[i+j].chr == reads[reads[i+j].alignments[1]].chr - && GetReadOrientation(reads[i+j].flag) != GetReadOrientation(reads[reads[i+j].alignments[1]].flag) - && reads[i+j].sigBreakPoint() > 0 - && (reads[i+j].alignments[1]-1 == reads[i].alignments[1] || reads[i+j].alignments[1]+1 == reads[i].alignments[1])) - { - // cout << "found strong candidate for inversion" << endl; - int positionAa = reads[i].pos + reads[i].sigBreakPoint(); - int positionBa = reads[i+j].pos + reads[i+j].sigBreakPoint(); - int positionAb = reads[reads[i].alignments[1]].pos + reads[reads[i].alignments[1]].sigBreakPoint(); - int positionBb = reads[reads[i+j].alignments[1]].pos + reads[reads[i+j].alignments[1]].sigBreakPoint(); - if (positionAa < positionAb && positionBa < positionBb && reads[i].clipPattern != reads[i+j].clipPattern ) - { - //if (abs(positionAa - positionBa) < HashSize || abs(positionAb - positionBb) < HashSize || abs(positionAa - positionBb) < HashSize || abs(positionAb - positionBa) < HashSize ) - - - //if (abs(positionAa - positionBa) < HashSize || abs(positionAb - positionBb) < HashSize ) - { - CurrentSVeventID++; - // cout << "Found Invertion" << endl; - // reads[i].write(); - // reads[i+j].write(); - int pos = -1; - if(positionAa < positionBa) - pos = positionAa; - else - pos = positionBa; - - int end = 0; - if(positionAb > positionBb) - end = positionAb; - else - end = positionBb; - - int startBreak = 0; - if (reads[i].clipPattern == "mc" && reads[i+j].clipPattern == "cm") - startBreak = positionAa - positionBa; - else if (reads[i].clipPattern == "cm" && reads[i+j].clipPattern == "mc") - startBreak = positionBa - positionAa; - int endBreak = 0; - if (reads[reads[i].alignments[1]].clipPattern == "mc" && reads[reads[i+j].alignments[1]].clipPattern == "cm") - endBreak = positionAb - positionBb; - else if (reads[reads[i].alignments[1]].clipPattern == "cm" && reads[reads[i+j].alignments[1]].clipPattern == "mc") - startBreak = positionBb - positionAb; - - - int size = end-pos; - - stringstream call; - - - - - - stringstream alt; - stringstream ref; - stringstream info; - string GenotypeField; - SamRead temp = reads[reads[i].alignments[1]]; - temp.flipRead(); - string STARTinsertedseq = GetUnalignedCenter(reads[i], temp); - temp = reads[reads[i+j].alignments[1]]; - temp.flipRead(); - string ENDinsertseq = GetUnalignedCenter(reads[i+j], temp); - - ref << Reff.getSubSequence(reads[i].chr, pos -1 -1, 1); - alt << STARTinsertedseq; - alt << ""; - alt << ENDinsertseq; - - int readAmut=0; - int readApos=0; - int readBmut=0; - int readBpos=0; - reads[i].GetQualityHashes(readAmut, readApos, reads[i].sigBreakPoint()); - reads[i+j].GetQualityHashes(readBmut, readBpos, reads[i+j].sigBreakPoint()); - - float qual = -100; - if ((readApos+readBpos) > 0) - qual = ((float)readAmut+(float)readBmut) / ((float)readApos+(float)readBpos) * 100.0; - else - qual = 0; - int SupportingHashes = readAmut+readBmut; - int possibleHashes = readApos+readBpos; - - string phase="none"; - if (reads[i].phase != "none") - phase = reads[i].phase; - else if (reads[i+j].phase != "none") - phase = reads[i+j].phase; - - - string FullfilterA = reads[i].filterSV(); - string FullfilterB = reads[i+j].filterSV(); - - string InfoFilter = ""; - string Filter = ""; - - int GMap = 0; - int minMapQual = 30; - - if (reads[i].mapQual > minMapQual) - GMap++; - if (reads[reads[i].alignments[1]].mapQual > minMapQual) - GMap++; - if ( reads[i+j].mapQual > minMapQual) - GMap++; - if (reads[reads[i+j].alignments[1]].mapQual > minMapQual) - GMap++; - - stringstream Format; - int startoffset = abs(startBreak); - int endoffset = abs(endBreak) ; - if (startBreak>0) - { - Format << abs(startBreak) << "Y"; - } - else if (startBreak<0) - { - Format << abs(startBreak) << "D"; - } - Format << InterpretInsertSize(STARTinsertedseq); - Format << size - startoffset - endoffset << "V"; - if (endBreak>0) - { - Format << abs(endBreak) << "Y"; - } - else if (endBreak<0) - { - Format << abs(endBreak) << "D"; - } - Format << InterpretInsertSize(ENDinsertseq); - - - if (GMap < 1) - { - Format<< "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "" && FullfilterB == "") - { - Format << "-DeNovo"; - InfoFilter = "Pass"; - Filter = "PASS"; - for(int k = 0; k < reads[i].alignments.size(); k++) - {reads[reads[i].alignments[k]].SVeventid = CurrentSVeventID;} - for(int k = 0; k < reads[i+j].alignments.size(); k++) - {reads[reads[i+j].alignments[k]].SVeventid = CurrentSVeventID;} - } - else - { - Format << "-" << FullfilterA << "," << FullfilterB; - InfoFilter = FullfilterA; - InfoFilter +=FullfilterB; - Filter = "fail"; - } - - info << "SVTYPE=INV;END=" << end << ";"; - info << "PH=" << phase << ";"; - info << "FEX=" << InfoFilter << ";"; - info << "FS=" << SupportingHashes << "/" <= 0) - i = i+j; - continue; - } - else - { - cout << "hopefully already got this one" << endl; - } - } - } - } - } - } - } - //checking for large insertions - - //chekcing for shorter tripple aligned insertions or duplications - if ( reads[i].alignments.size() ==3 && reads[i].sigBreakPoint() > 0) - { - // cout << "cheking tripple" << endl; - // reads[i].write(); - // reads[reads[i].alignments[1]].write(); - // reads[reads[i].alignments[2]].write(); - int start = -1; - int mid = -1; - int exit = -1; - //find entering contig - if (reads[i].clipPattern == "mc") - start = i; - else if (reads[reads[i].alignments[1]].clipPattern == "mc") - start = reads[i].alignments[1]; - else if (reads[reads[i].alignments[2]].clipPattern == "mc") - start = reads[i].alignments[2]; - - //find source contig - if (reads[i].clipPattern == "cmc") - mid = i; - else if (reads[reads[i].alignments[1]].clipPattern == "cmc") - mid = reads[i].alignments[1]; - else if (reads[reads[i].alignments[2]].clipPattern == "cmc") - mid = reads[i].alignments[2]; - - //find exit contig - if (reads[i].clipPattern == "cm") - exit = i; - else if (reads[reads[i].alignments[1]].clipPattern == "cm") - exit = reads[i].alignments[1]; - else if (reads[reads[i].alignments[2]].clipPattern == "cm") - exit = reads[i].alignments[2]; - - // cout << "start = " << start << " mid = " << mid << " exit = " << exit<< endl; - - if (start > 1 && mid > 1 && exit > 1) - { - // cout << "yay" << endl; - // cout << reads[start].chr << " and " << reads[exit].chr << endl; - if (reads[start].chr == reads[exit].chr && (reads[exit].sigBreakPoint() > 0 || reads[start].sigBreakPoint() > 0) && ( reads[exit].mapQual > 0 && reads[start].mapQual > 0 )) - { - // cout << "yay2" << endl; - int TargetSize = ((reads[exit].pos+reads[exit].sigBreakPoint()) - (reads[start].pos+reads[start].sigBreakPoint())) * -1; - if (reads[start].SVeventid ==0) - { - // cout << "found tripple" << endl; - int pos = reads[start].pos + reads[start].BreakPoint() -1 ; - // reads[start].write(); - // reads[mid].write(); - // reads[exit].write(); - CurrentSVeventID++; - // cout << "here " << endl; - string GenotypeField; - // cout << "start bkreapoing = " << reads[start].BreakPoint() <<" and exit = " << reads[exit].BreakPoint() << endl; - // cout << "reads start genoptype = " ; - // cout << reads[start].createStructGenotype(reads[start].BreakPoint()) << endl; - // cout << "reads end genotype = " ; - // cout << reads[exit].createStructGenotype(reads[mid].BreakPoint()); - // cout << "boom" << endl; - if (CheckGenotypes(reads[start].createStructGenotype(reads[start].BreakPoint()))) - GenotypeField = reads[start].createStructGenotype(reads[start].BreakPoint()); - else if (CheckGenotypes(reads[exit].createStructGenotype(reads[exit].BreakPoint()))) - GenotypeField = reads[exit].createStructGenotype(reads[exit].BreakPoint()); - else - GenotypeField = reads[exit].createStructGenotype(reads[mid].BreakPoint()); - - // cout << "here 2" << endl; - string Format = InterpretTargetSize(TargetSize); - Format += "trippleDUP"; - // cout << "here 3" << endl; - string ref = Reff.getSubSequence(reads[start].chr, reads[start].pos+reads[start].BreakPoint()-1-1 ,1); - if (TargetSize < 0) - ref = ref + Reff.getSubSequence(reads[start].chr, reads[start].pos+reads[start].BreakPoint()-1 , TargetSize *-1); - - stringstream alt ; - - alt << Reff.getSubSequence(reads[start].chr, reads[start].pos+reads[start].BreakPoint() -1 -1 ,1); - if (TargetSize > 0) - alt << Reff.getSubSequence(reads[start].chr, reads[start].pos+reads[start].BreakPoint()-1 , TargetSize ); - alt << reads[mid].seq.substr(reads[start].BreakPoint(), reads[exit].BreakPoint() - reads[start].BreakPoint() ) ; - //alt << reads[mid].seq.substr(reads[start].BreakPoint(), reads[mid].CountBasesAligned(reads[mid].BreakPoint())+1 +reads[mid].BreakPoint()- reads[start].BreakPoint() ) ; - //alt << Reff.getSubSequence(reads[mid].chr, reads[mid].pos+reads[mid].BreakPoint(), reads[mid].CountBasesAligned(reads[mid].BreakPoint())+1) ; - // cout << "here 3" << endl; - string FullfilterA = reads[start].filterSV(); - string FullfilterB = reads[mid].filterSV(); - string FullfilterC = reads[exit].filterSV(); - // cout << "here 4" << endl; - int GMap = 0; - int minMapQual = 30; - if (reads[start].mapQual > minMapQual) - GMap++; - if (reads[mid].mapQual > minMapQual) - GMap++; - if (reads[exit].mapQual > minMapQual) - GMap++; - // cout << "here 5"<< endl; - string InfoFilter = ""; - string Filter = ""; - - if (GMap < 1) - { - Format+= "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "" && FullfilterB == "" && FullfilterC == "") - { - Format+="-DeNovo"; - InfoFilter = "Pass"; - Filter = "PASS"; - reads[start].SVeventid = CurrentSVeventID; - reads[mid].SVeventid = CurrentSVeventID; - reads[exit].SVeventid = CurrentSVeventID; - } - else - { - Format+="-"; - Format+= FullfilterA; - Format+= "," ; - Format+= FullfilterB; - InfoFilter = FullfilterA; - InfoFilter +=FullfilterB; - Filter = "fail"; - } - // cout << "here 6" << endl; - //make quality stuff - int readAmut=0; - int readApos=0; - int readBmut=0; - int readBpos=0; - reads[start].GetQualityHashes(readAmut, readApos, reads[start].BreakPoint()); - reads[exit].GetQualityHashes(readBmut, readBpos, reads[exit].BreakPoint()); - - float qual = -100; - if ((readApos+readBpos) > 0) - qual = ((float)readAmut+(float)readBmut) / ((float)readApos+(float)readBpos) * 100.0; - else - qual = 0; - - // cout << "here 7" << endl; - //buildng up info field - stringstream info; - info << "SVTYPE=INS;END=" << reads[start].pos+reads[start].BreakPoint() -1 << ";"; - info << "SOURCE=" << reads[mid].chr <<":" << reads[mid].pos + reads[mid].BreakPoint() <<"-"<< reads[mid].pos + reads[mid].BreakPoint() + reads[mid].CountBasesAligned(reads[mid].BreakPoint())<< ";"; - string phase="none"; - if (reads[start].phase != "none") - phase = reads[start].phase; - else if (reads[exit].phase != "none") - phase = reads[exit].phase; - else if (reads[mid].phase != "none") - phase = reads[mid].phase; - info << "PH=" << phase << ";"; - info << "FEX=" << InfoFilter << ";"; - int SupportingHashes = readAmut+readBmut; - int possibleHashes = readApos+readBpos; - info << "FS=" << SupportingHashes << "/" <=1 && reads[i].clipPattern == "mc" && reads[i].sigBreakPoint() > 0 && reads[i].SVeventid == 0 ) - { - // cout << "possible large insertion" << endl; - // reads[i].write(); - int start = -5; - while (start + i < 0) - {start ++;} - for ( int j = start; j <= 5 && j+i >= 0 && j+i < reads.size() ; j++) - { - // cout << "I = " << i << "and J = " << j << endl; - // cout << reads[i+j].name << " sig break point = " << reads[i+j].sigBreakPoint() << endl; - if (reads[i+j].alignments.size() == 1 && reads[i+j].clipPattern == "cm" && reads[i+j].sigBreakPoint() > 0 && reads[i].chr == reads[i+j].chr && reads[i+j].SVeventid == 0) - { - // cout << "even more possible large insert" << endl; - int sbI = reads[i].sigBreakPoint(); - int sbJ = reads[i+j].sigBreakPoint(); - int positionI = reads[i].pos + sbI; - int positionJ = reads[i+j].pos + sbJ; - - //if (abs(positionAa - positionBa) < HashSize || abs(positionAb - positionBb) < HashSize || abs(positionAa - positionBb) < HashSize || abs(positionAb - positionBa) < HashSize ) - - - if (abs(positionI - positionJ) < 1000000 && reads[i].SVeventid ==0 && reads[i+j].SVeventid == 0 && (reads[i].mapQual > 0 && reads[i+j].mapQual > 0)) - { - // cout << "Found Large Insert" << endl; - // reads[i].write(); - // reads[i+j].write(); - int pos = -1; - if(positionI < positionJ) - pos = positionI; - else - pos = positionJ; - - // cout << "pos = " << pos << endl; - int end = 0; - if(positionI > positionJ) - end = positionI; - else - end = positionJ; - // cout << "end = " << end << endl; - - - int startBreak = positionI - positionJ ; - - stringstream call; - - // cout << "here 1" << endl; - stringstream Format; - if (startBreak>0) - { - Format << abs(startBreak) << "Y"; - } - else if (startBreak<0) - { - Format << abs(startBreak) << "D"; - } - // cout << "here 2 " << endl; - stringstream alt; - stringstream ref; - stringstream info; - string GenotypeField; - //ref << Reff.getSubSequence(reads[i].chr, pos -1 -1, 1); - alt << ""; - if (startBreak>0){ - ref << Reff.getSubSequence(reads[i].chr, pos -1 -1 , 1); - alt << Reff.getSubSequence(reads[i].chr, pos -1 -1 , 1+abs(startBreak)); - } - else if (startBreak<0){ - ref << Reff.getSubSequence(reads[i].chr, pos -1 -1 , 1+abs(startBreak)); - alt << Reff.getSubSequence(reads[i].chr, pos -1 -1 , 1); - } - // cout << "here 3" << endl; - //ref << "-" << Reff.getSubSequence(reads[i].chr, pos -1 -1 + abs(startBreak)+1, size - abs(startBreak) - abs(endBreak) ); - // cout <<" posI = " << sbI << " and pos j = " << sbJ << endl; - string leftseq = reads[i].getClippedSequence(sbI, "mc"); - // cout << "here 3.11" << endl; - string rightseq = reads[i+j].getClippedSequence(sbJ, "cm"); - // cout << "here 3.12" << endl; - alt << "-" << reads[i].getClippedSequence(sbI, "mc") << "NNNNNNNNNNNNNNNNNNNN" << reads[i+j].getClippedSequence(sbJ, "cm"); - // cout << "here 3.1" << endl; - Format << alt.str().length()<<"+" << "LargeInsert"; - // cout << "here 3.2" << endl; - int readAmut=0; - int readApos=0; - int readBmut=0; - int readBpos=0; - reads[i].GetQualityHashes(readAmut, readApos, reads[i].sigBreakPoint()); - // cout << "here 3.3" << endl; - reads[i+j].GetQualityHashes(readBmut, readBpos, reads[i+j].sigBreakPoint()); - // cout << "here 4" << endl; - float qual = -100; - if ((readApos+readBpos) > 0) - qual = ((float)readAmut+(float)readBmut) / ((float)readApos+(float)readBpos) * 100.0; - else - qual = 0; - int SupportingHashes = readAmut+readBmut; - int possibleHashes = readApos+readBpos; - - string phase="none"; - if (reads[i].phase != "none") - phase = reads[i].phase; - else if (reads[i+j].phase != "none") - phase = reads[i+j].phase; - // cout << "here 5" << endl; - CurrentSVeventID++; - for(int k = 0; k < reads[i].alignments.size(); k++) - {reads[reads[i].alignments[k]].SVeventid = CurrentSVeventID;} - for(int k = 0; k < reads[i+j].alignments.size(); k++) - {reads[reads[i+j].alignments[k]].SVeventid = CurrentSVeventID;} - string FullfilterA = reads[i].filterSV(); - string FullfilterB = reads[i+j].filterSV(); - - string InfoFilter = ""; - string Filter = ""; - - int GMap = 0; - int minMapQual = 30; - // cout << "here 6" << endl; - if (reads[i].mapQual > minMapQual) - GMap++; - if ( reads[i+j].mapQual > minMapQual) - GMap++; - if (GMap < 1) - { - Format<< "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "" && FullfilterB == "") - { - Format << "-DeNovo"; - InfoFilter = "Pass"; - Filter = "PASS"; - } - else - { - Format << "-" << FullfilterA << "," << FullfilterB; - InfoFilter = FullfilterA; - InfoFilter +=FullfilterB; - Filter = "fail"; - } - - info << "SVTYPE=INS;END=" << end << ";"; - info << "PH=" << phase << ";"; - - info << "FEX=" << InfoFilter << ";"; - info << "FS=" << SupportingHashes << "/" < 0 && reads[i].SVeventid ==0) - { - bool found = false; - // cout << "Posible mobil single read element" << endl; - // reads[i].write(); - // for (int j = 1; j < reads[i].alignments.size(); j ++) - // { - // reads[reads[i].alignments[j]].write(); - // } - // mobs[reads[i].name].write(); - // do I have a breakpoint supporoted by hashes - int bp = reads[i].sigBreakPoint(); - // cout << "sig break point is " << bp << endl; - if (bp > 0) - { - // cout << "Passed SigBreakpoint check " << endl; - - //if (checkMobSupAalign(i, reads)) - { - int maxSupAlign = 0; - for( int j = 1; j maxSupAlign) - maxSupAlign = reads[reads[i].alignments[j]].mapQual; - } - if (reads[i].mapQual >= maxSupAlign) - { - // cout << "passed masSUpAlign" << endl; - vector temp; - for( int j = 1; j 30) - temp.push_back(reads[reads[i].alignments[j]]); - } - // cout << "built thing" << endl; - int polyAbp = reads[i].isPolyA(temp); - // cout << "first mobalign" << endl; - int myMobBase = MobAligneBases(mobs[reads[i].name], reads[i]); - // cout << "done with first mobalign " << endl; - vector secondMobBase; - int maxSecondMob = 0; - for( int j = 1; j maxSecondMob) - {maxSecondMob = secondMobBase[j-1];} - } - // cout << "checking Distnace" << endl; - // cout << "size = " << reads[i].alignments.size()<< endl; ; - bool checkDistance = true; - for( int j = 1; j -1) - Format << "-PolyA" << polyAbp; - if (myMobBase > 10) - { - Format << "-MOB" << myMobBase; - for( int j = 0; j"; - - string FullfilterA = reads[i].filterSV(); - int GMap = 0; - int minMapQual = 30; - if (reads[i].mapQual > minMapQual) - GMap++; - - - string InfoFilter = ""; - string Filter = ""; - if (reads[i].SVCheckParentsForLowCov(reads[i].sigBreakPoint()) >= 1) - { - Format << "-Inherited"; - InfoFilter = "Inherited"; - Filter = "LCH"; - } - else if (GMap < 1) - { - Format << "-LowMapQual"; - InfoFilter = "LowMapQual"; - Filter = "LMQ"; - } - else if (FullfilterA == "" ) - { - found = true; - Format<<"-DeNovo"; - InfoFilter = "Pass"; - Filter = "PASS"; - } - else - { - Format<<"-"< 0) - qual = ((float)readAmut) / ((float)readApos) * 100.0; - else - qual = 0; - - - //buildng up info field - stringstream info; - info << "SVTYPE=INS;END=" << reads[i].pos+bp -1 << ";"; - info << "MT=" << reads[i].MobContig << ";"; - string phase="none"; - if (reads[i].phase != "none") - phase = reads[i].phase; - info << "PH=" << phase << ";"; - info << "FEX=" << InfoFilter << ";"; - int SupportingHashes = readAmut; - int possibleHashes = readApos; - info << "FS=" << SupportingHashes << "/" < 0 && reads[i].SVeventid ==0 && reads[i].alignments.size()>1) - { - bool found = false; - // cout << "Last Ditch effort, lests give this something " << endl; - // reads[i].write(); - // for (int j = 1; j < reads[i].alignments.size(); j ++) - // { - // reads[reads[i].alignments[j]].write(); - // } - int A= -1; - int B= -1; - vector temp; - for( int j = 0; j= 0 && B >= 0 ) - { - LastDitch( reads, i, A, B, CurrentSVeventID); - if (A !=B && (reads[reads[i].alignments[A]].sigBreakPoint() > 0 || reads[reads[i].alignments[B]].sigBreakPoint() > 0 || BreakpointInUnalignedCenter(reads[reads[i].alignments[A]], reads[reads[i].alignments[B]]) )) - LastDitch( reads, i, B, A, CurrentSVeventID); - - } - } - } - } +// reads[reads[i+j].alignments[1]].write(); + // cout<< "passed alignments check " << reads[i+j].sigBreakPoint() << " " << reads[reads[i+j].alignments[1]].sigBreakPoint() < 0 || + reads[reads[i + j].alignments[1]].sigBreakPoint() > 0 || + BreakpointInUnalignedCenter(reads[i + j], reads[reads[i + + j].alignments[1]]))) // check if read I+J looks like a trans + { + // cout << "passig sig break point check " << endl; + if ((reads[i + j].chr == reads[i].chr && + reads[reads[i + j].alignments[1]].chr == + reads[reads[i].alignments[1]].chr)) // chekc if readsa i and reads i+j show the same trans + { + // cout << "passed chr check" << endl; + + int breaks = 0; + if (reads[i].sigBreakPoint() > 0) + breaks++; + if (reads[reads[i].alignments[1]].sigBreakPoint() > 0) + breaks++; + if (reads[i + j].sigBreakPoint() > 0) + breaks++; + if (reads[reads[i + j].alignments[1]].sigBreakPoint() > 0) + breaks++; + + int GMap = 0; + int minMapQual = 30; + + if (reads[i].mapQual > minMapQual) + GMap++; + if (reads[reads[i].alignments[1]].mapQual > minMapQual) + GMap++; + if (reads[i + j].mapQual > minMapQual) + GMap++; + if (reads[reads[i + j].alignments[1]].mapQual > minMapQual) + GMap++; + + if (reads[i].sigBreakPoint() > 0 || reads[i + j].sigBreakPoint() > 0 && + breaks >= + 3) //atleast ons of the reads in this location has to have a sig break point + { + // cout << "passed sig breakcheck" << endl; + // cout << reads[i].chr << " == " << reads[reads[i].alignments[1]].chr << endl; + if (reads[i].chr != reads[reads[i].alignments[1]].chr) { + //trans chromosomal event + if (reads[i].SVeventid == reads[i + j].SVeventid) { + if (reads[i].SVeventid == 0) { + CurrentSVeventID++; + reads[i].BNDid = MaxBND + 1; + MaxBND++; + reads[i + j].BNDid = MaxBND + 1; + MaxBND++; + reads[reads[i].alignments[1]].BNDid = MaxBND + 1; + MaxBND++; + reads[reads[i + j].alignments[1]].BNDid = MaxBND + 1; + MaxBND++; + } + int targetsize = 0; + int bp = reads[i].BreakPoint(); + int bpj = reads[i + j].BreakPoint(); + int sbp = reads[reads[i].alignments[1]].BreakPoint(); + int sbpj = reads[reads[i + j].alignments[1]].BreakPoint(); + + if (reads[i].clipPattern == "mc") { + int start = reads[i].pos + bp; + int end = reads[i + j].pos + bpj; + targetsize = start - end; + } else { + int end = reads[i].pos + bp; + int start = reads[i + j].pos + bpj; + targetsize = start - end; + } + + // cout << "FOUND TRANSLOCATION" << endl; + // cout << "targetsize = " << targetsize << endl; + stringstream Format; + int InsCorrect = targetsize; + int DelCorrect = targetsize; + if (InsCorrect < 0) { InsCorrect = 0; } + if (DelCorrect > 0) { DelCorrect = 0; } + // cout << "Reff.getSubSequence(" << reads[i].chr << " , " < 0 || reads[i + j].mapQual > 0) && + (reads[reads[i].alignments[1]].mapQual > 0 || + reads[reads[i + j].alignments[1]].mapQual > 0))) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "" && FullfilterB == "") { + InfoFilter = "Pass"; + Filter = "PASS"; + Format << "-DeNovo"; + reads[i].SVeventid = CurrentSVeventID; + reads[i + j].SVeventid = CurrentSVeventID; + reads[reads[i].alignments[1]].SVeventid = CurrentSVeventID; + reads[reads[i + + j].alignments[1]].SVeventid = CurrentSVeventID; + } else { + InfoFilter = FullfilterA; + InfoFilter += FullfilterB; + Filter = "fail"; + } + + int readAmut = 0; + int readApos = 0; + reads[i].GetQualityHashes(readAmut, readApos, bp); + + float qual = -100; + if ((readApos) > 0) + qual = ((float) readAmut) / ((float) readApos) * 100.0; + else + qual = 0; + + + //buildng up info field + stringstream info; + info << "SVTYPE=TRANS;MATEID=TRANS_" + << reads[reads[i].alignments[1]].BNDid << ";"; + info << "SVID=" << CurrentSVeventID << ";"; + if (SVDES != "") { info << "SVDES=" << SVDES << ";"; } + string phase = "none"; + if (reads[i].phase != "none") + phase = reads[i].phase; + else if (reads[i + j].phase != "none") + phase = reads[i + j].phase; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + int SupportingHashes = readAmut; + int possibleHashes = readApos; + info << "FS=" << SupportingHashes << "/" << possibleHashes + << ";"; + + info << "RN=" << reads[i].name << ";"; + info << "MQ=" << reads[i].mapQual << ";"; + info << "cigar=" << reads[i].cigar << ";"; + info << "SB=" << reads[i].StrandBias << ";"; + info << "AS=" << reads[i].AlignmentSegments << "-" + << reads[i].AlignmentSegmentsCigar; + + + string GenotypeFieldA = reads[i].createStructGenotype(bp); + stringstream call; + call << reads[i].chr << "\t" << reads[i].pos + offset << "\t" + << Format.str() << "\t" << ref << "\t" << alt.str() << "\t" + << qual << "\t" << Filter << "\t" << info.str() << "\t" + << "GT:DP:RO:AO\t" << GenotypeFieldA << endl; + // cout << call.str(); + VCFOutFile << call.str(); + + + //////////////////////////OTHER STRAND////////////////////////////////////////////////////////////////////////////////////////////// + Format.str(std::string()); + info.str(std::string()); + stringstream altj; + SVDES = ""; + ref = ""; + altseq = ""; + offset = 0; + if (reads[i + j].clipPattern == "mc") { + offset = bpj - 1 - InsCorrect; + ref = Reff.getSubSequence(reads[i + j].chr, + reads[i + j].pos + bpj - 1 - 1 - + InsCorrect, 1 + abs(DelCorrect)); + altseq = Reff.getSubSequence(reads[i + j].chr, + reads[i + j].pos + bpj - 1 - + 1 - InsCorrect, + 1 + InsCorrect); + if (reads[i + j].clipPattern == "mc" && + GetReadOrientation(reads[i + j].flag) == + GetReadOrientation( + reads[reads[i + j].alignments[1]].flag)) { + altj << altseq << "[" + << reads[reads[i + j].alignments[1]].chr << ":" + << reads[reads[i + j].alignments[1]].pos + sbpj + << "["; + Format << "TRANS_" << reads[i + j].BNDid; + SVDES = "Translocation"; + } else if (reads[i + j].clipPattern == "mc" && + GetReadOrientation(reads[i + j].flag) != + GetReadOrientation(reads[reads[i + + j].alignments[1]].flag)) { + altj << altseq << "]" + << reads[reads[i + j].alignments[1]].chr << ":" + << reads[reads[i + j].alignments[1]].pos + sbpj + << "]"; + Format << "InvTRANS_" << reads[i + j].BNDid; + SVDES = "InvertedTranslocation"; + } + } else if (reads[i + j].clipPattern == "cm") { + offset = bpj; + ref = Reff.getSubSequence(reads[i + j].chr, + reads[i + j].pos + bpj - 1, 1); + altseq = Reff.getSubSequence(reads[i + j].chr, + reads[i + j].pos + bpj - 1, 1); + if (reads[i + j].clipPattern == "cm" && + GetReadOrientation(reads[i + j].flag) == + GetReadOrientation( + reads[reads[i + j].alignments[1]].flag)) { + altj << "]" << reads[reads[i + j].alignments[1]].chr + << ":" + << reads[reads[i + j].alignments[1]].pos + sbpj + << "]" << altseq; + Format << "TRANS_" << reads[i + j].BNDid; + SVDES = "Translocation"; + } else if (reads[i + j].clipPattern == "cm" && + GetReadOrientation(reads[i + j].flag) != + GetReadOrientation(reads[reads[i + + j].alignments[1]].flag)) { + altj << "[" << reads[reads[i + j].alignments[1]].chr + << ":" + << reads[reads[i + j].alignments[1]].pos + sbpj + << "[" << altseq; + Format << "InvTRANS_" << reads[i + j].BNDid; + SVDES = "InvertedTranslocation"; + } + } + + readAmut = 0; + readApos = 0; + reads[i + j].GetQualityHashes(readAmut, readApos, bpj); + + qual = -100; + if ((readApos) > 0) + qual = ((float) readAmut) / ((float) readApos) * 100.0; + else + qual = 0; + + + //buildng up info field + if (GMap < 1 || + !((reads[i].mapQual > 0 || reads[i + j].mapQual > 0) && + (reads[reads[i].alignments[1]].mapQual > 0 || + reads[reads[i + j].alignments[1]].mapQual > 0))) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "" && FullfilterB == "") { + InfoFilter = "Pass"; + Filter = "PASS"; + } else { + InfoFilter = FullfilterA; + InfoFilter += FullfilterB; + Filter = "fail"; + } + info << "SVTYPE=BND;MATEID=TRANS_" + << reads[reads[i + j].alignments[1]].BNDid << ";"; + info << "SVID=" << CurrentSVeventID << ";"; + if (SVDES != "") { info << "SVDES=" << SVDES << ";"; } + phase = "none"; + if (reads[i + j].phase != "none") + phase = reads[i + j].phase; + else if (reads[i + j].phase != "none") + phase = reads[i + j].phase; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + SupportingHashes = readAmut; + possibleHashes = readApos; + info << "FS=" << SupportingHashes << "/" << possibleHashes + << ";"; + + info << "RN=" << reads[i + j].name << ";"; + info << "MQ=" << reads[i + j].mapQual << ";"; + info << "cigar=" << reads[i + j].cigar << ";"; + info << "SB=" << reads[i + j].StrandBias << ";"; + info << "AS=" << reads[i + j].AlignmentSegments << "-" + << reads[i + j].AlignmentSegmentsCigar; + + + string GenotypeFieldB = reads[i + j].createStructGenotype(bpj); + + call.str(std::string()); + call << reads[i + j].chr << "\t" << reads[i + j].pos + offset + << "\t" << Format.str() << "\t" << ref << "\t" + << altj.str() << "\t" << qual << "\t" << Filter << "\t" + << info.str() << "\t" << "GT:DP:RO:AO\t" << GenotypeFieldB + << endl; + // cout << call.str(); + VCFOutFile << call.str(); + + //cout << reads[i].chr << " " << reads[i].pos + readAsig << " to " << reads[reads[i].alignments[1]].chr << " " << reads[reads[i].alignments[1]].sigBreakPoint()+ reads[reads[i].alignments[1]].pos << "\tGenoA " << GenotypeFieldA << "\tGenoB " << GenotypeFieldB << endl; + if (j >= 0) + i = i + j; + continue; + } + } else //were dealing with an intrachromosomal event, probably a duplication chr6:162,664,265-162,666,099 and + { + // cout << "possible interchomosmal event" << endl; + int EnterA; + int ExitA; + int EnterB; + int ExitB; + int EventPos = -1; + int TargetSize = 0; + string insert; + string RefSeq; + string AltSeq; + string insertchr; + int insertstart; + int insertend; + int insertSize; + bool nope = false; + if (reads[i].clipPattern == "mc" && + reads[reads[i].alignments[1]].clipPattern == "cm" && + reads[i + j].clipPattern == "cm" && + reads[reads[i + j].alignments[1]].clipPattern == "mc") { + // cout << "yaya typeA" << endl; + EnterA = i; + ExitB = reads[i].alignments[1]; + ExitA = i + j; + EnterB = reads[i + j].alignments[1]; + } else if (reads[i].clipPattern == "cm" && + reads[reads[i].alignments[1]].clipPattern == "mc" && + reads[i + j].clipPattern == "mc" && + reads[reads[i + j].alignments[1]].clipPattern == "cm") { + // cout << "yay typeB" << endl; + ExitA = i; + EnterB = reads[i].alignments[1]; + EnterA = i + j; + ExitB = reads[i + j].alignments[1]; + } else { + // cout << "booo dosnt fit any tyep" << endl; + nope = true; + } + if (nope == false) { + if (reads[EnterA].pos + reads[EnterA].BreakPoint() <= + reads[ExitA].pos + reads[ExitA].BreakPoint()) { + EventPos = + reads[EnterA].pos + reads[EnterA].BreakPoint() - 1; + TargetSize = + (reads[ExitA].pos + reads[ExitA].BreakPoint()) - + (reads[EnterA].pos + reads[EnterA].BreakPoint()); + } else if (reads[EnterB].pos + reads[EnterB].BreakPoint() <= + reads[ExitB].pos + reads[ExitB].BreakPoint()) { + EventPos = + reads[EnterB].pos + reads[EnterB].BreakPoint() - 1; + TargetSize = + (reads[ExitB].pos + reads[ExitB].BreakPoint()) - + (reads[EnterB].pos + reads[EnterB].BreakPoint()); + } else { TargetSize = -1; } + if (TargetSize >= 0 && TargetSize < 1000000) { + RefSeq = Reff.getSubSequence(reads[EnterA].chr, + EventPos - 1, 1 + TargetSize); + AltSeq = Reff.getSubSequence(reads[EnterA].chr, + EventPos - 1, 1); + + + if (reads[EnterB].pos + reads[EnterB].BreakPoint() > + reads[ExitB].pos + reads[ExitB].BreakPoint()) { + insertchr = reads[EnterB].chr; + insertstart = + reads[ExitB].pos + reads[ExitB].BreakPoint(); + insertend = + reads[EnterB].pos + reads[EnterB].BreakPoint(); + insertSize = insertend - insertstart; + insert = Reff.getSubSequence(reads[EnterA].chr, + insertstart - 1, + insertSize); + } else if (reads[EnterA].pos + reads[EnterA].BreakPoint() > + reads[ExitA].pos + reads[ExitA].BreakPoint()) { + insertchr = reads[EnterA].chr; + insertstart = + reads[ExitA].pos + reads[ExitA].BreakPoint(); + insertend = + reads[EnterA].pos + reads[EnterA].BreakPoint(); + insertSize = insertend - insertstart; + insert = Reff.getSubSequence(reads[EnterA].chr, + insertstart - 1, + insertSize); + } else { + insertSize = -1; + } + AltSeq += insert; + if (insertSize > 0) { + + + string FullfilterA = reads[i].filterSV(); + string FullfilterB = reads[i + j].filterSV(); + string InfoFilter = ""; + string Filter = ""; + stringstream Format; + Format << InterpretTargetSize(TargetSize * -1); + Format << insert.size(); + Format << "-" << insertSize; + Format << "CopyPaste"; + int minMapQual = 30; + + + if (GMap < 1 || !((reads[i].mapQual > 0 || + reads[i + j].mapQual > 0) && + (reads[reads[i].alignments[1]].mapQual > + 0 || reads[reads[i + + j].alignments[1]].mapQual > + 0))) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "" && FullfilterB == "") { + InfoFilter = "Pass"; + Filter = "PASS"; + } else { + InfoFilter = FullfilterA; + InfoFilter += FullfilterB; + Filter = "fail"; + } + ///////////////////////////////////do I need to add filter stuff to this one? /////////////////////////////////// + if (reads[i].SVeventid == 0) { + CurrentSVeventID++; + for (int k = 0; k < + reads[i].alignments.size(); k++) { reads[reads[i].alignments[k]].SVeventid = CurrentSVeventID; } + for (int k = 0; k < reads[i + + j].alignments.size(); k++) { + reads[reads[i + + j].alignments[k]].SVeventid = CurrentSVeventID; + } + + int readAmut = 0; + int readApos = 0; + int readBmut = 0; + int readBpos = 0; + reads[i].GetQualityHashes(readAmut, readApos, + reads[i].sigBreakPoint()); + reads[i + j].GetQualityHashes(readBmut, readBpos, + reads[i + + j].sigBreakPoint()); + + float qual = -100; + if ((readApos + readBpos) > 0) + qual = ((float) readAmut + (float) readBmut) / + ((float) readApos + (float) readBpos) * + 100.0; + else + qual = 0; + stringstream info; + info << "SVTYPE=COPY:PASTE;" << ";"; + info << "SOURCE=" << insertchr << ":" << insertstart + << "-" << insertend << ";"; + info << "SVID=" << reads[i + j].SVeventid << ";"; + string phase = "none"; + if (reads[i + j].phase != "none") + phase = reads[i + j].phase; + else if (reads[i + j].phase != "none") + phase = reads[i + j].phase; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + int SupportingHashes = readAmut + readBmut; + int possibleHashes = readApos + readBpos; + info << "FS=" << SupportingHashes << "/" + << possibleHashes << ";"; + + info << "RN=" << reads[i].name << "_and_" + << reads[i + j].name << ";"; + info << "MQ=" << reads[i].mapQual << "_and_" + << reads[i + j].mapQual << ";"; + info << "cigar=" << reads[i].cigar << "_and_" + << reads[i + j].cigar << ";"; + info << "SB=" << reads[i].StrandBias << "_and_" + << reads[i + j].StrandBias << ";"; + info << "AS=" << reads[i].AlignmentSegments << "-" + << reads[i].AlignmentSegmentsCigar << "_and_" + << reads[i + j].AlignmentSegments << "-" + << reads[i + j].AlignmentSegmentsCigar; + + string GenotypeField; + if (CheckGenotypes(reads[i].createStructGenotype( + reads[i].sigBreakPoint()))) + GenotypeField = reads[i].createStructGenotype( + reads[i].sigBreakPoint()); + else if (CheckGenotypes( + reads[i + j].createStructGenotype( + reads[i + j].sigBreakPoint()))) + GenotypeField = reads[i + + j].createStructGenotype( + reads[i + j].sigBreakPoint()); + else if (CheckGenotypes( + reads[reads[i].alignments[1]].createStructGenotype( + reads[reads[i].alignments[1]].sigBreakPoint()))) + GenotypeField = reads[reads[i].alignments[1]].createStructGenotype( + reads[reads[i].alignments[1]].sigBreakPoint()); + else + GenotypeField = reads[reads[i + + j].alignments[1]].createStructGenotype( + reads[reads[i + + j].alignments[1]].sigBreakPoint()); + stringstream call; + call << reads[i].chr << "\t" << EventPos << "\t" + << Format.str() << "\t" << RefSeq << "\t" + << AltSeq << "\t" << qual << "\t" << Filter + << "\t" << info.str() << "\t" + << "GT:DP:RO:AO\t" << GenotypeField << endl; + // cout << call.str(); + VCFOutFile << call.str(); + if (j >= 0) + i = i + j; + continue; + } + } + + } + } + + + } + } + } else if ((reads[i + j].chr == reads[reads[i + j].alignments[1]].chr && + reads[reads[i + j].alignments[1]].chr == reads[i].chr)) { + cout + << "odd backwords translocation detection, I should do something about this" + << endl; + } + cout << "donewith " << j << " with i = " << i << " and max = " << reads.size() + << endl; + } + } + } + // cout << "done checking this loop" << endl; + } + } + } + } + // cout << "frinsihed trans" << endl; + //checking for invertions + if (reads[i].alignments.size() == 2 && reads[i].SVeventid == 0) { + if (reads[i].chr == reads[reads[i].alignments[1]].chr && + GetReadOrientation(reads[i].flag) != GetReadOrientation(reads[reads[i].alignments[1]].flag) && + reads[i].sigBreakPoint() > 0) { + // cout << "newpossible inversion" << endl; + // reads[i].write(); + // reads[reads[i].alignments[1]].write(); + int start = -2; + while (start + i < 0) { start++; } + for (int j = start; j <= 1 && j + i >= 0 && j + i < reads.size(); j++) { + // cout << "checking " << reads[i].name << " - " << " VS " << reads[i+j].name << endl; + if (reads[i].chr == reads[i + j].chr) { + // cout << "passed chr check" << endl; + if (reads[i + j].alignments.size() > 1 & j != 0) { + // cout << "passed alignents check" << endl; + if (reads[i + j].chr == reads[reads[i + j].alignments[1]].chr + && GetReadOrientation(reads[i + j].flag) != + GetReadOrientation(reads[reads[i + j].alignments[1]].flag) + && reads[i + j].sigBreakPoint() > 0 + && (reads[i + j].alignments[1] - 1 == reads[i].alignments[1] || + reads[i + j].alignments[1] + 1 == reads[i].alignments[1])) { + // cout << "found strong candidate for inversion" << endl; + int positionAa = reads[i].pos + reads[i].sigBreakPoint(); + int positionBa = reads[i + j].pos + reads[i + j].sigBreakPoint(); + int positionAb = reads[reads[i].alignments[1]].pos + + reads[reads[i].alignments[1]].sigBreakPoint(); + int positionBb = reads[reads[i + j].alignments[1]].pos + + reads[reads[i + j].alignments[1]].sigBreakPoint(); + if (positionAa < positionAb && positionBa < positionBb && + reads[i].clipPattern != reads[i + j].clipPattern) { + //if (abs(positionAa - positionBa) < HashSize || abs(positionAb - positionBb) < HashSize || abs(positionAa - positionBb) < HashSize || abs(positionAb - positionBa) < HashSize ) + + + //if (abs(positionAa - positionBa) < HashSize || abs(positionAb - positionBb) < HashSize ) + { + CurrentSVeventID++; + // cout << "Found Invertion" << endl; + // reads[i].write(); + // reads[i+j].write(); + int pos = -1; + if (positionAa < positionBa) + pos = positionAa; + else + pos = positionBa; + + int end = 0; + if (positionAb > positionBb) + end = positionAb; + else + end = positionBb; + + int startBreak = 0; + if (reads[i].clipPattern == "mc" && reads[i + j].clipPattern == "cm") + startBreak = positionAa - positionBa; + else if (reads[i].clipPattern == "cm" && reads[i + j].clipPattern == "mc") + startBreak = positionBa - positionAa; + int endBreak = 0; + if (reads[reads[i].alignments[1]].clipPattern == "mc" && + reads[reads[i + j].alignments[1]].clipPattern == "cm") + endBreak = positionAb - positionBb; + else if (reads[reads[i].alignments[1]].clipPattern == "cm" && + reads[reads[i + j].alignments[1]].clipPattern == "mc") + startBreak = positionBb - positionAb; + + + int size = end - pos; + + stringstream call; + + + stringstream alt; + stringstream ref; + stringstream info; + string GenotypeField; + SamRead temp = reads[reads[i].alignments[1]]; + temp.flipRead(); + string STARTinsertedseq = GetUnalignedCenter(reads[i], temp); + temp = reads[reads[i + j].alignments[1]]; + temp.flipRead(); + string ENDinsertseq = GetUnalignedCenter(reads[i + j], temp); + + ref << Reff.getSubSequence(reads[i].chr, pos - 1 - 1, 1); + //alt << STARTinsertedseq; + alt << ""; + //alt << ENDinsertseq; + + int readAmut = 0; + int readApos = 0; + int readBmut = 0; + int readBpos = 0; + reads[i].GetQualityHashes(readAmut, readApos, reads[i].sigBreakPoint()); + reads[i + j].GetQualityHashes(readBmut, readBpos, + reads[i + j].sigBreakPoint()); + + float qual = -100; + if ((readApos + readBpos) > 0) + qual = ((float) readAmut + (float) readBmut) / + ((float) readApos + (float) readBpos) * 100.0; + else + qual = 0; + int SupportingHashes = readAmut + readBmut; + int possibleHashes = readApos + readBpos; + + string phase = "none"; + if (reads[i].phase != "none") + phase = reads[i].phase; + else if (reads[i + j].phase != "none") + phase = reads[i + j].phase; + + + string FullfilterA = reads[i].filterSV(); + string FullfilterB = reads[i + j].filterSV(); + + string InfoFilter = ""; + string Filter = ""; + + int GMap = 0; + int minMapQual = 30; + + if (reads[i].mapQual > minMapQual) + GMap++; + if (reads[reads[i].alignments[1]].mapQual > minMapQual) + GMap++; + if (reads[i + j].mapQual > minMapQual) + GMap++; + if (reads[reads[i + j].alignments[1]].mapQual > minMapQual) + GMap++; + + stringstream Format; + int startoffset = abs(startBreak); + int endoffset = abs(endBreak); + if (startBreak > 0) { + Format << abs(startBreak) << "Y"; + } else if (startBreak < 0) { + Format << abs(startBreak) << "D"; + } + Format << InterpretInsertSize(STARTinsertedseq); + Format << size - startoffset - endoffset << "V"; + if (endBreak > 0) { + Format << abs(endBreak) << "Y"; + } else if (endBreak < 0) { + Format << abs(endBreak) << "D"; + } + Format << InterpretInsertSize(ENDinsertseq); + + + if (GMap < 1) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "" && FullfilterB == "") { + Format << "-DeNovo"; + InfoFilter = "Pass"; + Filter = "PASS"; + for (int k = 0; k < + reads[i].alignments.size(); k++) { reads[reads[i].alignments[k]].SVeventid = CurrentSVeventID; } + for (int k = 0; k < reads[i + j].alignments.size(); k++) { + reads[reads[i + j].alignments[k]].SVeventid = CurrentSVeventID; + } + } else { + Format << "-" << FullfilterA << "," << FullfilterB; + InfoFilter = FullfilterA; + InfoFilter += FullfilterB; + Filter = "fail"; + } + + info << "SVTYPE=INV;END=" << end << ";"; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + info << "FS=" << SupportingHashes << "/" << possibleHashes << ";"; + + info << "RN=" << reads[i].name << "_and_" << reads[i + j].name << ";"; + info << "MQ=" << reads[i].mapQual << "_and_" << reads[i + j].mapQual << ";"; + info << "cigar=" << reads[i].cigar << "_and_" << reads[i + j].cigar << ";"; + info << "SB=" << reads[i].StrandBias << "_and_" << reads[i + j].StrandBias + << ";"; + info << "AS=" << reads[i].AlignmentSegments << "-" + << reads[i].AlignmentSegmentsCigar << "_and_" + << reads[i + j].AlignmentSegments << "-" + << reads[i + j].AlignmentSegmentsCigar; + + // cout << "read[i] genotype " << reads[i].sigBreakPoint() << " = " << reads[i].createStructGenotype(reads[i].sigBreakPoint()) << endl; + // cout << "read[i+j] genotype " << reads[i+j].sigBreakPoint() << "= " << reads[i+j].createStructGenotype(reads[i+j].sigBreakPoint())<< endl; + // cout << "read[reads[i].alignments[1]] genotype " <= 0) + i = i + j; + continue; + } else { + cout << "hopefully already got this one" << endl; + } + } + } + } + } + } + } + //checking for large insertions + + //chekcing for shorter tripple aligned insertions or duplications + if (reads[i].alignments.size() == 3 && reads[i].sigBreakPoint() > 0) { + // cout << "cheking tripple" << endl; + // reads[i].write(); + // reads[reads[i].alignments[1]].write(); + // reads[reads[i].alignments[2]].write(); + int start = -1; + int mid = -1; + int exit = -1; + //find entering contig + if (reads[i].clipPattern == "mc") + start = i; + else if (reads[reads[i].alignments[1]].clipPattern == "mc") + start = reads[i].alignments[1]; + else if (reads[reads[i].alignments[2]].clipPattern == "mc") + start = reads[i].alignments[2]; + + //find source contig + if (reads[i].clipPattern == "cmc") + mid = i; + else if (reads[reads[i].alignments[1]].clipPattern == "cmc") + mid = reads[i].alignments[1]; + else if (reads[reads[i].alignments[2]].clipPattern == "cmc") + mid = reads[i].alignments[2]; + + //find exit contig + if (reads[i].clipPattern == "cm") + exit = i; + else if (reads[reads[i].alignments[1]].clipPattern == "cm") + exit = reads[i].alignments[1]; + else if (reads[reads[i].alignments[2]].clipPattern == "cm") + exit = reads[i].alignments[2]; + + // cout << "start = " << start << " mid = " << mid << " exit = " << exit<< endl; + + if (start > 1 && mid > 1 && exit > 1) { + // cout << "yay" << endl; + // cout << reads[start].chr << " and " << reads[exit].chr << endl; + if (reads[start].chr == reads[exit].chr && + (reads[exit].sigBreakPoint() > 0 || reads[start].sigBreakPoint() > 0) && + (reads[exit].mapQual > 0 && reads[start].mapQual > 0)) { + // cout << "yay2" << endl; + int TargetSize = ((reads[exit].pos + reads[exit].sigBreakPoint()) - + (reads[start].pos + reads[start].sigBreakPoint())) * -1; + if (reads[start].SVeventid == 0) { + // cout << "found tripple" << endl; + int pos = reads[start].pos + reads[start].BreakPoint() - 1; + // reads[start].write(); + // reads[mid].write(); + // reads[exit].write(); + CurrentSVeventID++; + // cout << "here " << endl; + string GenotypeField; + // cout << "start bkreapoing = " << reads[start].BreakPoint() <<" and exit = " << reads[exit].BreakPoint() << endl; + // cout << "reads start genoptype = " ; + // cout << reads[start].createStructGenotype(reads[start].BreakPoint()) << endl; + // cout << "reads end genotype = " ; + // cout << reads[exit].createStructGenotype(reads[mid].BreakPoint()); + // cout << "boom" << endl; + if (CheckGenotypes(reads[start].createStructGenotype(reads[start].BreakPoint()))) + GenotypeField = reads[start].createStructGenotype(reads[start].BreakPoint()); + else if (CheckGenotypes(reads[exit].createStructGenotype(reads[exit].BreakPoint()))) + GenotypeField = reads[exit].createStructGenotype(reads[exit].BreakPoint()); + else + GenotypeField = reads[exit].createStructGenotype(reads[mid].BreakPoint()); + + // cout << "here 2" << endl; + string Format = InterpretTargetSize(TargetSize); + Format += "trippleDUP"; + // cout << "here 3" << endl; + string ref = Reff.getSubSequence(reads[start].chr, + reads[start].pos + reads[start].BreakPoint() - 1 - 1, 1); + if (TargetSize < 0) + ref = ref + Reff.getSubSequence(reads[start].chr, + reads[start].pos + reads[start].BreakPoint() - 1, + TargetSize * -1); + + stringstream alt; + + alt << Reff.getSubSequence(reads[start].chr, + reads[start].pos + reads[start].BreakPoint() - 1 - 1, 1); + if (TargetSize > 0) + alt << Reff.getSubSequence(reads[start].chr, + reads[start].pos + reads[start].BreakPoint() - 1, + TargetSize); + alt << reads[mid].seq.substr(reads[start].BreakPoint(), + reads[exit].BreakPoint() - reads[start].BreakPoint()); + //alt << reads[mid].seq.substr(reads[start].BreakPoint(), reads[mid].CountBasesAligned(reads[mid].BreakPoint())+1 +reads[mid].BreakPoint()- reads[start].BreakPoint() ) ; + //alt << Reff.getSubSequence(reads[mid].chr, reads[mid].pos+reads[mid].BreakPoint(), reads[mid].CountBasesAligned(reads[mid].BreakPoint())+1) ; + // cout << "here 3" << endl; + string FullfilterA = reads[start].filterSV(); + string FullfilterB = reads[mid].filterSV(); + string FullfilterC = reads[exit].filterSV(); + // cout << "here 4" << endl; + int GMap = 0; + int minMapQual = 30; + if (reads[start].mapQual > minMapQual) + GMap++; + if (reads[mid].mapQual > minMapQual) + GMap++; + if (reads[exit].mapQual > minMapQual) + GMap++; + // cout << "here 5"<< endl; + string InfoFilter = ""; + string Filter = ""; + + if (GMap < 1) { + Format += "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "" && FullfilterB == "" && FullfilterC == "") { + Format += "-DeNovo"; + InfoFilter = "Pass"; + Filter = "PASS"; + reads[start].SVeventid = CurrentSVeventID; + reads[mid].SVeventid = CurrentSVeventID; + reads[exit].SVeventid = CurrentSVeventID; + } else { + Format += "-"; + Format += FullfilterA; + Format += ","; + Format += FullfilterB; + InfoFilter = FullfilterA; + InfoFilter += FullfilterB; + Filter = "fail"; + } + // cout << "here 6" << endl; + //make quality stuff + int readAmut = 0; + int readApos = 0; + int readBmut = 0; + int readBpos = 0; + reads[start].GetQualityHashes(readAmut, readApos, reads[start].BreakPoint()); + reads[exit].GetQualityHashes(readBmut, readBpos, reads[exit].BreakPoint()); + + float qual = -100; + if ((readApos + readBpos) > 0) + qual = ((float) readAmut + (float) readBmut) / ((float) readApos + (float) readBpos) * + 100.0; + else + qual = 0; + + // cout << "here 7" << endl; + //buildng up info field + stringstream info; + info << "SVTYPE=INS;END=" << reads[start].pos + reads[start].BreakPoint() - 1 << ";"; + info << "SOURCE=" << reads[mid].chr << ":" << reads[mid].pos + reads[mid].BreakPoint() + << "-" << reads[mid].pos + reads[mid].BreakPoint() + + reads[mid].CountBasesAligned(reads[mid].BreakPoint()) << ";"; + string phase = "none"; + if (reads[start].phase != "none") + phase = reads[start].phase; + else if (reads[exit].phase != "none") + phase = reads[exit].phase; + else if (reads[mid].phase != "none") + phase = reads[mid].phase; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + int SupportingHashes = readAmut + readBmut; + int possibleHashes = readApos + readBpos; + info << "FS=" << SupportingHashes << "/" << possibleHashes << ";"; + + info << "RN=" << reads[start].name << ";"; + info << "MQ=" << reads[start].mapQual << "_and_" << reads[mid].mapQual << "_and_" + << reads[exit].mapQual << ";"; + info << "cigar=" << reads[start].cigar << "_and_" << reads[mid].cigar << "_and_" + << reads[exit].cigar << ";"; + info << "SB=" << reads[start].StrandBias << ";"; + info << "AS=" << reads[start].AlignmentSegments << "-" + << reads[start].AlignmentSegmentsCigar << "_and_" << reads[mid].AlignmentSegments + << "-" << reads[mid].AlignmentSegmentsCigar << "_and_" << reads[exit].AlignmentSegments + << "-" << reads[exit].AlignmentSegmentsCigar; + + + //cout << reads[start].chr << "\t" << reads[start].pos+reads[start].sigBreakPoint() -1 << "\t" << Format << "\t" << ref << "\t" << alt.str() << "\t" << qual << "\t" << Filter << "\t" << info.str() << "\t" << "GT:DP:RO:AO\t" << GenotypeField << endl; + //VCFOutFile << reads[start].chr << "\t" << pos << "\t" << Format << "\t" << ref << "\t" << alt.str() << "\t" << qual << "\t" << Filter << "\t" << info.str() << "\t" << "GT:DP:RO:AO\t" << GenotypeField << endl; + stringstream call; + call << reads[start].chr << "\t" << pos << "\t" << Format << "\t" << ref << "\t" + << alt.str() << "\t" << qual << "\t" << Filter << "\t" << info.str() << "\t" + << "GT:DP:RO:AO\t" << GenotypeField << endl; + VCFOutFile << call.str(); + // cout << "here 8 " << endl; + //break; + + } + } + } + } + //could add the very large insert tandem stuff here + if (reads[i].alignments.size() >= 1 && reads[i].clipPattern == "mc" && reads[i].sigBreakPoint() > 0 && + reads[i].SVeventid == 0) { + // cout << "possible large insertion" << endl; + // reads[i].write(); + int start = -5; + while (start + i < 0) { start++; } + for (int j = start; j <= 5 && j + i >= 0 && j + i < reads.size(); j++) { + // cout << "I = " << i << "and J = " << j << endl; + // cout << reads[i+j].name << " sig break point = " << reads[i+j].sigBreakPoint() << endl; + if (reads[i + j].alignments.size() == 1 && reads[i + j].clipPattern == "cm" && + reads[i + j].sigBreakPoint() > 0 && reads[i].chr == reads[i + j].chr && + reads[i + j].SVeventid == 0) { + // cout << "even more possible large insert" << endl; + int sbI = reads[i].sigBreakPoint(); + int sbJ = reads[i + j].sigBreakPoint(); + int positionI = reads[i].pos + sbI; + int positionJ = reads[i + j].pos + sbJ; + + //if (abs(positionAa - positionBa) < HashSize || abs(positionAb - positionBb) < HashSize || abs(positionAa - positionBb) < HashSize || abs(positionAb - positionBa) < HashSize ) + + + if (abs(positionI - positionJ) < 1000000 && reads[i].SVeventid == 0 && + reads[i + j].SVeventid == 0 && (reads[i].mapQual > 0 && reads[i + j].mapQual > 0)) { + // cout << "Found Large Insert" << endl; + // reads[i].write(); + // reads[i+j].write(); + int pos = -1; + if (positionI < positionJ) + pos = positionI; + else + pos = positionJ; + + // cout << "pos = " << pos << endl; + int end = 0; + if (positionI > positionJ) + end = positionI; + else + end = positionJ; + // cout << "end = " << end << endl; + + + int startBreak = positionI - positionJ; + + stringstream call; + + // cout << "here 1" << endl; + stringstream Format; + if (startBreak > 0) { + Format << abs(startBreak) << "Y"; + } else if (startBreak < 0) { + Format << abs(startBreak) << "D"; + } + // cout << "here 2 " << endl; + stringstream alt; + stringstream ref; + stringstream info; + string GenotypeField; + //ref << Reff.getSubSequence(reads[i].chr, pos -1 -1, 1); + alt << ""; + if (startBreak > 0) { + ref << Reff.getSubSequence(reads[i].chr, pos - 1 - 1, 1); + //alt << Reff.getSubSequence(reads[i].chr, pos - 1 - 1, 1 + abs(startBreak)); + } else if (startBreak < 0) { + ref << Reff.getSubSequence(reads[i].chr, pos - 1 - 1, 1 + abs(startBreak)); + //alt << Reff.getSubSequence(reads[i].chr, pos - 1 - 1, 1); + } + // cout << "here 3" << endl; + //ref << "-" << Reff.getSubSequence(reads[i].chr, pos -1 -1 + abs(startBreak)+1, size - abs(startBreak) - abs(endBreak) ); + // cout <<" posI = " << sbI << " and pos j = " << sbJ << endl; + string leftseq = reads[i].getClippedSequence(sbI, "mc"); + // cout << "here 3.11" << endl; + string rightseq = reads[i + j].getClippedSequence(sbJ, "cm"); + // cout << "here 3.12" << endl; + //alt << "-" << reads[i].getClippedSequence(sbI, "mc") << "NNNNNNNNNNNNNNNNNNNN" + // << reads[i + j].getClippedSequence(sbJ, "cm"); + // cout << "here 3.1" << endl; + Format << alt.str().length() << "+" << "LargeInsert"; + // cout << "here 3.2" << endl; + int readAmut = 0; + int readApos = 0; + int readBmut = 0; + int readBpos = 0; + reads[i].GetQualityHashes(readAmut, readApos, reads[i].sigBreakPoint()); + // cout << "here 3.3" << endl; + reads[i + j].GetQualityHashes(readBmut, readBpos, reads[i + j].sigBreakPoint()); + // cout << "here 4" << endl; + float qual = -100; + if ((readApos + readBpos) > 0) + qual = ((float) readAmut + (float) readBmut) / ((float) readApos + (float) readBpos) * + 100.0; + else + qual = 0; + int SupportingHashes = readAmut + readBmut; + int possibleHashes = readApos + readBpos; + + string phase = "none"; + if (reads[i].phase != "none") + phase = reads[i].phase; + else if (reads[i + j].phase != "none") + phase = reads[i + j].phase; + // cout << "here 5" << endl; + CurrentSVeventID++; + for (int k = 0; k < + reads[i].alignments.size(); k++) { reads[reads[i].alignments[k]].SVeventid = CurrentSVeventID; } + for (int k = 0; k < reads[i + j].alignments.size(); k++) { + reads[reads[i + j].alignments[k]].SVeventid = CurrentSVeventID; + } + string FullfilterA = reads[i].filterSV(); + string FullfilterB = reads[i + j].filterSV(); + + string InfoFilter = ""; + string Filter = ""; + + int GMap = 0; + int minMapQual = 30; + // cout << "here 6" << endl; + if (reads[i].mapQual > minMapQual) + GMap++; + if (reads[i + j].mapQual > minMapQual) + GMap++; + if (GMap < 1) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "" && FullfilterB == "") { + Format << "-DeNovo"; + InfoFilter = "Pass"; + Filter = "PASS"; + } else { + Format << "-" << FullfilterA << "," << FullfilterB; + InfoFilter = FullfilterA; + InfoFilter += FullfilterB; + Filter = "fail"; + } + + info << "SVTYPE=INS;END=" << end << ";"; + info << "PH=" << phase << ";"; + + info << "FEX=" << InfoFilter << ";"; + info << "FS=" << SupportingHashes << "/" << possibleHashes << ";"; + + info << "RN=" << reads[i].name << "_and_" << reads[i + j].name << ";"; + info << "MQ=" << reads[i].mapQual << "_and_" << reads[i + j].mapQual << ";"; + info << "cigar=" << reads[i].cigar << "_and_" << reads[i + j].cigar << ";"; + info << "SB=" << reads[i].StrandBias << "_and_" << reads[i + j].StrandBias << ";"; + info << "AS=" << reads[i].AlignmentSegments << "-" << reads[i].AlignmentSegmentsCigar + << "_and_" << reads[i + j].AlignmentSegments << "-" + << reads[i + j].AlignmentSegmentsCigar; + + // cout << "read[i] genotype " << reads[i].sigBreakPoint() << " = " << reads[i].createStructGenotype(reads[i].sigBreakPoint()) << endl; + // cout << "read[i+j] genotype " << reads[i+j].sigBreakPoint() << "= " << reads[i+j].createStructGenotype(reads[i+j].sigBreakPoint())<< endl; + + if (CheckGenotypes(reads[i].createStructGenotype(reads[i].sigBreakPoint()))) + GenotypeField = reads[i].createStructGenotype(reads[i].sigBreakPoint()); + else + GenotypeField = reads[i + j].createStructGenotype(reads[i + j].sigBreakPoint()); + + + call << reads[i].chr << "\t" << pos - 1 << "\t" << Format.str() << "\t" << ref.str() << "\t" + << alt.str() << "\t" << qual << "\t" << Filter << "\t" << info.str() << "\t" + << "GT:DP:RO:AO\t" << GenotypeField << endl; + VCFOutFile << call.str(); + // cout << call.str(); + } + } + } + } + if (reads[i].isSplitRead > 0 && reads[i].SVeventid == 0) { + bool found = false; + // cout << "Posible mobil single read element" << endl; + // reads[i].write(); + // for (int j = 1; j < reads[i].alignments.size(); j ++) + // { + // reads[reads[i].alignments[j]].write(); + // } + // mobs[reads[i].name].write(); + // do I have a breakpoint supporoted by hashes + int bp = reads[i].sigBreakPoint(); + // cout << "sig break point is " << bp << endl; + if (bp > 0) { + // cout << "Passed SigBreakpoint check " << endl; + + //if (checkMobSupAalign(i, reads)) + { + int maxSupAlign = 0; + for (int j = 1; j < reads[i].alignments.size(); j++) { + if (reads[reads[i].alignments[j]].mapQual > maxSupAlign) + maxSupAlign = reads[reads[i].alignments[j]].mapQual; + } + if (reads[i].mapQual >= maxSupAlign) { + // cout << "passed masSUpAlign" << endl; + vector temp; + for (int j = 1; j < reads[i].alignments.size(); j++) { + if (reads[reads[i].alignments[j]].mapQual > 30) + temp.push_back(reads[reads[i].alignments[j]]); + } + // cout << "built thing" << endl; + int polyAbp = reads[i].isPolyA(temp); + // cout << "first mobalign" << endl; + int myMobBase = MobAligneBases(mobs[reads[i].name], reads[i]); + // cout << "done with first mobalign " << endl; + vector secondMobBase; + int maxSecondMob = 0; + for (int j = 1; j < reads[i].alignments.size(); j++) { + // cout << "next mobalign " << i << endl; + secondMobBase.push_back( + MobAligneBases(mobs[reads[i].name], reads[reads[i].alignments[j]])); + // cout << "done with next mobalign " << j << endl; + if (secondMobBase[j - 1] > maxSecondMob) { maxSecondMob = secondMobBase[j - 1]; } + } + // cout << "checking Distnace" << endl; + // cout << "size = " << reads[i].alignments.size()<< endl; ; + bool checkDistance = true; + for (int j = 1; j < reads[i].alignments.size(); j++) { + // cout << "checking " << reads[i].chr << " - " << reads[i].pos << " VS " << reads[reads[i].alignments[j]].chr << " - " << reads[reads[i].alignments[j]].pos; + if (reads[i].chr == reads[reads[i].alignments[j]].chr && + abs(reads[i].pos - reads[reads[i].alignments[j]].pos) < 10000) + checkDistance = false; + // cout << " and checkDist = " << checkDistance << endl; + } + + if ((polyAbp > -1 || (myMobBase > maxSecondMob && myMobBase > 10)) && checkDistance) { + // cout << "FOUND MOB with no PolyA" << endl; + if (reads[i].SVeventid == 0) { + int targetsize = 0; + int start = reads[i].pos + bp; + CurrentSVeventID++; + for (int k = 0; k < + reads[i].alignments.size(); k++) { reads[reads[i].alignments[k]].SVeventid = CurrentSVeventID; } + string GenotypeField; + GenotypeField = reads[i].createStructGenotype(reads[i].sigBreakPoint()); + stringstream Format; + Format << "OrphanBND"; + if (polyAbp > -1) + Format << "-PolyA" << polyAbp; + if (myMobBase > 10) { + Format << "-MOB" << myMobBase; + for (int j = 0; j < secondMobBase.size(); j++) { + Format << "+" << secondMobBase[j]; + } + } + Format << "-" << reads[i].MobAS; + Format << "LC=" << reads[i].SVCheckParentsForLowCov(reads[i].sigBreakPoint()); + + + string ref = Reff.getSubSequence(reads[i].chr, reads[i].pos + bp - 1, 1); + stringstream alt; + alt << ""; + + string FullfilterA = reads[i].filterSV(); + int GMap = 0; + int minMapQual = 30; + if (reads[i].mapQual > minMapQual) + GMap++; + + + string InfoFilter = ""; + string Filter = ""; + if (reads[i].SVCheckParentsForLowCov(reads[i].sigBreakPoint()) >= 1) { + Format << "-Inherited"; + InfoFilter = "Inherited"; + Filter = "LCH"; + } else if (GMap < 1) { + Format << "-LowMapQual"; + InfoFilter = "LowMapQual"; + Filter = "LMQ"; + } else if (FullfilterA == "") { + found = true; + Format << "-DeNovo"; + InfoFilter = "Pass"; + Filter = "PASS"; + } else { + Format << "-" << FullfilterA; + InfoFilter = FullfilterA; + Filter = "fail"; + } + //make quality stuff + int readAmut = 0; + int readApos = 0; + reads[i].GetQualityHashes(readAmut, readApos, bp); + + float qual = -100; + if ((readApos) > 0) + qual = ((float) readAmut) / ((float) readApos) * 100.0; + else + qual = 0; + + + //buildng up info field + stringstream info; + info << "SVTYPE=INS;END=" << reads[i].pos + bp - 1 << ";"; + info << "MT=" << reads[i].MobContig << ";"; + string phase = "none"; + if (reads[i].phase != "none") + phase = reads[i].phase; + info << "PH=" << phase << ";"; + info << "FEX=" << InfoFilter << ";"; + int SupportingHashes = readAmut; + int possibleHashes = readApos; + info << "FS=" << SupportingHashes << "/" << possibleHashes << ";"; + + info << "RN=" << reads[i].name << ";"; + info << "MQ=" << reads[i].mapQual << ";"; + info << "cigar=" << reads[i].cigar << ";"; + info << "SB=" << reads[i].StrandBias << ";"; + info << "AS=" << reads[i].AlignmentSegments << "-" + << reads[i].AlignmentSegmentsCigar << "_and_"; + + // cout << "in that one " << endl; + + // cout << reads[i].chr << "\t" << reads[i].pos+bp -1 << "\t" << Format.str() << "\t" << ref << "\t" << alt.str() << "\t" << qual << "\t" << Filter << "\t" << info.str() << "\t" << "GT:DP:RO:AO\t" << GenotypeField << endl; + VCFOutFile << reads[i].chr << "\t" << reads[i].pos + bp - 1 << "\t" << Format.str() + << "\t" << ref << "\t" << alt.str() << "\t" << qual << "\t" << Filter + << "\t" << info.str() << "\t" << "GT:DP:RO:AO\t" << GenotypeField + << endl; + //break; + + + + } + + } + } + } + } + if (found) + continue; + } + if (reads[i].isSplitRead > 0 && reads[i].SVeventid == 0 && reads[i].alignments.size() > 1) { + bool found = false; + // cout << "Last Ditch effort, lests give this something " << endl; + // reads[i].write(); + // for (int j = 1; j < reads[i].alignments.size(); j ++) + // { + // reads[reads[i].alignments[j]].write(); + // } + int A = -1; + int B = -1; + vector temp; + for (int j = 0; j < reads[i].alignments.size(); j++) { + temp.push_back(reads[reads[i].alignments[j]]); + } + FindFirstAndLast(temp, A, B); + // do I have a breakpoint supporoted by hashes + if (A >= 0 && B >= 0) { + LastDitch(reads, i, A, B, CurrentSVeventID); + if (A != B && (reads[reads[i].alignments[A]].sigBreakPoint() > 0 || + reads[reads[i].alignments[B]].sigBreakPoint() > 0 || + BreakpointInUnalignedCenter(reads[reads[i].alignments[A]], + reads[reads[i].alignments[B]]))) + LastDitch(reads, i, B, A, CurrentSVeventID); - //cout << "Done with Multi contig events" << endl; + } + } + } + } + //cout << "Done with Multi contig events" << endl; - VCFOutFile.close(); - BEDOutFile.close(); - BEDBigStuff.close(); - BEDNotHandled.close(); - Invertions.close(); - cout << "finishing RUFUS.Interpret for " << outStub << std::endl; - return 0; + VCFOutFile.close(); + BEDOutFile.close(); + BEDBigStuff.close(); + BEDNotHandled.close(); + Invertions.close(); + cout << "finishing RUFUS.Interpret for " << outStub << std::endl; + return 0; } diff --git a/src/RUFUS.interpret.onlytwoParents.2.cpp b/src/RUFUS.interpret.onlytwoParents.2.cpp deleted file mode 100644 index f29462e9..00000000 --- a/src/RUFUS.interpret.onlytwoParents.2.cpp +++ /dev/null @@ -1,3791 +0,0 @@ - -/*This vertion imcorporates both copy number and mutation detection in 1 - * * it needs to be run in two sptes, first the build, then the filter - * * it is split up to allow distribution to a cluster */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "externals/fastahack/Fasta.h" -#include -#include -#include -#include -#include - -#define NUMINTS (1000) -#define FILESIZE (NUMINTS * sizeof(int)) - -using namespace std; - -vector > ParentHashes; -unordered_map MutantHashes; -unordered_map ExcludeHashes; -FastaReference Reff; -int HashSize = 25; -int totalDeleted; -int totalAdded; -int MaxVarentSize = 1000; -ofstream VCFOutFile; -ofstream BEDOutFile; -ofstream BEDBigStuff; -ofstream BEDNotHandled; -ofstream Invertions; -ofstream Translocations; -ofstream Translocationsbed; -ofstream Unaligned; -map Hash; -///////////////////////// -const vector Split(const string& line, const char delim) { - vector tokens; - stringstream lineStream(line); - string token; - while ( getline(lineStream, token, delim) ) - tokens.push_back(token); - return tokens; -} -unsigned long HashToLong (string hash) -{ - bitset<64> HashBits; - for(int i=0; i stuff; - stuff = Split(line, '\t'); - string PageHash = stuff[0]; - // cout << "PageHash " << endl; - if (hash == PageHash) - { - // cout << "found a hash " << hash << " - " << PageHash; - return atoi(stuff[1].c_str()); - } - line = ""; - } - } - else if (firstNew == true) - { - // cout << "first Newline found" << endl; - line += data[i]; - } - - } - return 0; -} - -void ProcessPage( char *data, string& PageFirstHash, string& PageLastHash, long int pageSize) -{ - string line = ""; - bool firstNew = false;\ - for (int i = 0; i < pageSize; i++) - { - if (data[i] == '\n') - { - - if (firstNew == true) - break; - else - firstNew = true; - } - else if (firstNew == true) - line += data[i]; - } - - vector stuff; - stuff = Split(line, '\t'); - PageFirstHash = stuff[0]; - firstNew = false; - line = ""; - for (int i = pageSize-1; i > 0; i+=-1) - { - if ( data[i] == '\n') - { - if (firstNew == true) - break; - else - firstNew = true; - } - else if(firstNew == true) - line = data[i] + line; - } - stuff = Split(line, '\t'); - PageLastHash = stuff[0]; - -} - - - -int search(long int& fd, string hash, char* fileptr) -{ - //cout << "searching for " << hash << endl; - char *data; - struct stat sb; - fstat(fd, &sb); - - long int pageSize; - pageSize = sysconf(_SC_PAGE_SIZE); - long int NumPages = sb.st_size/pageSize; - //cout << "Number of pages = " << NumPages << endl; - // char *fileptr = NULL; - - long int off = 0; - long int firstPos; - long int lastPos; - firstPos = 0; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos*pageSize); - data = fileptr; - // above should get me first page - string FirstPageFirstHash; - string FirstPageLastHash; - ProcessPage(data, FirstPageFirstHash, FirstPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - //cout << FirstPageFirstHash << endl << FirstPageLastHash << endl; - //quck check to see if on first page - if (hash >= FirstPageFirstHash and hash <= FirstPageLastHash) - { - // cout << "found on first page" << endl; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos*pageSize); - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - if (hash < FirstPageFirstHash) - { - cout << "HASH NOT IN FILE " << hash << endl; - return 0; - } - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*(NumPages-1)); - data = fileptr; - lastPos = NumPages-1; - //the above should get me the last two pages, we take two to ensure the last pages isnt just one character or something like that - - string LastPageFirstHash; - string LastPageLastHash; - ProcessPage(data, LastPageFirstHash, LastPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - //cout << LastPageFirstHash << endl << LastPageLastHash << endl; - //quck check to see if on last page - if (hash >= LastPageFirstHash and hash <= LastPageLastHash) - { - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*(NumPages-1)); - // cout << "found on last page" << endl; - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - if (hash > LastPageLastHash) - { - cout << "HASH NOT IN FILE " << hash << endl; - return 0; - } - //start the search - int counter = 0; - while (true) - { - // cout << "ON LOOP " << counter << endl << endl; - counter++; - long int currentPage = lastPos - ((lastPos-firstPos)/2); - // cout << "checking page " << currentPage << " last = " << lastPos << " and first = " << firstPos << endl;; - if (currentPage == lastPos or currentPage == firstPos or lastPos - firstPos < 3) - { - string extra = ""; - // cout << "\nenvoked this" << endl; - fileptr = (char*)mmap64(NULL, pageSize*5, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize * (firstPos-1)); - data = fileptr; - // cout << "made it here" << endl; - int val = checkPage(data, hash, pageSize*5, extra); - if (munmap(fileptr, pageSize*5) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - //cout << " fileptr = (char*)mmap64(NULL, " << pageSize*2 <<", PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, " << pageSize<<" * " << currentPage <<");"<< endl; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*currentPage); - data = fileptr; - string CurrentPageFirstHash; - string CurrentPageLastHash; - ProcessPage(data, CurrentPageFirstHash, CurrentPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - // cout << " with " << CurrentPageFirstHash << " and " << CurrentPageLastHash << endl; - if (hash >= CurrentPageFirstHash and hash <= CurrentPageLastHash) - { - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*currentPage); - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - else - { - if (hash < CurrentPageFirstHash) - { - // cout << "hash " << hash << " is greater than " << CurrentPageFirstHash << " looking above" << endl; - lastPos = currentPage; - LastPageFirstHash = CurrentPageFirstHash; - LastPageLastHash = CurrentPageLastHash; - } - else if (hash > CurrentPageLastHash) - { - // cout << "hash \n" << hash << " is less than \n" << CurrentPageLastHash << " looking below" << endl; - firstPos = currentPage; - FirstPageFirstHash = CurrentPageFirstHash; - FirstPageLastHash = CurrentPageLastHash; - } - } - - } - close(fd); - -} - -bool fncomp (char lhs, char rhs) {return lhs=0; i+= -1) - { - char C = Sequence.c_str()[i]; - // cout << C << endl; - if (C == 'A') - NewString += 'T'; - else if (C == 'C') - NewString += 'G'; - else if (C == 'G') - NewString += 'C'; - else if (C == 'T') - NewString += 'A'; - else if (C == 'N') - NewString += 'N'; - else - { - cout << "ERROR IN RevComp - " << C << " " ; - NewString += C; - } - - } - //cout << "end\n"; - return NewString; -} - -void process_mem_usage(double& vm_usage, double& resident_set, double& MAXvm, double& MAXrss) -{ - using std::ios_base; - using std::ifstream; - using std::string; - - vm_usage = 0.0; - resident_set = 0.0; - - // 'file' stat seems to give the most reliable results - // - ifstream stat_stream("/proc/self/stat",ios_base::in); - - // dummy vars for leading entries in stat that we don't care about - // - string pid, comm, state, ppid, pgrp, session, tty_nr; - string tpgid, flags, minflt, cminflt, majflt, cmajflt; - string utime, stime, cutime, cstime, priority, nice; - string O, itrealvalue, starttime; - - // the two fields we want - // - unsigned long vsize; - long rss; - - stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr - >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt - >> utime >> stime >> cutime >> cstime >> priority >> nice - >> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest - - stat_stream.close(); - - long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages - vm_usage = vsize / 1024.0; - resident_set = rss * page_size_kb; - if (vm_usage > MAXvm){MAXvm = vm_usage;} - if (resident_set > MAXrss){MAXrss = resident_set;} -} - -class SamRead -{ - public: - string name; - int flag; - bool FlagBits[16]; - string chr; - int pos; - int mapQual; - int AlignScore; - string cigar; - string seq; - string qual; - string RefSeq; - string originalSeq; - string originalQual; - string cigarString; - string strand; - float StrandBias; - string strands; - int forward; - int reverse; - bool UsedForBigVar; - vector alignments; - vector Positions; - vector ChrPositions; - int AlignmentSegments; - - vector MutAltCounts; - vector MutRefCounts; - vector MutHashListCounts; - - vector> RefAltCounts; - vector> RefRefCounts; - vector AltKmers; - vector RefKmers; - bool first; // = true; - bool combined; // = false; - vector PeakMap; - - void createPeakMap(); - void parse(string read); - void getRefSeq(); - void CountAlignmentSegments(); - void processCigar(); - void parseInsertions( SamRead B); - void parseMutations( char *argv[] ); - void GetModes(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &ParRefModes, vector &ParAltModes, vector &HashCounts, vector &HashCountsOG, int &PossibleVarKmer); - //string ShittyGenotyper(int Alt, int Ref); - int GetSupportingHashCount(int pos, string alt, string reff); - void processMultiAlignment(); - void write(); - void writeVertical(); - void writetofile(ofstream &out); - void flipRead(); - void LookUpKmers(); - void FixTandemRef(); - int CheckParentCov(int &mode); - bool StartsWithAlign(int &pos, string &insert); - bool EndsWithAlign(int &pos, string &insert); - bool StartsWithAlignAtPeak(int &pos, string &insert, int &Kdepth); - bool EndsWithAlignAtPeak(int &pos, string &insert, int &Kdepth); - - bool CheckEndsAlign(); - int CheckBasesAligned(); - - - - vector hashes; - vector hashesRef; - vector varHash; - vector candidateHash; - vector > parentCounts; - vector > parentCountsReference; - vector mutCounts; - vector mutCountsRef; - void BuildUpHashCountTable(); -}; - - - -void SamRead::BuildUpHashCountTable() -{ - /////////////////Building up varHash and hash lists ///////////// - cout << "Building up varHash" << endl; - for (int i = 0; i < seq.size() - HashSize; i++) - { - string newHash = ""; - string newHashRef = ""; - newHash += seq.c_str()[i]; - newHashRef += RefSeq.c_str()[i]; - int count = 0; - ////can i replace this with get hash ? - if ((cigarString.c_str()[i] != 'D' and cigarString.c_str()[i] != 'R' and cigarString.c_str()[i] != 'H')) - { - for (int j = 1; j 0 or Hash.count(RevComp(newHash)) > 0) - varHash.push_back(true); - else - varHash.push_back(false); - } - /////////////////////////////////////////////////// - - - ///////////////////building up parent hash counts ////////////////// - cout << "Bulding Par hash counts" << endl; - //vector ParentHash; - for(int pi = 0; pi counts; - vector countsRef; - for(int i = 0; i< hashes.size(); i++) - { - string hash = hashes[i]; - string hashRef = hashesRef[i]; - bool checkHash = true; - for (int j = 0; j < HashSize; j++) - { - if (!(hash[j] == 'A' or hash[j] == 'C' or hash[j] == 'G' or hash[j] == 'T')) - { - checkHash = false; - break; - } - } - if (checkHash) - { - unsigned long int LongHash = HashToLong(hash); - if (ParentHashes[pi].count(LongHash) >0) - counts.push_back(ParentHashes[pi][LongHash]); - else - counts.push_back(0); - unsigned long int LongHashRef = HashToLong(hashRef); - if (ParentHashes[pi].count(LongHashRef) >0) - countsRef.push_back(ParentHashes[pi][LongHashRef]); - else - countsRef.push_back(0); - } - else - { - counts.push_back(-1); - countsRef.push_back(-1); - } - } - parentCounts.push_back(counts); - parentCountsReference.push_back(countsRef); - } - ////////////////////////////////////////////////////////////////// - /////////////////////bulid Mut counts///////////////////////////// - cout << "bulding mut counts" << endl; - cout << hashes.size() << endl; - cout << hashesRef.size() << endl; - for(int i = 0; i< hashes.size(); i++) - { - cout << i<< endl; - string hash = hashes[i]; - cout << " hash = " << hash << endl; - string hashRef = hashesRef[i]; - cout << "RefHash = " << hashRef << endl; - bool checkHash = true; - for (int j = 0; j < HashSize; j++) - { - if (!(hash[j] == 'A' or hash[j] == 'C' or hash[j] == 'G' or hash[j] == 'T')) - { - checkHash = false; - break; - } - } - cout << "check hash = " << checkHash << endl; - if (checkHash) - { - unsigned long int LongHash = HashToLong(hash); - if (MutantHashes.count(LongHash) >0) - { mutCounts.push_back(MutantHashes[LongHash]);} - else - { mutCounts.push_back(0);} - - unsigned long int LongHashRef = HashToLong(hashRef); - if (MutantHashes.count(LongHashRef) >0) - { mutCountsRef.push_back(MutantHashes[LongHashRef]);} - else - { mutCountsRef.push_back(0);} - } - else - { - mutCounts.push_back(-1); - mutCountsRef.push_back(-1); - } - } - ///////////////////////////////////////////////////////////////////// - - ////////////////////write out vertical table///////////////////////// - cout << "writing hashes out vert" << endl; - for(int i =0; i < hashes.size(); i++) - { - cout << i+pos << "\t" << i << "\t" << hashes[i] << "\t" << varHash[i] << "\t" << PeakMap[i] << "\t" << (int) qual.c_str()[i]-33; - cout << "\t" << "MutVar-" << mutCounts[i]; - for (int j = 0; j < parentCounts.size(); j++) - { - cout << "\t" << parentCounts[j][i]; - } - cout << "\t" << "MutRef-" << mutCountsRef[i]; - for (int j = 0; j < parentCountsReference.size(); j++) - { - cout << "\t" << parentCountsReference[j][i]; - } - cout << endl; - - } - //////////////////////////////////////////////////////////////// -} -int SamRead::GetSupportingHashCount(int pos, string alt, string reff) -{ - int Count =0; - int lower = pos-HashSize; - if (lower < 0){lower =0;} - int upper = pos+alt.length()+reff.length();//-1; - cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; - if (upper > MutRefCounts.size()){ - cout << "this is going to break " << upper << " > " << MutRefCounts.size() << endl; - upper = MutRefCounts.size(); - } - - for (int j = lower; j 0 and Hash[AltKmers[j]] > 0) - Count++; - else if (Hash.count(RevComp(AltKmers[j])) > 0 and Hash[RevComp(AltKmers[j])]) - Count++; - } - return Count; -} -string ShittyGenotyper(int Alt, int Ref) -{ - if (Alt ==0 and Ref ==0) - return "."; - else if (Alt == 0 and Ref > 1) - return "0/0"; - else if (Alt >0 and Ref ==0) - return "1/1"; - else if ((double) Alt / ((double) Ref + (double) Alt) >.85) - return "1/1"; - else if ((double) Alt / ((double) Ref + (double) Alt) <.15) - return "0/0"; - else - return "0/1"; -} -void SamRead::GetModes(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &ParRefModes, vector &ParAltModes, vector &HashCounts, vector &HashCountsOG, int &PossibleVarKmer) -{ - int lower = pos-HashSize+1; - if (lower < 0){lower =0;} - int upper = pos+alt.length()+reff.length()-1; - cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; - if (upper > MutRefCounts.size()){ - cout << "this is going to break " << upper << " > " << MutRefCounts.size() << endl; - upper = MutRefCounts.size(); - } - - //////////////chekcing allele frequencies /////////// - //vector HashCountsOG; - vector varMutRefCounts; - vector varMutAltCounts; - vector> varParRefCounts; - vector> varParAltCounts; - vector temp; - for(int pi = 0; pi freqs; - cout << "checking NonSpecic Kmers"; - string LastAtlKmer = "boomba"; - for (int j = lower; j0 and AltKmers[j] != RefKmers[j] ) //and MutRefCounts[j]<200 and (ExcludeHashes[HashToLong(RefKmers[j])]<2 or ExcludeHashes[HashToLong(RevComp(RefKmers[j]))]<2)) //needs to be fixed, should be based on cov not cutoff of 200 - varMutRefCounts.push_back(MutRefCounts[j]); - if (MutAltCounts[j]>0 and AltKmers[j] != RefKmers[j] and MutAltCounts[j]<200 and (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and (ExcludeHashes[HashToLong(AltKmers[j])]<1 or ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<1)) //needs to be fixed, should be based on cov not cutoff of 200 - varMutAltCounts.push_back(MutAltCounts[j]); - - for (int pi=0; pi < varParRefCounts.size(); pi++){ - if (RefRefCounts[pi][j] >0 and AltKmers[j] != RefKmers[j] )//and RefRefCounts[pi][j] <200 and (ExcludeHashes[HashToLong(AltKmers[j])]<2 or ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<2)) //needs to be fixed, should be based on cov not cutoff of 200 - varParRefCounts[pi].push_back(RefRefCounts[pi][j]); - if (RefAltCounts[pi][j] >0 and AltKmers[j] != RefKmers[j] and RefAltCounts[pi][j] < 200 and (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and (ExcludeHashes[HashToLong(RefKmers[j])]<1 or ExcludeHashes[HashToLong(RevComp(RefKmers[j]))]<1)) //needs to be fixed, should be based on cov not cutoff of 200 - varParAltCounts[pi].push_back(RefAltCounts[pi][j]); - - } - - if (Hash.count(AltKmers[j]) > 0 and Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j] ) - HashCountsOG.push_back(Hash[AltKmers[j]]); - else if (Hash.count(RevComp(AltKmers[j])) > 0 and Hash[RevComp(AltKmers[j])] and AltKmers[j] != RefKmers[j] ) - HashCountsOG.push_back(Hash[RevComp(AltKmers[j])]); - - - if (Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j]) - HashCounts.push_back(Hash[AltKmers[j]]); - else if (Hash[RevComp(AltKmers[j])] > 0 and AltKmers[j] != RefKmers[j]) - HashCounts.push_back(Hash[RevComp(AltKmers[j])]); - else - HashCounts.push_back(-1); - } - // float freq = 0; - // if (freqs.size() > 0){ - // for (int i =0; i<><><><>MutRef<><><><><><>" << endl ; - for (int s =0; s<><><><>MutAlt<><><><><><>" << endl; - for (int s =0; s<><><><>MutRefSorted<><><><><><>" << endl ; - for (int s =0; s<><><><>MutAltSorted<><><><><><>" << endl; - for (int s =0; s<><><><>Ref" << pi << "<><><><><<><>" << endl; - for (int s =0; s1) - MutRefMode = varMutRefCounts[0]; - //MutRefMode = varMutRefCounts[(varMutRefCounts.size())/2]; //// switch this for line above to get the mode, right now were taking the min - else if (varMutRefCounts.size() ==1) - MutRefMode = varMutRefCounts[0]; - else - MutRefMode = 0; - - if (varMutAltCounts.size() >1) - MutAltMode = varMutAltCounts[0]; - //MutAltMode= varMutAltCounts[(varMutAltCounts.size()-2)/2]; //// switch this for line above to get the mode, right now were taking the min - else if (varMutAltCounts.size() ==1) - MutAltMode = varMutAltCounts[0]; - else - MutAltMode=0; - - for(int pi = 0; pi1) - ParRefModes.push_back(varParRefCounts[pi][0]); - //ParRefModes.push_back(varParRefCounts[pi][((varParRefCounts[pi].size())/2)]); //// switch this for line above to get the mode, right now were taking the min - else if (varParRefCounts[pi].size() ==1) - ParRefModes.push_back(varParRefCounts[pi][0]); - else - ParRefModes.push_back( 0); - } - for(int pi =0; pi1) - ParAltModes.push_back(varParAltCounts[pi][0]); - // ParAltModes.push_back(varParAltCounts[pi][((varParAltCounts[pi].size())/2)]); //// switch this for line above to get the mode, right now were taking the min - else if (varParAltCounts[pi].size()==1) - ParAltModes.push_back(varParAltCounts[pi][0]); - else - ParAltModes.push_back( 0); - } -} -void SamRead::CountAlignmentSegments() -{ - AlignmentSegments = 0; - char last = cigarString.c_str()[0]; - for (int i =1; i < cigarString.size(); i++) - { - if (cigarString.c_str()[i] == 'M') - {} - else if (last == 'M') - { - AlignmentSegments++; - } - last = cigarString.c_str()[i]; - } - if (last == 'M') - { - AlignmentSegments++; - } -} -int SamRead::CheckParentCov(int &mode) -{ - //vector> RefAltCounts; - //vector> RefRefCounts; - bool good = true; - int lowC = 0; - vector cov; - for (int pi = 0; pi < RefRefCounts.size(); pi++){ - for (int i = 0; i < RefRefCounts[pi].size(); i++){ - if (RefKmers[i] != ""){ - int ParRef = 0; - int ParAlt = 0; - if (RefAltCounts[pi][i] > 0) - ParAlt = RefAltCounts[pi][i]; - if (RefRefCounts[pi][i] > 0) - ParRef = RefRefCounts[pi][i]; - cov.push_back(ParRef+ParAlt); - if (ParRef+ParAlt > 0 && ParRef+ParAlt < 10) - lowC++; - } - } - } - if(cov.size()>1){ - - sort (cov.begin(), cov.end()); - mode = cov[cov.size()/2]; - } - else - mode = -1; - - return lowC; -} - -void SamRead::flipRead() -{ - cout <<"FLIPPING reads not on the same strand"; - write(); - string FlipSeq = "" ; - string FlipQual = "" ; - string FlipRefSeq = ""; - string FlipCigarString = ""; - string FlipStrand = ""; - vector FlipPeakMap ; - vector FlipPos; - vector FlipChrPos; - for (int i = seq.size() -1; i >=0; i--) - { - // FlipSeq += seq.c_str()[i]; - FlipQual += qual.c_str()[i]; - // FlipRefSeq += RefSeq.c_str()[i]; - FlipCigarString += cigarString.c_str()[i]; - FlipStrand += '-'; - FlipPos.push_back(Positions[i]); - FlipChrPos.push_back(ChrPositions[i]); - FlipPeakMap.push_back(PeakMap[i]); - } - FlipSeq = RevComp(seq); - FlipRefSeq = RevComp(RefSeq); - - seq = FlipSeq; - qual = FlipQual; - RefSeq = FlipRefSeq; - cigarString = FlipCigarString; - strand = FlipStrand; - Positions = FlipPos; - ChrPositions = FlipChrPos; - PeakMap=FlipPeakMap; - write(); - -} - -void SamRead::processMultiAlignment() -{ - //check if this is a mis-joined contig - -} -void SamRead::write() -{ - cout << name << endl; - cout << " flag = " << flag << endl; - cout << " mapQual = " << mapQual << endl; - cout << " Strand = " << GetReadOrientation(flag) << endl; - cout << " Alignments = " << alignments.size() << endl; - cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - cout << " cigar = " << cigar << endl; - cout << " Seq = " << seq << endl; - cout << " Qual = " << qual << endl; - cout << " Cigar = " << cigarString << endl; - cout << " RefSeq = " << RefSeq << endl; - cout << " strand = " << strand << endl; - cout << " PeakMap = "; - for (int i =0; i < PeakMap.size(); i++) - {cout << PeakMap[i]; } - cout << endl; - cout << " RefPositions: "; - for (int i =0; i < Positions.size(); i++) - cout << Positions[i] << " \t"; - cout << endl; - cout << " RefChromoso: "; - for (int i =0; i < ChrPositions.size(); i++) - cout << ChrPositions[i] << " \t"; - cout << endl; - -} -void SamRead::writetofile(ofstream &out) -{ - - out << name << endl; - out << " flag = " << flag << endl; - out << " mapQual = " << mapQual << endl; - out << " Strand = " << GetReadOrientation(flag) << endl; - out << " Alignments = " << alignments.size() << endl; - out << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - out << " AlignScore = " << AlignScore << endl; - out << " cigar = " << cigar << endl; - out << " Seq = " << seq << endl; - out << " Qual = " << qual << endl; - out << " Cigar = " << cigarString << endl; - out << " RefSeq = " << RefSeq << endl; - out << " PeakMap= "; - for (int i =0; i < PeakMap.size(); i++) - { - out << PeakMap[i] ; - } - out << endl; - out << " PMSize = " << PeakMap.size() << endl; -} - -void SamRead::writeVertical() -{ - cout << "ParentHashes size = " << ParentHashes.size() << "RefAltCounts size " << RefAltCounts.size() << endl; - cout << name << endl; - cout << " flag = " << flag << endl; - cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - cout << " cigar = " << cigar << endl; - cout << " Alignments = " << alignments.size() << endl; - cout << " AlignScore = " << AlignScore << endl; - for (int i =0; i < seq.size(); i++){ - - cout << seq.c_str()[i] << "\t" << qual.c_str()[i] << "\t" << cigarString.c_str()[i] << "\t" << RefSeq.c_str()[i] << "\t" << ChrPositions[i] << "\t" << Positions[i] << "\t" << MutAltCounts[i] << "\t" << MutRefCounts[i] << "\t" << MutHashListCounts[i] << "\t" ; - cout << "\tParents"; - for (int pi=0; pi < RefAltCounts.size(); pi++){ - cout << "\t" << RefAltCounts[pi][i] << "\t" << RefRefCounts[pi][i]; - } - cout << "\t" << RefKmers[i] << "\t" << AltKmers[i]; - cout<< endl; - } -} -string compressVar(string line, int start, string& StructCall) -{ - cout << "compressing var" << endl; - char current = line.c_str()[0]; - int currentCount = 1; - string CV = ""; - for (int i = 1; i< line.size(); i++) - { - cout << current << endl; - if (line.c_str()[i] == current) - { - currentCount++; - } - else - { - if (currentCount > 2) - { - ostringstream convert; - convert << currentCount; - CV+=convert.str(); - CV+=current; - - ostringstream convertEND; - int end = currentCount+start; - convertEND << end; - - - if (current == 'Y') - { - cout << "YAAAY STRUCT" << endl; - StructCall = "SVTYPE=DUP;END="; - StructCall += convertEND.str(); - StructCall += ";SVLEN="; - StructCall += convert.str(); - StructCall += ";"; - cout << StructCall << endl; - } - } - else if (currentCount ==2) - { - CV+=current; - CV+=current; - } - else if (currentCount == 1) - { - CV+=current; - } - else - { - cout << "ERROR in compress " << current << " " << currentCount << endl; - } - - current = line.c_str()[i]; - currentCount = 1; - } - } - if (currentCount > 2) - { - ostringstream convert; - convert << currentCount; - CV+=convert.str(); - CV+=current; - - ostringstream convertEND; - int end = currentCount+start; - convertEND << end; - - - if (current == 'Y') - { - cout << "YAAAY STRUCT" << endl; - StructCall = "SVTYPE=DUP:TANDEM;END="; - StructCall += convertEND.str(); - StructCall += ";SVLEN="; - StructCall += convert.str(); - StructCall += ";"; - cout << StructCall << endl; - } - } - else if (currentCount ==2) - { - CV+=current; - CV+=current; - } - else if (currentCount == 1) - { - CV+=current; - } - else - { - cout << "ERROR in compress " << current << " " << currentCount << endl; - } - - return CV; -} -void SamRead::createPeakMap() -{ - vector tempPeakMap; - int i =0; - int max = -1; - int maxSpot = -1; - int last = 0; - for (int i =0; i< qual.size(); i++) - { - - if (qual[i] <='!') - { - //cout << "!"; - tempPeakMap.push_back(0); - } - else - { - //cout < '!' ) - { - // cout << qual[j] << "-" << j ; - if (max < qual[j]) - {max = qual[j];} - j++; - // cout << "max = " << (char) max << endl; - } - cout << endl; - j = j-1; - for ( int k = i; k < qual.size() and k <= j ; k++) - { - // cout << qual[k]; - if (qual[k]==max and cigarString[k] != 'H') - tempPeakMap.push_back(1); - else - tempPeakMap.push_back(0); - } - //cout << endl; - //not sure why I need this, figure it out - //tempPeakMap.push_back(0); - i = j; - } - /*if (qual[i] <='!') - { - //cout << "!"; - tempPeakMap.push_back(0); - } - else - { - //cout < '!' ) - { - // cout << qual[j] << "-" << j ; - if (max < qual[j]) - {max = qual[j];} - j++; - // cout << "max = " << (char) max << endl; - } - cout << endl; - j = j-1; - for ( int k = i; k < qual.size() and k <= j ; k++) - { - // cout << qual[k]; - if (qual[k]==max and cigarString[k] != 'H') - tempPeakMap.push_back(1); - else - tempPeakMap.push_back(0); - } - //cout << endl; - //not sure why I need this, figure it out - //tempPeakMap.push_back(0); - i = j; - }*/ - } - - // I hate one time corrections, but here on is to correct if ther is a del - for (int i =0; i< qual.size(); i++) - { - if (seq[i] == '-'){ - tempPeakMap[i] == tempPeakMap[i-1]; - } - } - - PeakMap.clear(); - PeakMap = tempPeakMap; - //cout << "done with peak map " << endl; -} -/*void SamRead::createPeakMap() -{ -// cout << "crateing PeakMap" << endl; - vector tempPeakMap; - int i =0; - int max = -1; - int maxSpot = -1; - while (i '!') - AnyBasesOver0 = true; - if (PeakMap[i] == 1) - Denovo = "DeNovo"; - - for(int j = 0; j< cigarString.size() - i; j++) - { - if(cigarString.c_str()[i+j] == 'X' or cigarString.c_str()[i+j] == 'D' or cigarString.c_str()[i+j] == 'I' or cigarString.c_str()[i+j] == 'Y' /*or cigarString.c_str()[i+j] == 'S' or cigarString.c_str()[i+j] == 'H'*/) - { - size = j; - if (qual.c_str()[i+j] > '!') - AnyBasesOver0 = true; - if (PeakMap[i+j] == 1) - Denovo = "DeNovo"; - - } - else //if (qual.c_str()[i+j] == '!') - break; - } - cout << "size =" << size<< endl; - - if (AnyBasesOver0) //enabling this will only report varites covered by hashes - { - - if ( cigarString.c_str()[i] == 'I' or cigarString.c_str()[i] == 'D' or cigarString.c_str()[i] == 'Y' /*or cigarString.c_str()[i] == 'S' or cigarString.c_str()[i] == 'H'*/) - { - for (int k = 1; i-k >= 0; k++) - { - if (ChrPositions[i-k] == "nope") - {} - else - { - reff+=RefSeq.c_str()[i-k]; - alt+=seq.c_str()[i-k]; - startPos = i-k; - break; - } - } - } - - /////////build the alleles and var type///////// - for(int j = 0; j<= size; j++) - { - if (RefSeq.c_str()[i+j] == 'A' or RefSeq.c_str()[i+j] == 'C' or RefSeq.c_str()[i+j] == 'G' or RefSeq.c_str()[i+j] == 'T') - reff+=RefSeq.c_str()[i+j]; - if (seq.c_str()[i+j] == 'A' or seq.c_str()[i+j] == 'C' or seq.c_str()[i+j] == 'G' or seq.c_str()[i+j] == 'T') - alt+=seq.c_str()[i+j]; - varType += cigarString.c_str()[i+j]; - } - //***********check that the alese are only baess************** - bool good = true; - for (int j = 0; j ParRefModes; - vector ParAltModes; - vector HashCounts; - vector HashCountsOG; - int PossibleAltKmer=0; - GetModes(i, alt, reff, MutRefMode, MutAltMode, ParRefModes, ParAltModes, HashCounts, HashCountsOG, PossibleAltKmer); - int SupportingHashes = GetSupportingHashCount(i, alt, reff); - string Genotype = ShittyGenotyper(MutAltMode, MutRefMode); - string CompressedVarType = compressVar(varType, Positions[startPos], StructCall); - cout << chr << "\t" << pos+i << "\t" << CompressedVarType /*"."*/ << "\t" << reff << "\t" << alt << "\t" << SupportingHashes << "\t" << varType << "\t" << "." << "\t" << "." << "\t" << "." << endl; - ////////////////generatre parent genotypes and check/////////////////////// - vector ParGenotypes; - for (int p = 0; p< ParRefModes.size(); p++) - { - ParGenotypes.push_back(ShittyGenotyper(ParAltModes[p], ParRefModes[p]) ); - } - - cout << endl; - ////////////////check that parents have enough coverage//////////////////// - cout << "PAR LOW COV CHECK" << endl; - int NumLowCov = 0; - int low = i-HashSize-10; - if (low < 0) - low = 0; - - for(int k = low ; k <= i+10 and k < hashes.size(); k++) - { - for (int j = 0; j < 2 /*parentCounts.size()*/; j++) - { - int sum = 0; - if (hashesRef[k] == hashes[k]) - {sum = parentCountsReference[j][k];cout < 0 ) - { - NumLowCov++; - cout << "\tLOWCOV" << NumLowCov ; - } - } - cout << endl; - - } - //////////////////////////////check if the parenst contain any of mut hashes////////////////////////////////////////// - bool LowCov = false; - int lowCount = 0; - low = i - HashSize ; - if (low < 0){low = 0;} - cout << "checking bases " << low << " to " << i+size+5 << endl; - for(int j = low; j <= i+size and j < hashes.size(); j++) - { - if (hashesRef[j] != hashes[j]) - { - for (int k = 0; k < 2 /*parentCounts.size()*/; k++) - { - cout << "Checking Par Hash " << hashes[j] << "\t" << parentCounts[k][j] << "\t" << hashesRef[j] << "\t" << parentCountsReference[k][j]; - float varFreq = 1; - if (parentCountsReference[k][j] > 0) - { - varFreq = (double)parentCounts[k][j]/((double)parentCountsReference[k][j] + (double)parentCounts[k][j]); - } - cout << "\tvarFreq=" << varFreq<= 1 and parentCounts[k][j] <= 10 and varFreq > .02 )//and parentCountsReference[k][j]<150 ) //if (parentCounts[k][j] <= 5 and parentCounts[k][j] > 0 ) - { - if ((ExcludeHashes[HashToLong(hashes[j])]<1 and ExcludeHashes[HashToLong(RevComp(hashes[j]))]<1)) - { - cout << " LC HASH FOUND" << endl; - LowCov = true; - lowCount++; - } - else - { cout << " HASH FOUND IN REF " << hashes[j] << " - " << ExcludeHashes[HashToLong(hashes[j])] << " - " << ExcludeHashes[HashToLong(RevComp(hashes[j]))] << endl;} - } - } - } - } - ///////////////////final filter check///////////////////////////////////////// - string Filter = "."; - string InfoFilter = ""; - if (Genotype.find("1") == std::string::npos) { - Denovo = "Mosaic"; - } - if (AlignmentSegments > 10) - { - Denovo = "PoorAlignment"; - stringstream ss; - ss << AlignmentSegments; - Denovo += ss.str(); - if (Filter == ".") - Filter = ""; - Filter+="PA"; - InfoFilter+="PA"; - InfoFilter+=ss.str(); - InfoFilter+=","; - Filter+=";"; - } - if (NumLowCov > 3) - { - Denovo = "ParLowCovRegion"; - cout << "ParLowCov " << NumLowCov << endl; - if (Filter == ".") - Filter = ""; - stringstream ss; - ss << NumLowCov; - Filter+="PLC"; - InfoFilter+="PLC"; - InfoFilter+=ss.str(); - Filter+=";"; - InfoFilter+=","; - } - //if (LowCov) - if (lowCount >=2) - { - cout << "LOW COVERAGE" << endl; - Denovo = "LowCov"; - stringstream ss; - ss << lowCount; - Denovo += ss.str(); - if (Filter == ".") - Filter = ""; - Filter+="LCH"; - InfoFilter+="LCH"; - InfoFilter+=ss.str(); - Filter+=";"; - InfoFilter+=","; - } - else - cout << "GOOD COVERAGE" << endl; - if (StrandBias >= 0){ - - if (StrandBias >0.9 or StrandBias < 0.1) - { - Denovo = "StrandBias"; - stringstream ss; - ss << StrandBias; - if (Filter == ".") - Filter = ""; - Filter+="SB"; - InfoFilter+="SB"; - InfoFilter+=ss.str(); - Filter+=";"; - InfoFilter+=","; - } - } - if (Denovo == "DeNovo" and Filter == ".") - Filter = "PASS"; - if (InfoFilter=="") - InfoFilter="PASS"; - - for (int p = 0; p< ParRefModes.size(); p++) - { - //if (ParGenotypes[p].find("1") != std::string::npos) { - //Denovo = "PresentInParents"; } - } - /////////////////////////////////////////////////////// - cout << "startpos = " << startPos << " chrsize = " << ChrPositions.size() << endl; - cout << ChrPositions[startPos] << "\t" << endl; - cout << Positions[startPos] << "\t" << endl; - cout << CompressedVarType <<"-" << endl; - cout << Denovo /*"."*/ << "\t" << endl; - cout << reff << "\t" << endl; - cout << alt << "\t" << endl; - cout << SupportingHashes << "\t" << endl; - cout << Filter << "\t" << endl; - cout << StructCall << endl; - cout <<"RN=" << name << endl; - cout << ";MQ=" << mapQual << endl; - cout << ";cigar=" << cigar << endl; - cout << ";" << "CVT=" << CompressedVarType << ";HD=" << endl; - - double Score = ((double)SupportingHashes/(double)PossibleAltKmer) * 100.0; - ////////////////////////Writing var out to file///////////////////////// - cout << ChrPositions[startPos] << "\t" <= 48 and cigar.c_str()[i] <= 57) - num = num + cigar.c_str()[i]; - else - { - int number = atoi(num.c_str()); - for(int j = 0; j < number; j++) - {cigarString += cigar.c_str()[i];} - num = ""; - } - } - -} -void SamRead::FixTandemRef() -{ - cout << "FOUND TANDEM" << endl; - write(); - //writeVertical(); - string lastChr = "nope"; - int lastPos = -1; - string NewRef = ""; - for (int i = 0; i NewPositions; - vector NewChromosome; - int InsOffset = 0; - - if ( Reff.sequenceNameStartingWith(chr) == "") //come back to, need to check if chr is in reference - { - cout << "ERROR chr " << chr << " not found\n"; - return; - } - - //correct star position of the read to account for Hard and soft clipped bases as we are counting those now - for (int i = 0; i< cigarString.size(); i++) - { - if (cigarString.c_str()[i]== 'H') - {} - else - { - pos = pos-i; - break; - } - } - for (int i = 0; i< cigarString.size(); i++) - { - if (cigarString.c_str()[i]== 'S') - {} - else - { - pos = pos-i; - break; - } - } - - - - - int Roffset = 0; - int Coffset = 0; - for (int i =0; i blank; - - - - //**********************************************************************// - CountAlignmentSegments(); - cout << "After getRefSeq"; - //FullOutwriteVertical(); -} - -void SamRead::LookUpKmers() -{ - cout << "SeqSize = " << seq.size() << " RefSize = " << RefSeq.size() << endl; - vector blank; - RefAltCounts.clear(); - RefRefCounts.clear(); - MutHashListCounts.clear(); - MutAltCounts.clear(); - MutRefCounts.clear(); - RefKmers.clear(); - AltKmers.clear(); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - RefAltCounts.push_back(blank); - RefRefCounts.push_back(blank); - } - for (int j = 0; j 0 ){ - MutAltCounts.push_back(MutantHashes[HashToLong(hash)]); - } - else - MutAltCounts.push_back(-1); - - for (int pi = 0; pi < ParentHashes.size(); pi++){ - if (ParentHashes[pi].count(HashToLong(hash)) > 0){ - RefAltCounts[pi].push_back(ParentHashes[pi][HashToLong(hash)]); - } - else - RefAltCounts[pi].push_back(-1); - } - } - - if (Hash.count(hash) > 0){ - MutHashListCounts.push_back(Hash[hash]); - } - else - MutHashListCounts.push_back(-1); - - - } - else{ - MutAltCounts.push_back(-3); - MutHashListCounts.push_back(-3); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - RefAltCounts[pi].push_back(-3); - } - } - - if(Refhash != ""){ - if (MutantHashes.count(HashToLong(Refhash)) > 0 ) - { - MutRefCounts.push_back(MutantHashes[HashToLong(Refhash)]); - } - else - MutRefCounts.push_back(-1); - - for (int pi = 0; pi < ParentHashes.size(); pi++){ - if (ParentHashes[pi].count(HashToLong(Refhash)) > 0){ - RefRefCounts[pi].push_back(ParentHashes[pi][HashToLong(Refhash)]); - } - else - RefRefCounts[pi].push_back(-1); - } - - } - else{ - - MutRefCounts.push_back(-3); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - RefRefCounts[pi].push_back(-3); - } - } - - } - cout << "donezo" << endl; -} -void SamRead::parse(string read) -{ - - cout << "parsing " << read << endl; - vector temp = Split(read, '\t'); - cout << "boom" << endl; - name = temp[0]; - cout << "name " << name; - flag = atoi(temp[1].c_str()); - chr = temp[2]; - pos = atoi(temp[3].c_str()); - mapQual = atoi(temp[4].c_str()); - cigar = temp[5]; - seq = temp[9]; - if (temp[10] == "*") - { - cout << "correcting missing qualtiy" << endl; - string newQual = ""; - for (int i = 0; i < seq.size(); i++) - { - newQual+='5'; - } - temp[10] = newQual; - } - qual = temp[10]; - alignments.clear(); - - UsedForBigVar = false;UsedForBigVar = false; - first = true; - combined = false; - string NewSeq = ""; - for (int i = 0; i < seq.size(); i++) - NewSeq+=toupper(seq.c_str()[i]); - - seq = NewSeq; - - processCigar(); - cout << "working on strand bias" << endl; - cout << temp[0] << endl; - vector temp2 = Split(name, ':'); - if (temp2.size() >= 2){ - cout << "break it down " << endl; - strands = temp2[1]; - cout << "strands = " << strands << endl; - forward = 0; - reverse = 0; - forward = atoi(temp2[1].c_str()); - reverse = atoi(temp2[2].c_str()); - cout << "forward = " << forward << endl; - cout << "reverse = " << reverse << endl; - StrandBias = ((float)forward)/((float)forward+(float)reverse); - cout << "strand bias = " << StrandBias << endl; - } - else{ - cout << "no strand data " << temp2.size() << endl; - strands = ""; - StrandBias = -1; - forward = -1; - reverse = -1; - } - AlignScore = 0; - for (int i = 11; i< temp.size(); i++){ - vector astemp = Split(temp[i], ':'); - if (astemp[0] == "AS"){ - AlignScore = atoi(astemp[2].c_str()); - } - } - cout << "getting flag bits " << endl; - for (int j = 0; j < 16; ++j){ - FlagBits [j] = 0 != (flag & (1 << j)); - } - cout << "Read Pared = " << FlagBits[0] << endl; - cout << "read mapped in proper pair = " << FlagBits[1] << endl; - cout << "read unmapped = " << FlagBits[2] << endl; - cout << "mate unmapped = " << FlagBits[3] << endl; - cout << "read reverse strand = " << FlagBits[4] << endl; - cout << "mate referse strand = " << FlagBits[5] << endl; - cout << "first in pair =" << FlagBits[6] << endl; - cout << "second in pair =" << FlagBits[7] << endl; - cout << "not primary alignment =" << FlagBits[8] << endl; - cout << "read fails platform or vendor quality checks =" << FlagBits[9] << endl; - cout << "read is PCR or optical duplicate =" << FlagBits[10] << endl; - cout << "supplementary alignment =" << FlagBits[11] << endl; -} -int findBreak(SamRead& read) -{ - char Afirst = read.cigarString.c_str()[0]; - - - cout << "Afirst = " << Afirst << endl; - cout << "starting A check " << endl; - if (Afirst == 'H' or Afirst == 'S') - { - cout << "forward" << endl; - for (int i =0; i < read.seq.size(); i++) - { - if (read.cigarString.c_str()[i] == 'H' or read.cigarString.c_str()[i] == 'S') - { - //keep going - cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i]<< endl; - } - else - { - cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i] << endl; - cout << "fond break at " << i << endl; - return i; - } - } - } - else - { - cout << "reverse" << endl; - for (int i = read.seq.size()-1; i >= 0; i += -1) - { - if (read.cigarString.c_str()[i] == 'H' or read.cigarString.c_str()[i] == 'S') - { - cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i] << endl; - //keep going - } - else - { - cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i] << endl; - cout << "fond break at " << i << endl; - return i; - } - } - } - - -} -SamRead BetterWay(vector reads) -{ - cout << "In BetterWay" << endl; - int A = 0; - int B = 1; - //cout << "B = " << B << endl; - cout << "Working on " << reads[A].name << ", size = " << reads[B].pos -reads[A].pos << endl; - vector> AlignmentPos; - vector> AlignmentChr; - int ALastGoodRef = -1; - string ALastGoodChr = "nope"; - int BLastGoodRef = -1; - string BLastGoodChr = "nope"; - - - vector NewSeqs; - vector NewQuals; - vector NewRefs; - vector NewCigars; - - for(int i = 0; i currentPos; - vector currentChr; - //need to get all the reads lined up with the same number of bases, taking account of I's and D's that change length// - if (reads[A].cigarString.c_str()[Acount] == 'D' and reads[B].cigarString.c_str()[Acount] != 'D') - { - currentPos.push_back(reads[A].Positions[Acount]); - currentPos.push_back(-1); - - currentChr.push_back(reads[A].ChrPositions[Acount]); - currentChr.push_back("nope"); - - ALastGoodRef = reads[A].Positions[Acount]; - ALastGoodChr = reads[A].ChrPositions[Acount]; - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - - NewSeqs[B]+='-'; - NewQuals[B]+='!'; - NewRefs[B]+="-"; - NewCigars[B]+='R'; - } - else if (reads[A].cigarString.c_str()[Acount] != 'D' and reads[B].cigarString.c_str()[Acount] == 'D') - { - currentPos.push_back(-1); - currentPos.push_back(reads[B].Positions[Bcount]); - - currentChr.push_back("nope"); - currentChr.push_back(reads[B].ChrPositions[Bcount]); - - BLastGoodRef = reads[B].Positions[Bcount]; - BLastGoodChr = reads[B].ChrPositions[Bcount]; - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - - NewSeqs[A]+='-'; - NewQuals[A]+='!'; - NewRefs[A]+='-'; - NewCigars[A]+='R'; - } - else - { - if (reads[A].cigarString.c_str()[Acount] == 'H' or reads[A].cigarString.c_str()[Acount] == 'S') - { - currentPos.push_back(-1); - currentChr.push_back("nope"); - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - - } - else if (reads[A].cigarString.c_str()[Acount] == 'M' or reads[A].cigarString.c_str()[Acount] == 'X' or reads[A].cigarString.c_str()[Acount] == 'D') - { - currentPos.push_back(reads[A].Positions[Acount]); - currentChr.push_back(reads[A].ChrPositions[Acount]); - ALastGoodRef = reads[A].Positions[Acount]; - ALastGoodChr = reads[A].ChrPositions[Acount]; - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - } - else if (reads[A].cigarString.c_str()[Acount] == 'I') - { - currentPos.push_back(ALastGoodRef); - currentChr.push_back(ALastGoodChr); - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - } - else - cout << "WTF, cigar = " << reads[A].cigarString.c_str()[Acount]; - - - - if (reads[B].cigarString.c_str()[Bcount] == 'H' or reads[B].cigarString.c_str()[Bcount] == 'S') - { - currentPos.push_back(-1); - currentChr.push_back("nope"); - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - } - else if (reads[B].cigarString.c_str()[Bcount] == 'M' or reads[B].cigarString.c_str()[Bcount] == 'X' or reads[B].cigarString.c_str()[Bcount] == 'D') - { - currentPos.push_back(reads[B].Positions[Bcount]); - currentChr.push_back(reads[B].ChrPositions[Bcount]); - BLastGoodRef = reads[B].Positions[Bcount]; - BLastGoodChr = reads[B].ChrPositions[Bcount]; - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - } - else if (reads[B].cigarString.c_str()[Bcount] == 'I') - { - currentPos.push_back(BLastGoodRef); - currentChr.push_back(BLastGoodChr); - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - } - else - cout << "WTF, cigar = " << reads[B].cigarString.c_str()[Bcount]; - - } - AlignmentPos.push_back(currentPos); - AlignmentChr.push_back(currentChr); - } - - //write - for (int i =0; i< reads.size(); i++) - { - reads[i].Positions.clear(); - reads[i].ChrPositions.clear(); - reads[i].seq = NewSeqs[i]; - reads[i].qual = NewQuals[i]; - reads[i].RefSeq = NewRefs[i]; - reads[i].cigarString = NewCigars[i]; - for (int j = 0; jNewPos; - vector NewChr; - - char LastAlignedQ = ' '; - int LastAlignedPos = -1; - string LastAlignedChr = "nope"; - - - //set LastAlignedPos to the first base with an aligned base - bool notfound = true; - int base = 0; - while (notfound) - { - for (int i = 0; i< reads.size(); i++) - { - if (reads[i].Positions[base] > -1) - { - LastAlignedPos = reads[i].Positions[base]; - LastAlignedChr = reads[i].ChrPositions[base]; - notfound = false; - break; - } - } - if (notfound) - base++; - } - for (int i =0; i < base; i++) - { - - NewCigar += reads[A].cigarString.c_str()[i]; - NewSeq +=reads[A].seq.c_str()[i]; - NewQual += reads[A].qual.c_str()[i]; - NewRef+= reads[A].RefSeq.c_str()[i]; - NewPos.push_back(reads[A].Positions[i]); - NewChr.push_back(reads[A].ChrPositions[i]); - } - //corect qualites so everyone has the same ones, H will produce no quality - cout << "checking quals" << endl; - string bestQual = reads[0].qual; - for (int i =0; i -1) //if this base is aligned in A - { - if (reads[A].Positions[i] - LastAlignedPos > 1) //indicates a deletion - { - if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!' ) - { - cout << "well fuck this shit A" << endl; - return reads[A]; - } - //if(reads[A].ChrPositions[i] == LastAlignedChr and abs(reads[A].Positions[i] -LastAlignedPos ) < MaxVarentSize ) //must be on the same chromosome - if(reads[A].chr == reads[B].chr and abs(reads[A].Positions[i] -LastAlignedPos ) < MaxVarentSize ) //must be on the same chromosome - { - cout << "wel this dosnt make any sense" << endl; //reads are in order in the bam so A should always be downstream of B, theus the deletion shoould be detected in B - BEDBigStuff << reads[A].chr << "\t" << LastAlignedPos << "\t" << reads[A].Positions[i] << "\t" << "Deletion" << endl; - for (int j = LastAlignedPos; j= MaxVarentSize ) - if( reads[A].chr == reads[B].chr and abs(reads[A].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Too Big, Same strand and chr "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0 ) - { - cout << "INVERSION written to file" << endl; - Translocations << "Possible mob event "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "mobil elemnt " << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Translocataion, same strand "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "we got a translocation" << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - } - } - } - else if (reads[A].Positions[i] -LastAlignedPos < 0 and abs(reads[A].Positions[i] -LastAlignedPos ) < MaxVarentSize) // indicates a possible insertion or tandem duplication - { - if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!') - { - cout << "well fuck this shit B" << endl; - return reads[A]; - } - cout << "this could be one A, last = " << LastAlignedPos << " Current = " << reads[A].Positions[i] << " chr = " << LastAlignedChr << " and " << reads[A].ChrPositions[i] << endl; -// if (reads[A].ChrPositions[i] == LastAlignedChr ) - if (reads[A].chr == reads[B].chr ) - { - cout << "This is an insertion A at base " << i << endl; - BEDBigStuff << reads[A].chr << "\t" << reads[A].Positions[i] << "\t" << LastAlignedPos << "\tTandemDup" << endl; - cout << "tadem dup" << endl; - int j = 0; - for( j = i; j=0; k+= -1) - { - if (reads[A].Positions[k]+1 > 1) - break; - } - //cout << "j= " << reads[A].Positions[k]+1 << " < " << LastAlignedPos << " - " << endl; - for( j = reads[A].Positions[k]+1; j < LastAlignedPos; j++) - { - NewCigar += 'Y'; //'I'; - NewSeq += toupper(Reff.getSubSequence(reads[A].chr, j, 1).c_str()[0]); - NewQual += '!'; - NewRef+= '-'; - NewPos.push_back(j); - NewChr.push_back(reads[A].chr); - } - cout << "yaya finished" << endl; - - } - else - { - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Possible mob event "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - //if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - //{ - // Translocations << "mobil elemnt " << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - //} - } - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Translocation, same strand "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "we got a translocation" << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - - } - else if( reads[A].Positions[i] -LastAlignedPos < 0 and abs(reads[A].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - { - if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!') - { - cout << "well fuck this shit C" << endl; - - return reads[A]; - } - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - if (reads[A].chr == reads[B].chr) - Translocations << "TOO BIG 3 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - else - Translocations << "Translocation 3 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - - - if (i -1) - { - if (reads[B].Positions[i] - LastAlignedPos > 1) - { - if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!') - { - - cout << "well fuck this shit D" << endl; - - return reads[A]; - } - //if(reads[B].ChrPositions[i] == LastAlignedChr and abs(reads[B].Positions[i] - LastAlignedPos ) < MaxVarentSize ) - if(reads[B].chr == reads[A].chr and abs(reads[B].Positions[i] - LastAlignedPos ) < MaxVarentSize ) - { - cout << "striahgtup deletion, size = " << abs(reads[B].Positions[i] -LastAlignedPos ) << " at base " << i << " from Position " << LastAlignedPos << " to " << reads[B].Positions[i] << endl; - BEDBigStuff << reads[B].chr << "\t" << LastAlignedPos << "\t" << reads[B].Positions[i] << "\t" << "Deletion" << endl; -// cout << "Inserting reff sequence from " << LastAlignedPos+1 << " to " << reads[B].Positions[i] << " = " << reads[B].Positions[i]-LastAlignedPos << endl; - for (int j = LastAlignedPos; j< reads[B].Positions[i]-1; j++) - { - //cout << j << " - " << j - LastAlignedPos<< endl; - NewCigar += 'D'; - NewSeq += '-'; - NewQual += LastAlignedQ; - NewRef+= toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); - NewPos.push_back(j); - NewChr.push_back(reads[B].ChrPositions[i]); - - // char tmp = toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); - // cout << "R " << '-' << " " << 'D' << " " << tmp << " " << reads[B].chr << " " << j << " " << NewSeq << endl; - // cout << "R " << '-' << " " << 'D' << " " << tmp << " " << reads[B].chr << " " << j << " " << NewRef << endl << endl; - } - } - else - { - // if( reads[A].ChrPositions[i] == LastAlignedChr and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - if( reads[A].chr == reads[B].chr and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "TOO BIG 2 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Possible mob event "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "mobil elemnt " << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Translocation 2 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - - - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "we got a translocation" << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - } - } - - } - else if (reads[B].Positions[i] -LastAlignedPos < 0 and abs(reads[B].Positions[i] - LastAlignedPos ) < MaxVarentSize) // indicates a possible insertion or tandem duplication - { - if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!' ) - { - cout << "well fuck this shit E" << endl; - - return reads[A]; - } - // cout << "this could be one B, last = " << LastAlignedPos << " Current = " << reads[B].Positions[i] << " chr = " << LastAlignedChr << " and " << reads[B].ChrPositions[i] << endl; - //if (reads[B].ChrPositions[i] == LastAlignedChr - if (reads[B].chr == reads[A].chr ) - { - cout << "This is an insertion B at base " << i << endl; - - BEDBigStuff << reads[B].chr << "\t" << reads[B].Positions[i] << "\t" << LastAlignedPos << "\tTandemDup" << endl; - // cout << "tadem dup" << endl; - int j = 0; - for(j = i; j < reads[B].seq.size() and reads[B].Positions[j] <= LastAlignedPos; j++) - { - NewCigar += 'Y'; - NewSeq += reads[B].seq.c_str()[j]; - NewQual += reads[B].qual.c_str()[j]; - NewRef+= '-'; - NewPos.push_back(reads[B].Positions[i]); - NewChr.push_back(reads[B].ChrPositions[i]); - } - i=j; - //need to find last base that was alinged, insetion can mess this up so you can just take the last base pos - int k; - for (k =reads[B].Positions.size()-1; k >=0; k+= -1) - { - if (reads[B].Positions[k]+1 > 1) - break; - } - //cout << "j= " << reads[B].Positions[k]+1 << " < " << LastAlignedPos << " - " << endl; - for( j = reads[B].Positions[k]+1; j < LastAlignedPos; j++) - { - NewCigar += 'Y'; - NewSeq += toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); - NewQual += '!'; - NewRef+= '-'; - NewPos.push_back(j); - NewChr.push_back(reads[B].chr); - } - - } - else - { - cout << "we got a translocation" << endl; - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - cout << "mobil elemnt " << endl; - //reads[A].write(); - //reads[B].write(); - } - } - - } - else if( reads[B].Positions[i] -LastAlignedPos < 0 and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - { - if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!') - { - cout << "well fuck this shit F" << endl; - return reads[A]; - } - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - - - - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "TOO BIG 1 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - - - if(i=0; i--) - { - if(NewCigar.c_str()[i] != 'S' and NewCigar.c_str()[i] != 'H') - { - Last = i; - break; - } - } - - for (int i = 0; i First and i < Last) - { - if (NewCigar.c_str()[i] == 'S' or NewCigar.c_str()[i] == 'H') - NewNewCigar+= 'I'; - else - NewNewCigar+=NewCigar.c_str()[i]; - } - else - NewNewCigar+=NewCigar.c_str()[i]; - - } - NewCigar = NewNewCigar; - - int UnalignedCount = 0; - for (int i =0; i 0 and Bbreak > 0 - if( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1) and ( reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "INVERSION" << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - string Acig = ""; - string Bcig = ""; - for (int i = 0; i < reads[A].seq.size(); i++) - { - char Ab = reads[A].cigarString.c_str()[i]; - char Bb = reads[B].cigarString.c_str()[i]; - if ((reads[A].cigarString.c_str()[i] == 'M' or reads[A].cigarString.c_str()[i] == 'X') and (reads[B].cigarString.c_str()[i] == 'S' or reads[B].cigarString.c_str()[i] == 'H')) - Bb = 'U'; - if ((reads[B].cigarString.c_str()[i] == 'M' or reads[B].cigarString.c_str()[i] == 'X') and (reads[A].cigarString.c_str()[i] == 'S' or reads[A].cigarString.c_str()[i] == 'H')) - Ab = 'U'; - Acig += Ab; - Bcig += Bb; - - } - reads[A].cigarString = Acig; - reads[B].cigarString = Bcig; - cout << "invertion adjust string"; - reads[A].write(); - reads[B].write(); - } - else if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - - - - cout << " if( "< 0 and Bbreak > 0 - if( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1) and ( reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0) - { - Translocations << "mobil elemnt inverted" << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - } - else - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - - - - cout << " if( "< 0 and Bbreak > 0 - if( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1) and ( reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0) - { - Translocations << "we got a translocation and invertion" << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - } - - - cout << "*********SKIPPING************\ndifference strands" << endl; - BEDNotHandled << "Different strands" << endl; - BEDNotHandled << reads[A].chr << "\t" << reads[A].pos << "\t" << reads[A].pos+reads[A].seq.size() << "\t" << reads[A].name << "\t" << reads[A].cigar << endl; - reads[A].writetofile(BEDNotHandled); - BEDNotHandled << reads[B].chr << "\t" << reads[B].pos << "\t" << reads[B].pos+reads[B].seq.size() << "\t" << reads[B].name << "\t" << reads[B].cigar << endl; - reads[B].writetofile(BEDNotHandled); - - BEDNotHandled << endl << endl; - - - Invertions << reads[A].chr << "\t" << reads[A].pos << "\t" << reads[B].pos << "\t" << reads[B].pos- reads[A].pos << endl; - - } - - //**********************Adding K-mer lookup stuff here ********************************* - - //************************************************************************************** - //reads[A].FixTandemRef(); - reads[A].LookUpKmers(); - cout << "ReAdjustedKmers" < longest){longest = count;} - count = 0; - } - - } - if (count > longest){longest = count;} - return longest; -} -bool SamRead::CheckEndsAlign() -{ - int StartAlign = 0; - int j; - for ( j = 10; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] != 'H' and cigarString.c_str()[j] != 'S') - {StartAlign++;} - else - {break;} - } - int EndAlign = 0; - int i; - for ( i = cigarString.size()-10; i>=0; i--) - { - if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') - {EndAlign++;} - else - {break;} - } - - if (StartAlign > 20 or EndAlign > 20) - { - return true; - } - -return false; -} - - -bool SamRead::StartsWithAlignAtPeak(int &pos, string &insert, int &Kdepth) -{ - cout << "starst with " << endl; - /////////////////// - int EndClip = 0; - int i; - int PeakBases = 0; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] == 'H' or cigarString.c_str()[i] == 'S') - {EndClip++;if (PeakMap[i]==1){PeakBases++;}} - else - {break;} - } - //get the inserted sequence - for (int s = i; s 40 && StartAlign > 40) - { - if ((PeakMap[i-1] or PeakMap[i] or PeakMap[i+1]) and (PeakMap[j-1] or PeakMap[j] or PeakMap[j+1])or PeakBases > 10) - {return true;} - } - - - return false; - } -bool SamRead::StartsWithAlign(int &pos, string &insert) -{ - cout << "starst with " << endl; - /////////////////// - int EndClip = 0; - int i; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] == 'H' or cigarString.c_str()[i] == 'S') - {EndClip++;} - else - {break;} - } - //get the inserted sequence - for (int s = i; s 40 && StartAlign > 40) - { - - {return true;} - } - - - return false; - } -bool SamRead::EndsWithAlignAtPeak(int &pos, string &insert, int &Kdepth) -{ - cout << "Running EndsWithAlign" << endl; - //////////////////// - int EndAlign = 0; - int i; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') - {EndAlign++;} - else - {break;} - } - pos = Positions[i+1]; - cout << "EndAlign = " << EndAlign << endl; - /////////////////// - int StartClip = 0; - int j; - int PeakBases = 0; - for ( j = 0; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] == 'H' or cigarString.c_str()[j] == 'S') - {StartClip++; if (PeakMap[j]==1){PeakBases++;}} - else - {break;} - } - cout << "StartClip = " << StartClip << endl; - - for (int s = 0; s 40 && StartClip > 40) - { - if ((PeakMap[i-1] or PeakMap[i] or PeakMap[i+1]) and (PeakMap[j-1] or PeakMap[j] or PeakMap[j+1])or PeakBases > 10 ) - {return true;} - } - - - return false; - } -bool SamRead::EndsWithAlign(int &pos, string &insert) -{ - cout << "Running EndsWithAlign" << endl; - //////////////////// - int EndAlign = 0; - int i; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') - {EndAlign++;} - else - {break;} - } - pos = Positions[i+1]; - cout << "EndAlign = " << EndAlign << endl; - /////////////////// - int StartClip = 0; - int j; - for ( j = 0; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] == 'H' or cigarString.c_str()[j] == 'S') - {StartClip++; } - else - {break;} - } - cout << "StartClip = " << StartClip << endl; - for (int s = 0; s 40 && StartClip > 40) - { - - {return true;} - } - - - return false; - } -int main (int argc, char *argv[]) -{ - -cout << "###########################RUNNING THIS ONE#########################" << endl; -cout << "Modes chr pos type reff alt MutRef MutAlt Par1Ref Par2Ref" << endl; -// ifstream testthis [100]; -// testthis[0].open("./test.txt"); -// string boom2; -// while (getline(testthis[0], boom2)) -// { -// cout << boom2 << endl; -// } -// return 0; - //************************************************ - //my arg parser - - string helptext; - helptext = \ -"\ -RUFUS.interpret: converts RUFUS aligned contigs into a VCF \n\ -By Andrew Farrell\n\ - The Marth Lab\n\ -\n\ -options:\ - -h [ --help ] Print help message\n\ - -sam argPath to input SAM file, omit for stdin\n\ - -r argPath to reference file \n\ - -hf argPath to HashFile from RUFUS.build\n\ - -hS argHash Size\n\ - -o argOutput stub\n\ - -m argMaximum varient size: default 1Mb\n\ -(Sorry it has to be a num, no 1kb, must be 1000\n\ - -c argPath to sorted.tab file for the parent sample\n\ - -s arg Path to sorted.tab file for the subject sample\n\ - -cR argPath to the sorted.tab file fo the parnt sample hashes in the reference\n\ - -sR argPath to the sorted.tab file fo the subject sample hashes in the reference\n\ - -mQ argMinimum map quality to consider varients in\n\ - -mod argPath to the model file from RUFUS.model\n\ - -e arg Path to Kmer file to exlude from LowCov check\n\ -"; - - string MutHashFilePath = "" ; - string MutHashFilePathReference = ""; - MaxVarentSize = 1000000; - string RefFile = ""; - string HashListFile = "" ; - string samFile = "stdin"; - string outStub= ""; - string ModelFilePath = ""; - string ExcludeFilePath = ""; - int MinMapQual = 0; - for(int i = 1; i< argc; i++) - { - cout << i << " = " << argv[i] << endl; - } - cout <<"****************************************************************************************" << endl; - vector ParentHashFilePaths; - vector ParentHashFilePathsReference; - for(int i = 1; i< argc; i++) - { - string p = argv[i]; - cout << i << " = " << argv[i]<< endl; - if( p == "-h") - { - //print help - cout << helptext << endl; - return 0; - } - else if (p == "-r") - { - RefFile = argv[i+1]; - i=i+1; - cout << "YAAAY added RefFile = " << RefFile << endl; - } - else if (p == "-sam") - { - samFile = argv[i+1]; - i++; - } - else if (p == "-o") - { - outStub = argv[i+1]; - i++; - } - else if (p == "-hf") - { - HashListFile = argv[i+1]; - i++; - } - else if (p == "-hs") - { - HashSize = atoi(argv[i+1]); - i++; - } - else if (p == "-m") - { - MaxVarentSize = atoi(argv[i+1]); - i++; - cout << "YAAAY added MaxVarSize = " << MaxVarentSize << endl; - } - else if (p == "-c") - { - cout << "Par Hash = " << argv[i+1] << endl; - ParentHashFilePaths.push_back(i+1); - i=i+1; - } - else if (p == "-cR") - { - cout << "Par Ref Hash = " << argv[i+1] << endl; - ParentHashFilePathsReference.push_back(i+1); - i=i+1; - } - else if (p == "-s") - { - cout << "Sub Hash = " << argv[i+1] << endl; - MutHashFilePath = argv[i+1]; - i+=1; - } - else if (p == "-sR") - { - cout << "Sub Hash = " << argv[i+1] << endl; - MutHashFilePathReference = argv[i+1]; - i+=1; - } - else if (p == "-mod") - { - cout << "model file = " << argv[i+1] << endl; - ModelFilePath = argv[i+1]; - i+=1; - } - else if (p == "-mQ") - { - cout << "Min Mapping Qualtiy = " << argv[i+1] << endl; - MinMapQual = atoi(argv[i+1]); - i+=1; - } - else if(p == "-e") - { - cout << "Exclue File Path = " << argv[i+1] << endl; - ExcludeFilePath = argv[i+1]; - i+=1; - } - else - { - cout << "ERROR: unkown command line paramater -" << argv[i] << "-"<< endl; - return 0; - } - - } - //check values - if (RefFile == "") - { - cout << "ERROR Reference required" << endl; - return 0; - } - if (HashListFile == "") - { - cout << "Error HashList required" << endl; - return 0; - } - if (outStub == "") - { - if (samFile != "stdin") - outStub = samFile; - else - { - cout << "ERROR out file stub required " << endl; - return -1; - } - } - - for (int i = 0; i < ParentHashFilePaths.size(); i++) - { - ifstream reader; - reader.open (argv[ParentHashFilePaths[i]]); - string line = ""; - unordered_map hl; - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - hl[hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - hl[hash] = atoi(temp[1].c_str()); - } - ParentHashes.push_back(hl); - reader.close(); - } - for (int i = 0; i < ParentHashFilePathsReference.size(); i++) - { - ifstream reader; - reader.open (argv[ParentHashFilePathsReference[i]]); - string line = ""; - unordered_map hl; - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - ParentHashes[i][hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - ParentHashes[i][hash] = atoi(temp[1].c_str()); - } - reader.close(); - } - cout << "check parent thing" << endl; - for(int i =0; i < ParentHashes.size(); i++) - { - cout << "sample " << i << endl; - } - - ifstream reader; - reader.open (MutHashFilePath); - string line = ""; - while (getline(reader, line)) - { - - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - MutantHashes[hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - MutantHashes[hash] = atoi(temp[1].c_str()); - } - reader.close(); - - reader.open (MutHashFilePathReference); - line = ""; - while (getline(reader, line)) - { - - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - MutantHashes[hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - MutantHashes[hash] = atoi(temp[1].c_str()); - } - reader.close(); - - reader.open(ExcludeFilePath); - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - cout << "adding " << temp[0] << " with C=" << temp[1] << endl; - ExcludeHashes[hash] = atoi(temp[1].c_str()); - //hash = HashToLong(RevComp(temp[0])); - //ExcludeHashes[hash] = atoi(temp[1].c_str()); - } - reader.close(); - //*********************************************** - //cout << "Call is Reference Contigs.fa OutStub HashList MaxVarientSize" << endl; - double vm, rss, MAXvm, MAXrss; - MAXvm = 0; - MAXrss = 0; - process_mem_usage(vm, rss, MAXvm, MAXrss); - cout << "VM: " << vm << "; RSS: " << rss << endl; - - - int BufferSize = 1000; - - Reff.open(RefFile); - - ifstream ModelFile; - ModelFile.open (ModelFilePath); - if (ModelFile.is_open()) - { cout << "ModelFile is open";} - else - { - cout << "Error no model file given, not worring abou this now" << endl; - //return -1; - } - - ifstream HashList; - HashList.open (HashListFile); - if ( HashList.is_open()) - { cout << "HashList Open " << HashListFile << endl;} //cout << "##File Opend\n"; - else - { - cout << "Error, HashList could not be opened"; - return -1; - } - line = ""; - getline(HashList, line); - cout << "line = " << line << endl; - char seperator = '\t'; - vector temp = Split(line, seperator); - if (temp.size() ==1){ - cout << "separator is not tab" << endl; - seperator = ' '; - temp = Split(line, seperator); - } - else - cout << "separator is tab" << endl; - - cout << "split = " << temp[0] << " and " << temp[1] << endl; - HashSize = temp[0].size(); - if (temp.size() ==4) - { - HashSize = temp[3].length(); - Hash.insert(pair(temp[3], atoi(temp[2].c_str()))); - - while ( getline(HashList, line)) - { - vector temp = Split(line, seperator); - Hash.insert(pair(temp[3], atoi(temp[2].c_str()))); - Hash.insert(pair(RevComp(temp[3]), atoi(temp[2].c_str()))); - //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; - } - HashList.close(); - cout << "done with HashList" << endl; - } - else if (temp.size() ==2) - { - HashSize = temp[0].length(); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - Hash.insert(pair(RevComp(temp[0]), atoi(temp[1].c_str()))); - while ( getline(HashList, line)) - { - vector temp = Split(line, seperator); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; - } - HashList.close(); - cout << "done with HashList" << endl; - } - /*else if (temp.size() ==1) - { - vector temp = Split(line, ' '); - HashSize = temp[0].length(); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - Hash.insert(pair(RevComp(temp[0]), atoi(temp[1].c_str()))); - while ( getline(HashList, line)) - { - vector temp = Split(line, ' '); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - Hash.insert(pair(RevComp(temp[0]), atoi(temp[1].c_str()))); - //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; - } - HashList.close(); - cout << "done with HashList" << endl; - }*/ - //map::iterator it; - //for ( it = Hash.begin(); it != Hash.end(); it++ ) - //{ - // cout << "-"<first<<"-" << "\t" << it->second << endl; - //} - - ifstream SamFile; - if (samFile == "stdin") - { - cout << "Sam File is STDIN" << endl; - SamFile.open ("/dev/stdin"); - } - else - { - cout << "Sam File is " << samFile << endl; - SamFile.open (samFile); - } - if ( SamFile.is_open()) - { cout << "Sam File Opend\n";} - else - { - cout << "Error, SamFile could not be opened"; - return 0; - } - - string boom = outStub; - VCFOutFile.open(boom+ ".vcf"); - BEDOutFile.open(boom+ ".vcf.bed"); - boom = "TempOverlap/" + boom; - BEDBigStuff.open(boom+ ".vcf.Big.bed"); - BEDNotHandled.open(boom+ ".vcf.NotHandled.bed"); - Invertions.open(boom+".vcf.invertions.bed"); - Translocations.open(boom+ ".vcf.Translocations"); - Translocationsbed.open(boom+ ".vcf.Translocations.bed"); - Unaligned.open(boom+"vcf.Unaligned"); - - //write VCF header - VCFOutFile << "##fileformat=VCFv4.1" << endl; - VCFOutFile << "##fileDate=" << time(0) << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO="<"<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##FILTER=" << std::endl; - VCFOutFile << "##FILTER=" << std::endl; - VCFOutFile << "##FILTER=" << std::endl; - VCFOutFile << "##FILTER=" << std::endl; - VCFOutFile << "##ALT=" << std::endl; - VCFOutFile << "##ALT=" << std::endl; - - VCFOutFile << "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t"; - - string samplename = outStub.substr(0, outStub.find(".generator")); - VCFOutFile << samplename; - //VCFOutFile << outStub; - for(int i =0; i Names; - vector reads; - int counter = 0; - while (getline(SamFile, line)) - { - if (line.c_str()[0] == '@') - { - cout << " HEADER LINE = " << line << endl; - vector temp = Split(line, '\t'); - cout << temp[0] << endl; - if (temp[0] == "@SQ") - { - cout << temp[1] << endl; - vector chr = Split(temp[1], ':'); - vector len = Split(temp[2], ':'); - - cout << "##contig="<< endl; - VCFOutFile <<"##contig=" << endl; - } - } - else - { - cout << line << endl; - counter ++; - SamRead read; - cout << "parse " << endl; - read.parse(line); - //if (read.mapQual > 0) - if (read.FlagBits[2] != 1)//read.flag != 4) - { - cout << "RefSeq" << endl; - read.getRefSeq(); - cout << "peak" << endl; - read.createPeakMap(); - cout << "ummm" << endl; - int a; - string b; - cout << "Aligned bases = " << read.CheckBasesAligned() << endl; - if (read.CheckBasesAligned() > 50 or read.CheckEndsAlign()) - {reads.push_back(read);} - else - {cout << "SKIPPING Alignment" << endl; read.write();} - if (counter%100 == 0) - cout << "read " << counter << " entries " << char(13); - } - //else do I want to track unaliged alignments? - } - } - cout << endl; - cout << "Read in " << reads.size() << " reads " << endl; - - - // VCFOutFile << "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t"; - //VCFOutFile << outStub << endl; - - - cout << "procesing split reads" << endl; - for (int i = 0; i < reads.size(); i++) - { - cout << "processing read " << reads[i].name << endl; - if (reads[i].alignments.size() == 0) - { - reads[i].alignments.push_back(i); - int count = 0; - for (int j = i+1; j < reads.size(); j++) - { - count++; - if (strcmp(reads[i].name.c_str(), reads[j].name.c_str()) == 0 && reads[i].pos !=reads[j].pos) - { - cout << "found mate " << reads[j].name << endl; - - reads[i].alignments.push_back(j); - reads[j].first = false; - - } - if (count > 100000) - break; - } - } - for (int j = 0; j 1) - { - cout << "picking two best alignments" << endl; - map alignScores; - for (int j = 0; j < read.alignments.size(); j++){ - float score = (float) reads[read.alignments[j]].AlignScore; - while (not (alignScores.find(score) == alignScores.end())){ - score = score * 1.0001; - } - alignScores[score] = j; - } - vector goodPos; - std::map::reverse_iterator it; - for ( it = alignScores.rbegin(); it != alignScores.rend(); it++ ) - { - cout << it->first << " - " << it->second << endl; - goodPos.push_back(it->second); - } - cout << "atempting colaps" << endl; - cout << read.name << endl; - vector R; - - for(int j =0; j < read.alignments.size(); j++) //read.alignments.size(); j++) - { - //these better be sorted by position - //if (reads[read.alignments[j]].chr == read.chr) - if (j == goodPos[0] or j == goodPos[1]) - { - R.push_back(reads[read.alignments[j]]); - cout << reads[read.alignments[j]].name << endl; - } - } - - if (R.size() ==2 & /*R[0].chr == R[1].chr & */ R[0].mapQual > 0 or R[1].mapQual > 0) - { - read = BetterWay(R); - } - } - else if(read.first and read.alignments.size() >2) - { - BEDNotHandled << "too many alignments" << endl; - BEDNotHandled << read.chr << "\t" << read.pos << "\t" << read.pos+read.seq.size() << "\t" << read.name << "\t" << read.cigar << endl; - cout << "too many alignments" << endl; - cout << read.chr << "\t" << read.pos << "\t" << read.pos+read.seq.size() << "\t" << read.name << "\t" << read.cigar << endl; - for (int j = 0; j< read.alignments.size(); j++) - { - SamRead mate = reads[read.alignments[j]]; - cout << j << "\t" << mate.chr << "\t" << mate.pos << "\t" << mate.pos+mate.seq.size() << "\t" << mate.name << "\t" << mate.cigar << endl; - BEDNotHandled << mate.chr << "\t" << mate.pos << "\t" << mate.pos+mate.seq.size() << "\t" << mate.name << "\t" << mate.cigar << endl; - mate.writetofile(BEDNotHandled); - } - BEDNotHandled << endl << endl; - } - if (read.mapQual > MinMapQual and read.alignments.size() <=2) - { - read.parseMutations(argv); - } - } - } - cout << "lets start this" << endl; - //find big insertionsf - for (int i = 0; i < reads.size()-1; i++) - { - int pos, pos2, kdep, kdep2; - string InsStart, InsEnd; - if (reads[i].StartsWithAlign(pos, InsStart)) - { - - cout << "chekingBig " << endl; - reads[i].write(); - reads[i+1].write(); - if (reads[i].name != reads[i+1].name ){cout << "names are different" << endl; }else{cout << "NAMES ERROR" << endl;} - if (reads[i].alignments.size() == 1){cout << "primary alignemts are 1" << endl;}else{cout << "PRIAMRY ALIGNEMT ERRPR " << reads[i].alignments.size() << endl; } - if (reads[i].StrandBias < 0.9 and reads[i].StrandBias > 0.1) { cout << "Primary strand bias is good " << reads[i].StrandBias << endl; }else{cout << "STRAND BIAS ERROR " << reads[i].StrandBias << endl; } - if (reads[i+1].StrandBias < 0.9 and reads[i+1].StrandBias > 0.1) { cout << "Primary strand bias is good " << reads[i+1].StrandBias << endl; }else{cout << "STRAND BIAS ERROR " << reads[i+1].StrandBias << endl; } - if (reads[i+1].alignments.size() == 1){cout << "second alignemts are 1" << endl;}else{cout << "second ALIGNEMT ERRPR " << reads[i+1].alignments.size() << endl; } - if (reads[i+1].EndsWithAlign(pos2, InsEnd)){cout << "second ends with clip" << endl;}else{cout << "SECOND NOPT CLOPPED" << endl;} - if (reads[i].mapQual > 0 or reads[i+1].mapQual > 0){cout << "passed map qual" << endl; }else{cout << "failed map qual" << endl; } - if (reads[i].StartsWithAlignAtPeak(pos, InsStart, kdep)){cout << "primary starts with clip at peak " << endl;}else{cout << "PRIMARY DOES NOT START AT PEAK" << endl; } - if (reads[i+1].EndsWithAlignAtPeak(pos2, InsEnd, kdep2)){cout << "secondary align end with clip at peak" << endl;}else{cout << "SECONDARY DOES NOT START AT PEAK" << endl;} - - if (reads[i].name != reads[i+1].name and reads[i].alignments.size() == 1 and reads[i+1].alignments.size() == 1 and reads[i].StartsWithAlign(pos, InsStart) and reads[i+1].EndsWithAlign(pos2, InsEnd) and (reads[i].StartsWithAlignAtPeak(pos, InsStart, kdep) or reads[i+1].EndsWithAlignAtPeak(pos2, InsEnd, kdep2)) and (reads[i].mapQual > 0 or reads[i+1].mapQual > 0) and abs(pos -pos2) <100 ) - { - string D = "StrandBias"; - if ((reads[i+1].StrandBias < 1.0 and reads[i+1].StrandBias > 0.0) or (reads[i].StrandBias < 1.0 and reads[i].StrandBias > 0.0)) - D = "DeNovo"; - cout << reads[i].chr << "\t" << pos << "\t" << "LargeInsert" <<"-" << D /*"."*/ << "\t" << InsStart.c_str()[0] << "\t" << InsStart << "NNNNNNNNNNNNNNNNNNNN" << InsEnd << "\t" << kdep << "-" << kdep2 << "\t" << "." << "\t" << "INS" <<"RN=" << reads[i].name << ";MQ=" << reads[i].mapQual << ";cigar=" << reads[i].cigar << ";" << "RN=" << reads[i+1].name << ";MQ=" << reads[i+1].mapQual << ";cigar=" << reads[i+1].cigar << ";" <<"CVT=" << endl ; - VCFOutFile << reads[i].chr << "\t" << pos << "\t" << "LargeInsert" <<"-" << D /*"."*/ << "\t" << InsStart.c_str()[0] << "\t" << InsStart << "NNNNNNNNNNNNNNNNNNNN" << InsEnd << "\t" << kdep << "-" << kdep2 << "\t" << "." << "\t" << "INS" <<"RN=" << reads[i].name << ";MQ=" << reads[i].mapQual << ";cigar=" << reads[i].cigar << ";" << "RN=" << reads[i+1].name << ";MQ=" << reads[i+1].mapQual << ";cigar=" << reads[i+1].cigar << ";" << "CVT=" << ";Pos=" << pos << "-" << pos2 << "-" << pos2-pos; - - string Genotype = "0/1"; - int MutRefMode = 1; - int MutAltMode = 1; - int LP = 1; - int PC = 1; - int SB = 1; - VCFOutFile << "\tGT:DP:RO:AO:LP:PC:SB" << "\t" << Genotype << ":" << MutRefMode + MutAltMode << ":" << MutRefMode << ":" << MutAltMode << ":" << LP << ":" << PC << ":" << SB << endl; - - cout << "found INSERT " << endl; reads[i].write(); reads[i+1].write(); reads[i].writeVertical(); reads[i+1].writeVertical(); - } - } - } - VCFOutFile.close(); - BEDOutFile.close(); - BEDBigStuff.close(); - BEDNotHandled.close(); - Invertions.close(); - cout << "finishing RUFUS.Interpret for " << outStub << std::endl; - return 0; -} - diff --git a/src/RUFUS.interpret.onlytwoParents.cpp b/src/RUFUS.interpret.onlytwoParents.cpp deleted file mode 100644 index c98945f7..00000000 --- a/src/RUFUS.interpret.onlytwoParents.cpp +++ /dev/null @@ -1,3771 +0,0 @@ - -/*This vertion imcorporates both copy number and mutation detection in 1 - * * it needs to be run in two sptes, first the build, then the filter - * * it is split up to allow distribution to a cluster */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "externals/fastahack/Fasta.h" -#include -#include -#include -#include -#include - -#define NUMINTS (1000) -#define FILESIZE (NUMINTS * sizeof(int)) - -using namespace std; - -vector > ParentHashes; -unordered_map MutantHashes; -unordered_map ExcludeHashes; -FastaReference Reff; -int HashSize = 25; -int totalDeleted; -int totalAdded; -int MaxVarentSize = 1000; -ofstream VCFOutFile; -ofstream BEDOutFile; -ofstream BEDBigStuff; -ofstream BEDNotHandled; -ofstream Invertions; -ofstream Translocations; -ofstream Translocationsbed; -ofstream Unaligned; -map Hash; -///////////////////////// -const vector Split(const string& line, const char delim) { - vector tokens; - stringstream lineStream(line); - string token; - while ( getline(lineStream, token, delim) ) - tokens.push_back(token); - return tokens; -} -unsigned long HashToLong (string hash) -{ - bitset<64> HashBits; - for(int i=0; i stuff; - stuff = Split(line, '\t'); - string PageHash = stuff[0]; - // cout << "PageHash " << endl; - if (hash == PageHash) - { - // cout << "found a hash " << hash << " - " << PageHash; - return atoi(stuff[1].c_str()); - } - line = ""; - } - } - else if (firstNew == true) - { - // cout << "first Newline found" << endl; - line += data[i]; - } - - } - return 0; -} - -void ProcessPage( char *data, string& PageFirstHash, string& PageLastHash, long int pageSize) -{ - string line = ""; - bool firstNew = false;\ - for (int i = 0; i < pageSize; i++) - { - if (data[i] == '\n') - { - - if (firstNew == true) - break; - else - firstNew = true; - } - else if (firstNew == true) - line += data[i]; - } - - vector stuff; - stuff = Split(line, '\t'); - PageFirstHash = stuff[0]; - firstNew = false; - line = ""; - for (int i = pageSize-1; i > 0; i+=-1) - { - if ( data[i] == '\n') - { - if (firstNew == true) - break; - else - firstNew = true; - } - else if(firstNew == true) - line = data[i] + line; - } - stuff = Split(line, '\t'); - PageLastHash = stuff[0]; - -} - - - -int search(long int& fd, string hash, char* fileptr) -{ - //cout << "searching for " << hash << endl; - char *data; - struct stat sb; - fstat(fd, &sb); - - long int pageSize; - pageSize = sysconf(_SC_PAGE_SIZE); - long int NumPages = sb.st_size/pageSize; - //cout << "Number of pages = " << NumPages << endl; - // char *fileptr = NULL; - - long int off = 0; - long int firstPos; - long int lastPos; - firstPos = 0; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos*pageSize); - data = fileptr; - // above should get me first page - string FirstPageFirstHash; - string FirstPageLastHash; - ProcessPage(data, FirstPageFirstHash, FirstPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - //cout << FirstPageFirstHash << endl << FirstPageLastHash << endl; - //quck check to see if on first page - if (hash >= FirstPageFirstHash and hash <= FirstPageLastHash) - { - // cout << "found on first page" << endl; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos*pageSize); - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - if (hash < FirstPageFirstHash) - { - cout << "HASH NOT IN FILE " << hash << endl; - return 0; - } - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*(NumPages-1)); - data = fileptr; - lastPos = NumPages-1; - //the above should get me the last two pages, we take two to ensure the last pages isnt just one character or something like that - - string LastPageFirstHash; - string LastPageLastHash; - ProcessPage(data, LastPageFirstHash, LastPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - //cout << LastPageFirstHash << endl << LastPageLastHash << endl; - //quck check to see if on last page - if (hash >= LastPageFirstHash and hash <= LastPageLastHash) - { - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*(NumPages-1)); - // cout << "found on last page" << endl; - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - if (hash > LastPageLastHash) - { - cout << "HASH NOT IN FILE " << hash << endl; - return 0; - } - //start the search - int counter = 0; - while (true) - { - // cout << "ON LOOP " << counter << endl << endl; - counter++; - long int currentPage = lastPos - ((lastPos-firstPos)/2); - // cout << "checking page " << currentPage << " last = " << lastPos << " and first = " << firstPos << endl;; - if (currentPage == lastPos or currentPage == firstPos or lastPos - firstPos < 3) - { - string extra = ""; - // cout << "\nenvoked this" << endl; - fileptr = (char*)mmap64(NULL, pageSize*5, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize * (firstPos-1)); - data = fileptr; - // cout << "made it here" << endl; - int val = checkPage(data, hash, pageSize*5, extra); - if (munmap(fileptr, pageSize*5) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - //cout << " fileptr = (char*)mmap64(NULL, " << pageSize*2 <<", PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, " << pageSize<<" * " << currentPage <<");"<< endl; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*currentPage); - data = fileptr; - string CurrentPageFirstHash; - string CurrentPageLastHash; - ProcessPage(data, CurrentPageFirstHash, CurrentPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - // cout << " with " << CurrentPageFirstHash << " and " << CurrentPageLastHash << endl; - if (hash >= CurrentPageFirstHash and hash <= CurrentPageLastHash) - { - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*currentPage); - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - else - { - if (hash < CurrentPageFirstHash) - { - // cout << "hash " << hash << " is greater than " << CurrentPageFirstHash << " looking above" << endl; - lastPos = currentPage; - LastPageFirstHash = CurrentPageFirstHash; - LastPageLastHash = CurrentPageLastHash; - } - else if (hash > CurrentPageLastHash) - { - // cout << "hash \n" << hash << " is less than \n" << CurrentPageLastHash << " looking below" << endl; - firstPos = currentPage; - FirstPageFirstHash = CurrentPageFirstHash; - FirstPageLastHash = CurrentPageLastHash; - } - } - - } - close(fd); - -} - -bool fncomp (char lhs, char rhs) {return lhs=0; i+= -1) - { - char C = Sequence.c_str()[i]; - // cout << C << endl; - if (C == 'A') - NewString += 'T'; - else if (C == 'C') - NewString += 'G'; - else if (C == 'G') - NewString += 'C'; - else if (C == 'T') - NewString += 'A'; - else if (C == 'N') - NewString += 'N'; - else - { - cout << "ERROR IN RevComp - " << C << " " ; - NewString += C; - } - - } - //cout << "end\n"; - return NewString; -} - -void process_mem_usage(double& vm_usage, double& resident_set, double& MAXvm, double& MAXrss) -{ - using std::ios_base; - using std::ifstream; - using std::string; - - vm_usage = 0.0; - resident_set = 0.0; - - // 'file' stat seems to give the most reliable results - // - ifstream stat_stream("/proc/self/stat",ios_base::in); - - // dummy vars for leading entries in stat that we don't care about - // - string pid, comm, state, ppid, pgrp, session, tty_nr; - string tpgid, flags, minflt, cminflt, majflt, cmajflt; - string utime, stime, cutime, cstime, priority, nice; - string O, itrealvalue, starttime; - - // the two fields we want - // - unsigned long vsize; - long rss; - - stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr - >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt - >> utime >> stime >> cutime >> cstime >> priority >> nice - >> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest - - stat_stream.close(); - - long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages - vm_usage = vsize / 1024.0; - resident_set = rss * page_size_kb; - if (vm_usage > MAXvm){MAXvm = vm_usage;} - if (resident_set > MAXrss){MAXrss = resident_set;} -} - -class SamRead -{ - public: - string name; - int flag; - bool FlagBits[16]; - string chr; - int pos; - int mapQual; - int AlignScore; - string cigar; - string seq; - string qual; - string RefSeq; - string originalSeq; - string originalQual; - string cigarString; - string strand; - float StrandBias; - string strands; - int forward; - int reverse; - bool UsedForBigVar; - vector alignments; - vector Positions; - vector ChrPositions; - int AlignmentSegments; - - vector MutAltCounts; - vector MutRefCounts; - vector MutHashListCounts; - - vector> RefAltCounts; - vector> RefRefCounts; - vector AltKmers; - vector RefKmers; - bool first; // = true; - bool combined; // = false; - vector PeakMap; - - void createPeakMap(); - void parse(string read); - void getRefSeq(); - void CountAlignmentSegments(); - void processCigar(); - void parseInsertions( SamRead B); - void parseMutations( char *argv[] ); - void GetModes(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &ParRefModes, vector &ParAltModes, vector &HashCounts, vector &HashCountsOG, int &PossibleVarKmer); - //string ShittyGenotyper(int Alt, int Ref); - int GetSupportingHashCount(int pos, string alt, string reff); - void processMultiAlignment(); - void write(); - void writeVertical(); - void writetofile(ofstream &out); - void flipRead(); - void LookUpKmers(); - void FixTandemRef(); - int CheckParentCov(int &mode); - bool StartsWithAlign(int &pos, string &insert); - bool EndsWithAlign(int &pos, string &insert); - bool StartsWithAlignAtPeak(int &pos, string &insert, int &Kdepth); - bool EndsWithAlignAtPeak(int &pos, string &insert, int &Kdepth); - - bool CheckEndsAlign(); - int CheckBasesAligned(); - - - - vector hashes; - vector hashesRef; - vector varHash; - vector candidateHash; - vector > parentCounts; - vector > parentCountsReference; - vector mutCounts; - vector mutCountsRef; - void BuildUpHashCountTable(); -}; - - - -void SamRead::BuildUpHashCountTable() -{ - /////////////////Building up varHash and hash lists ///////////// - cout << "Building up varHash" << endl; - for (int i = 0; i < seq.size() - HashSize; i++) - { - string newHash = ""; - string newHashRef = ""; - newHash += seq.c_str()[i]; - newHashRef += RefSeq.c_str()[i]; - int count = 0; - ////can i replace this with get hash ? - if ((cigarString.c_str()[i] != 'D' and cigarString.c_str()[i] != 'R' and cigarString.c_str()[i] != 'H')) - { - for (int j = 1; j 0 or Hash.count(RevComp(newHash)) > 0) - varHash.push_back(true); - else - varHash.push_back(false); - } - /////////////////////////////////////////////////// - - - ///////////////////building up parent hash counts ////////////////// - cout << "Bulding Par hash counts" << endl; - //vector ParentHash; - for(int pi = 0; pi counts; - vector countsRef; - for(int i = 0; i< hashes.size(); i++) - { - string hash = hashes[i]; - string hashRef = hashesRef[i]; - bool checkHash = true; - for (int j = 0; j < HashSize; j++) - { - if (!(hash[j] == 'A' or hash[j] == 'C' or hash[j] == 'G' or hash[j] == 'T')) - { - checkHash = false; - break; - } - } - if (checkHash) - { - unsigned long int LongHash = HashToLong(hash); - if (ParentHashes[pi].count(LongHash) >0) - counts.push_back(ParentHashes[pi][LongHash]); - else - counts.push_back(0); - unsigned long int LongHashRef = HashToLong(hashRef); - if (ParentHashes[pi].count(LongHashRef) >0) - countsRef.push_back(ParentHashes[pi][LongHashRef]); - else - countsRef.push_back(0); - } - else - { - counts.push_back(-1); - countsRef.push_back(-1); - } - } - parentCounts.push_back(counts); - parentCountsReference.push_back(countsRef); - } - ////////////////////////////////////////////////////////////////// - /////////////////////bulid Mut counts///////////////////////////// - cout << "bulding mut counts" << endl; - cout << hashes.size() << endl; - cout << hashesRef.size() << endl; - for(int i = 0; i< hashes.size(); i++) - { - cout << i<< endl; - string hash = hashes[i]; - cout << " hash = " << hash << endl; - string hashRef = hashesRef[i]; - cout << "RefHash = " << hashRef << endl; - bool checkHash = true; - for (int j = 0; j < HashSize; j++) - { - if (!(hash[j] == 'A' or hash[j] == 'C' or hash[j] == 'G' or hash[j] == 'T')) - { - checkHash = false; - break; - } - } - cout << "check hash = " << checkHash << endl; - if (checkHash) - { - unsigned long int LongHash = HashToLong(hash); - if (MutantHashes.count(LongHash) >0) - { mutCounts.push_back(MutantHashes[LongHash]);} - else - { mutCounts.push_back(0);} - - unsigned long int LongHashRef = HashToLong(hashRef); - if (MutantHashes.count(LongHashRef) >0) - { mutCountsRef.push_back(MutantHashes[LongHashRef]);} - else - { mutCountsRef.push_back(0);} - } - else - { - mutCounts.push_back(-1); - mutCountsRef.push_back(-1); - } - } - ///////////////////////////////////////////////////////////////////// - - ////////////////////write out vertical table///////////////////////// - cout << "writing hashes out vert" << endl; - for(int i =0; i < hashes.size(); i++) - { - cout << i+pos << "\t" << i << "\t" << hashes[i] << "\t" << varHash[i] << "\t" << PeakMap[i] << "\t" << (int) qual.c_str()[i]-33; - cout << "\t" << "MutVar-" << mutCounts[i]; - for (int j = 0; j < parentCounts.size(); j++) - { - cout << "\t" << parentCounts[j][i]; - } - cout << "\t" << "MutRef-" << mutCountsRef[i]; - for (int j = 0; j < parentCountsReference.size(); j++) - { - cout << "\t" << parentCountsReference[j][i]; - } - cout << endl; - - } - //////////////////////////////////////////////////////////////// -} -int SamRead::GetSupportingHashCount(int pos, string alt, string reff) -{ - int Count =0; - int lower = pos-HashSize; - if (lower < 0){lower =0;} - int upper = pos+alt.length()+reff.length();//-1; - cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; - if (upper > MutRefCounts.size()){ - cout << "this is going to break " << upper << " > " << MutRefCounts.size() << endl; - upper = MutRefCounts.size(); - } - - for (int j = lower; j 0 and Hash[AltKmers[j]] > 0) - Count++; - else if (Hash.count(RevComp(AltKmers[j])) > 0 and Hash[RevComp(AltKmers[j])]) - Count++; - } - return Count; -} -string ShittyGenotyper(int Alt, int Ref) -{ - if (Alt ==0 and Ref ==0) - return "."; - else if (Alt == 0 and Ref > 1) - return "0/0"; - else if (Alt >0 and Ref ==0) - return "1/1"; - else if ((double) Alt / ((double) Ref + (double) Alt) >.85) - return "1/1"; - else if ((double) Alt / ((double) Ref + (double) Alt) <.15) - return "0/0"; - else - return "0/1"; -} -void SamRead::GetModes(int pos, string alt, string reff, int &MutRefMode, int &MutAltMode, vector &ParRefModes, vector &ParAltModes, vector &HashCounts, vector &HashCountsOG, int &PossibleVarKmer) -{ - int lower = pos-HashSize+1; - if (lower < 0){lower =0;} - int upper = pos+alt.length()+reff.length()-1; - cout << pos<<" + "<< alt.length() << " + " << reff.length() << endl; - if (upper > MutRefCounts.size()){ - cout << "this is going to break " << upper << " > " << MutRefCounts.size() << endl; - upper = MutRefCounts.size(); - } - - //////////////chekcing allele frequencies /////////// - //vector HashCountsOG; - vector varMutRefCounts; - vector varMutAltCounts; - vector> varParRefCounts; - vector> varParAltCounts; - vector temp; - for(int pi = 0; pi freqs; - cout << "checking NonSpecic Kmers"; - for (int j = lower; j0 and AltKmers[j] != RefKmers[j] ) //and MutRefCounts[j]<200 and (ExcludeHashes[HashToLong(RefKmers[j])]<2 or ExcludeHashes[HashToLong(RevComp(RefKmers[j]))]<2)) //needs to be fixed, should be based on cov not cutoff of 200 - varMutRefCounts.push_back(MutRefCounts[j]); - if (MutAltCounts[j]>0 and AltKmers[j] != RefKmers[j] and MutAltCounts[j]<200 and (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and (ExcludeHashes[HashToLong(AltKmers[j])]<1 or ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<1)) //needs to be fixed, should be based on cov not cutoff of 200 - varMutAltCounts.push_back(MutAltCounts[j]); - - for (int pi=0; pi < varParRefCounts.size(); pi++){ - if (RefRefCounts[pi][j] >0 and AltKmers[j] != RefKmers[j] )//and RefRefCounts[pi][j] <200 and (ExcludeHashes[HashToLong(AltKmers[j])]<2 or ExcludeHashes[HashToLong(RevComp(AltKmers[j]))]<2)) //needs to be fixed, should be based on cov not cutoff of 200 - varParRefCounts[pi].push_back(RefRefCounts[pi][j]); - if (RefAltCounts[pi][j] >0 and AltKmers[j] != RefKmers[j] and RefAltCounts[pi][j] < 200 and (Hash.count(AltKmers[j]) > 0 or Hash.count(RevComp(AltKmers[j])) > 0) and (ExcludeHashes[HashToLong(RefKmers[j])]<1 or ExcludeHashes[HashToLong(RevComp(RefKmers[j]))]<1)) //needs to be fixed, should be based on cov not cutoff of 200 - varParAltCounts[pi].push_back(RefAltCounts[pi][j]); - - } - - if (Hash.count(AltKmers[j]) > 0 and Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j] ) - HashCountsOG.push_back(Hash[AltKmers[j]]); - else if (Hash.count(RevComp(AltKmers[j])) > 0 and Hash[RevComp(AltKmers[j])] and AltKmers[j] != RefKmers[j] ) - HashCountsOG.push_back(Hash[RevComp(AltKmers[j])]); - - - if (Hash[AltKmers[j]] > 0 and AltKmers[j] != RefKmers[j]) - HashCounts.push_back(Hash[AltKmers[j]]); - else if (Hash[RevComp(AltKmers[j])] > 0 and AltKmers[j] != RefKmers[j]) - HashCounts.push_back(Hash[RevComp(AltKmers[j])]); - else - HashCounts.push_back(-1); - } - // float freq = 0; - // if (freqs.size() > 0){ - // for (int i =0; i<><><><>MutRef<><><><><><>" << endl ; - for (int s =0; s<><><><>MutAlt<><><><><><>" << endl; - for (int s =0; s<><><><>MutRefSorted<><><><><><>" << endl ; - for (int s =0; s<><><><>MutAltSorted<><><><><><>" << endl; - for (int s =0; s<><><><>Ref" << pi << "<><><><><<><>" << endl; - for (int s =0; s1) - MutRefMode = varMutRefCounts[0]; - //MutRefMode = varMutRefCounts[(varMutRefCounts.size())/2]; //// switch this for line above to get the mode, right now were taking the min - else if (varMutRefCounts.size() ==1) - MutRefMode = varMutRefCounts[0]; - else - MutRefMode = 0; - - if (varMutAltCounts.size() >1) - MutAltMode = varMutAltCounts[0]; - //MutAltMode= varMutAltCounts[(varMutAltCounts.size()-2)/2]; //// switch this for line above to get the mode, right now were taking the min - else if (varMutAltCounts.size() ==1) - MutAltMode = varMutAltCounts[0]; - else - MutAltMode=0; - - for(int pi = 0; pi1) - ParRefModes.push_back(varParRefCounts[pi][0]); - //ParRefModes.push_back(varParRefCounts[pi][((varParRefCounts[pi].size())/2)]); //// switch this for line above to get the mode, right now were taking the min - else if (varParRefCounts[pi].size() ==1) - ParRefModes.push_back(varParRefCounts[pi][0]); - else - ParRefModes.push_back( 0); - } - for(int pi =0; pi1) - ParAltModes.push_back(varParAltCounts[pi][0]); - // ParAltModes.push_back(varParAltCounts[pi][((varParAltCounts[pi].size())/2)]); //// switch this for line above to get the mode, right now were taking the min - else if (varParAltCounts[pi].size()==1) - ParAltModes.push_back(varParAltCounts[pi][0]); - else - ParAltModes.push_back( 0); - } -} -void SamRead::CountAlignmentSegments() -{ - AlignmentSegments = 0; - char last = cigarString.c_str()[0]; - for (int i =1; i < cigarString.size(); i++) - { - if (cigarString.c_str()[i] == 'M') - {} - else if (last == 'M') - { - AlignmentSegments++; - } - last = cigarString.c_str()[i]; - } - if (last == 'M') - { - AlignmentSegments++; - } -} -int SamRead::CheckParentCov(int &mode) -{ - //vector> RefAltCounts; - //vector> RefRefCounts; - bool good = true; - int lowC = 0; - vector cov; - for (int pi = 0; pi < RefRefCounts.size(); pi++){ - for (int i = 0; i < RefRefCounts[pi].size(); i++){ - if (RefKmers[i] != ""){ - int ParRef = 0; - int ParAlt = 0; - if (RefAltCounts[pi][i] > 0) - ParAlt = RefAltCounts[pi][i]; - if (RefRefCounts[pi][i] > 0) - ParRef = RefRefCounts[pi][i]; - cov.push_back(ParRef+ParAlt); - if (ParRef+ParAlt > 0 && ParRef+ParAlt < 10) - lowC++; - } - } - } - if(cov.size()>1){ - - sort (cov.begin(), cov.end()); - mode = cov[cov.size()/2]; - } - else - mode = -1; - - return lowC; -} - -void SamRead::flipRead() -{ - cout <<"FLIPPING reads not on the same strand"; - write(); - string FlipSeq = "" ; - string FlipQual = "" ; - string FlipRefSeq = ""; - string FlipCigarString = ""; - string FlipStrand = ""; - vector FlipPeakMap ; - vector FlipPos; - vector FlipChrPos; - for (int i = seq.size() -1; i >=0; i--) - { - // FlipSeq += seq.c_str()[i]; - FlipQual += qual.c_str()[i]; - // FlipRefSeq += RefSeq.c_str()[i]; - FlipCigarString += cigarString.c_str()[i]; - FlipStrand += '-'; - FlipPos.push_back(Positions[i]); - FlipChrPos.push_back(ChrPositions[i]); - FlipPeakMap.push_back(PeakMap[i]); - } - FlipSeq = RevComp(seq); - FlipRefSeq = RevComp(RefSeq); - - seq = FlipSeq; - qual = FlipQual; - RefSeq = FlipRefSeq; - cigarString = FlipCigarString; - strand = FlipStrand; - Positions = FlipPos; - ChrPositions = FlipChrPos; - PeakMap=FlipPeakMap; - write(); - -} - -void SamRead::processMultiAlignment() -{ - //check if this is a mis-joined contig - -} -void SamRead::write() -{ - cout << name << endl; - cout << " flag = " << flag << endl; - cout << " mapQual = " << mapQual << endl; - cout << " Strand = " << GetReadOrientation(flag) << endl; - cout << " Alignments = " << alignments.size() << endl; - cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - cout << " cigar = " << cigar << endl; - cout << " Seq = " << seq << endl; - cout << " Qual = " << qual << endl; - cout << " Cigar = " << cigarString << endl; - cout << " RefSeq = " << RefSeq << endl; - cout << " strand = " << strand << endl; - cout << " PeakMap = "; - for (int i =0; i < PeakMap.size(); i++) - {cout << PeakMap[i]; } - cout << endl; - cout << " RefPositions: "; - for (int i =0; i < Positions.size(); i++) - cout << Positions[i] << " \t"; - cout << endl; - cout << " RefChromoso: "; - for (int i =0; i < ChrPositions.size(); i++) - cout << ChrPositions[i] << " \t"; - cout << endl; - -} -void SamRead::writetofile(ofstream &out) -{ - - out << name << endl; - out << " flag = " << flag << endl; - out << " mapQual = " << mapQual << endl; - out << " Strand = " << GetReadOrientation(flag) << endl; - out << " Alignments = " << alignments.size() << endl; - out << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - out << " AlignScore = " << AlignScore << endl; - out << " cigar = " << cigar << endl; - out << " Seq = " << seq << endl; - out << " Qual = " << qual << endl; - out << " Cigar = " << cigarString << endl; - out << " RefSeq = " << RefSeq << endl; - out << " PeakMap= "; - for (int i =0; i < PeakMap.size(); i++) - { - out << PeakMap[i] ; - } - out << endl; - out << " PMSize = " << PeakMap.size() << endl; -} - -void SamRead::writeVertical() -{ - cout << "ParentHashes size = " << ParentHashes.size() << "RefAltCounts size " << RefAltCounts.size() << endl; - cout << name << endl; - cout << " flag = " << flag << endl; - cout << " chr " << chr << " - " << pos << " qual = " << mapQual << endl; - cout << " cigar = " << cigar << endl; - cout << " Alignments = " << alignments.size() << endl; - cout << " AlignScore = " << AlignScore << endl; - for (int i =0; i < seq.size(); i++){ - - cout << seq.c_str()[i] << "\t" << qual.c_str()[i] << "\t" << cigarString.c_str()[i] << "\t" << RefSeq.c_str()[i] << "\t" << ChrPositions[i] << "\t" << Positions[i] << "\t" << MutAltCounts[i] << "\t" << MutRefCounts[i] << "\t" << MutHashListCounts[i] << "\t" ; - cout << "\tParents"; - for (int pi=0; pi < RefAltCounts.size(); pi++){ - cout << "\t" << RefAltCounts[pi][i] << "\t" << RefRefCounts[pi][i]; - } - cout << "\t" << RefKmers[i] << "\t" << AltKmers[i]; - cout<< endl; - } -} -string compressVar(string line, int start, string& StructCall) -{ - cout << "compressing var" << endl; - char current = line.c_str()[0]; - int currentCount = 1; - string CV = ""; - for (int i = 1; i< line.size(); i++) - { - cout << current << endl; - if (line.c_str()[i] == current) - { - currentCount++; - } - else - { - if (currentCount > 2) - { - ostringstream convert; - convert << currentCount; - CV+=convert.str(); - CV+=current; - - ostringstream convertEND; - int end = currentCount+start; - convertEND << end; - - - if (current == 'Y') - { - cout << "YAAAY STRUCT" << endl; - StructCall = "SVTYPE=DUP;END="; - StructCall += convertEND.str(); - StructCall += ";SVLEN="; - StructCall += convert.str(); - StructCall += ";"; - cout << StructCall << endl; - } - } - else if (currentCount ==2) - { - CV+=current; - CV+=current; - } - else if (currentCount == 1) - { - CV+=current; - } - else - { - cout << "ERROR in compress " << current << " " << currentCount << endl; - } - - current = line.c_str()[i]; - currentCount = 1; - } - } - if (currentCount > 2) - { - ostringstream convert; - convert << currentCount; - CV+=convert.str(); - CV+=current; - - ostringstream convertEND; - int end = currentCount+start; - convertEND << end; - - - if (current == 'Y') - { - cout << "YAAAY STRUCT" << endl; - StructCall = "SVTYPE=DUP:TANDEM;END="; - StructCall += convertEND.str(); - StructCall += ";SVLEN="; - StructCall += convert.str(); - StructCall += ";"; - cout << StructCall << endl; - } - } - else if (currentCount ==2) - { - CV+=current; - CV+=current; - } - else if (currentCount == 1) - { - CV+=current; - } - else - { - cout << "ERROR in compress " << current << " " << currentCount << endl; - } - - return CV; -} -void SamRead::createPeakMap() -{ - vector tempPeakMap; - int i =0; - int max = -1; - int maxSpot = -1; - int last = 0; - for (int i =0; i< qual.size(); i++) - { - - if (qual[i] <='!') - { - //cout << "!"; - tempPeakMap.push_back(0); - } - else - { - //cout < '!' ) - { - // cout << qual[j] << "-" << j ; - if (max < qual[j]) - {max = qual[j];} - j++; - // cout << "max = " << (char) max << endl; - } - cout << endl; - j = j-1; - for ( int k = i; k < qual.size() and k <= j ; k++) - { - // cout << qual[k]; - if (qual[k]==max and cigarString[k] != 'H') - tempPeakMap.push_back(1); - else - tempPeakMap.push_back(0); - } - //cout << endl; - //not sure why I need this, figure it out - //tempPeakMap.push_back(0); - i = j; - } - /*if (qual[i] <='!') - { - //cout << "!"; - tempPeakMap.push_back(0); - } - else - { - //cout < '!' ) - { - // cout << qual[j] << "-" << j ; - if (max < qual[j]) - {max = qual[j];} - j++; - // cout << "max = " << (char) max << endl; - } - cout << endl; - j = j-1; - for ( int k = i; k < qual.size() and k <= j ; k++) - { - // cout << qual[k]; - if (qual[k]==max and cigarString[k] != 'H') - tempPeakMap.push_back(1); - else - tempPeakMap.push_back(0); - } - //cout << endl; - //not sure why I need this, figure it out - //tempPeakMap.push_back(0); - i = j; - }*/ - } - - // I hate one time corrections, but here on is to correct if ther is a del - for (int i =0; i< qual.size(); i++) - { - if (seq[i] == '-'){ - tempPeakMap[i] == tempPeakMap[i-1]; - } - } - - PeakMap.clear(); - PeakMap = tempPeakMap; - //cout << "done with peak map " << endl; -} -/*void SamRead::createPeakMap() -{ -// cout << "crateing PeakMap" << endl; - vector tempPeakMap; - int i =0; - int max = -1; - int maxSpot = -1; - while (i '!') - AnyBasesOver0 = true; - if (PeakMap[i] == 1) - Denovo = "DeNovo"; - - for(int j = 0; j< cigarString.size() - i; j++) - { - if(cigarString.c_str()[i+j] == 'X' or cigarString.c_str()[i+j] == 'D' or cigarString.c_str()[i+j] == 'I' or cigarString.c_str()[i+j] == 'Y' /*or cigarString.c_str()[i+j] == 'S' or cigarString.c_str()[i+j] == 'H'*/) - { - size = j; - if (qual.c_str()[i+j] > '!') - AnyBasesOver0 = true; - if (PeakMap[i+j] == 1) - Denovo = "DeNovo"; - - } - else //if (qual.c_str()[i+j] == '!') - break; - } - cout << "size =" << size<< endl; - - if (AnyBasesOver0) //enabling this will only report varites covered by hashes - { - - if ( cigarString.c_str()[i] == 'I' or cigarString.c_str()[i] == 'D' or cigarString.c_str()[i] == 'Y' /*or cigarString.c_str()[i] == 'S' or cigarString.c_str()[i] == 'H'*/) - { - for (int k = 1; i-k >= 0; k++) - { - if (ChrPositions[i-k] == "nope") - {} - else - { - reff+=RefSeq.c_str()[i-k]; - alt+=seq.c_str()[i-k]; - startPos = i-k; - break; - } - } - } - - /////////build the alleles and var type///////// - for(int j = 0; j<= size; j++) - { - if (RefSeq.c_str()[i+j] == 'A' or RefSeq.c_str()[i+j] == 'C' or RefSeq.c_str()[i+j] == 'G' or RefSeq.c_str()[i+j] == 'T') - reff+=RefSeq.c_str()[i+j]; - if (seq.c_str()[i+j] == 'A' or seq.c_str()[i+j] == 'C' or seq.c_str()[i+j] == 'G' or seq.c_str()[i+j] == 'T') - alt+=seq.c_str()[i+j]; - varType += cigarString.c_str()[i+j]; - } - //***********check that the alese are only baess************** - bool good = true; - for (int j = 0; j ParRefModes; - vector ParAltModes; - vector HashCounts; - vector HashCountsOG; - int PossibleAltKmer=0; - GetModes(i, alt, reff, MutRefMode, MutAltMode, ParRefModes, ParAltModes, HashCounts, HashCountsOG, PossibleAltKmer); - int SupportingHashes = GetSupportingHashCount(i, alt, reff); - string Genotype = ShittyGenotyper(MutAltMode, MutRefMode); - string CompressedVarType = compressVar(varType, Positions[startPos], StructCall); - cout << chr << "\t" << pos+i << "\t" << CompressedVarType /*"."*/ << "\t" << reff << "\t" << alt << "\t" << SupportingHashes << "\t" << varType << "\t" << "." << "\t" << "." << "\t" << "." << endl; - ////////////////generatre parent genotypes and check/////////////////////// - vector ParGenotypes; - for (int p = 0; p< ParRefModes.size(); p++) - { - ParGenotypes.push_back(ShittyGenotyper(ParAltModes[p], ParRefModes[p]) ); - } - - cout << endl; - ////////////////check that parents have enough coverage//////////////////// - cout << "PAR LOW COV CHECK" << endl; - int NumLowCov = 0; - int low = i-HashSize-10; - if (low < 0) - low = 0; - - for(int k = low ; k <= i+10 and k < hashes.size(); k++) - { - for (int j = 0; j < 2 /*parentCounts.size()*/; j++) - { - int sum = 0; - if (hashesRef[k] == hashes[k]) - {sum = parentCountsReference[j][k];cout < 0 ) - { - NumLowCov++; - cout << "\tLOWCOV" << NumLowCov ; - } - } - cout << endl; - - } - //////////////////////////////check if the parenst contain any of mut hashes////////////////////////////////////////// - bool LowCov = false; - int lowCount = 0; - low = i - HashSize ; - if (low < 0){low = 0;} - cout << "checking bases " << low << " to " << i+size+5 << endl; - for(int j = low; j <= i+size and j < hashes.size(); j++) - { - if (hashesRef[j] != hashes[j]) - { - for (int k = 0; k < 2 /*parentCounts.size()*/; k++) - { - cout << "Checking Par Hash " << hashes[j] << "\t" << parentCounts[k][j] << "\t" << hashesRef[j] << "\t" << parentCountsReference[k][j]; - float varFreq = 1; - if (parentCountsReference[k][j] > 0) - { - varFreq = (double)parentCounts[k][j]/((double)parentCountsReference[k][j] + (double)parentCounts[k][j]); - } - cout << "\tvarFreq=" << varFreq<= 1 and parentCounts[k][j] <= 10 and varFreq > .02 )//and parentCountsReference[k][j]<150 ) //if (parentCounts[k][j] <= 5 and parentCounts[k][j] > 0 ) - { - if ((ExcludeHashes[HashToLong(hashes[j])]<1 and ExcludeHashes[HashToLong(RevComp(hashes[j]))]<1)) - { - cout << " LC HASH FOUND" << endl; - LowCov = true; - lowCount++; - } - else - { cout << " HASH FOUND IN REF " << hashes[j] << " - " << ExcludeHashes[HashToLong(hashes[j])] << " - " << ExcludeHashes[HashToLong(RevComp(hashes[j]))] << endl;} - } - } - } - } - ///////////////////final filter check///////////////////////////////////////// - string Filter = "."; - if (AlignmentSegments > 10) - { - Denovo = "PoorAlignment"; - stringstream ss; - ss << AlignmentSegments; - Denovo += ss.str(); - if (Filter == ".") - Filter = ""; - Filter+="PA"; - Filter+=ss.str(); - Filter+=","; - } - if (NumLowCov > 3) - { - Denovo = "ParLowCovRegion"; - cout << "ParLowCov " << NumLowCov << endl; - if (Filter == ".") - Filter = ""; - stringstream ss; - ss << NumLowCov; - Filter+="PLC"; - Filter+=ss.str(); - Filter+=","; - } - //if (LowCov) - if (lowCount >=2) - { - cout << "LOW COVERAGE" << endl; - Denovo = "LowCov"; - stringstream ss; - ss << lowCount; - Denovo += ss.str(); - if (Filter == ".") - Filter = ""; - Filter+="LCH"; - Filter+=ss.str(); - Filter+=","; - } - else - cout << "GOOD COVERAGE" << endl; - if (StrandBias >= 0){ - - if (StrandBias >0.9 or StrandBias < 0.1) - { - Denovo = "StrandBias"; - stringstream ss; - ss << StrandBias; - if (Filter == ".") - Filter = ""; - Filter+="SB"; - Filter+=ss.str(); - Filter+=","; - } - } - if (Denovo == "DeNovo" and Filter == ".") - Filter = "PASS"; - - if (Genotype.find("1") == std::string::npos) { - Denovo = "Mosaic"; - } - for (int p = 0; p< ParRefModes.size(); p++) - { - //if (ParGenotypes[p].find("1") != std::string::npos) { - //Denovo = "PresentInParents"; } - } - /////////////////////////////////////////////////////// - cout << "startpos = " << startPos << " chrsize = " << ChrPositions.size() << endl; - cout << ChrPositions[startPos] << "\t" << endl; - cout << Positions[startPos] << "\t" << endl; - cout << CompressedVarType <<"-" << endl; - cout << Denovo /*"."*/ << "\t" << endl; - cout << reff << "\t" << endl; - cout << alt << "\t" << endl; - cout << SupportingHashes << "\t" << endl; - cout << Filter << "\t" << endl; - cout << StructCall << endl; - cout <<"RN=" << name << endl; - cout << ";MQ=" << mapQual << endl; - cout << ";cigar=" << cigar << endl; - cout << ";" << "CVT=" << CompressedVarType << ";HD=" << endl; - - double Score = ((double)SupportingHashes/(double)PossibleAltKmer) * 100.0; - ////////////////////////Writing var out to file///////////////////////// - cout << ChrPositions[startPos] << "\t" <= 48 and cigar.c_str()[i] <= 57) - num = num + cigar.c_str()[i]; - else - { - int number = atoi(num.c_str()); - for(int j = 0; j < number; j++) - {cigarString += cigar.c_str()[i];} - num = ""; - } - } - -} -void SamRead::FixTandemRef() -{ - cout << "FOUND TANDEM" << endl; - write(); - //writeVertical(); - string lastChr = "nope"; - int lastPos = -1; - string NewRef = ""; - for (int i = 0; i NewPositions; - vector NewChromosome; - int InsOffset = 0; - - if ( Reff.sequenceNameStartingWith(chr) == "") //come back to, need to check if chr is in reference - { - cout << "ERROR chr " << chr << " not found\n"; - return; - } - - //correct star position of the read to account for Hard and soft clipped bases as we are counting those now - for (int i = 0; i< cigarString.size(); i++) - { - if (cigarString.c_str()[i]== 'H') - {} - else - { - pos = pos-i; - break; - } - } - for (int i = 0; i< cigarString.size(); i++) - { - if (cigarString.c_str()[i]== 'S') - {} - else - { - pos = pos-i; - break; - } - } - - - - - int Roffset = 0; - int Coffset = 0; - for (int i =0; i blank; - - - - //**********************************************************************// - CountAlignmentSegments(); - cout << "After getRefSeq"; - //FullOutwriteVertical(); -} - -void SamRead::LookUpKmers() -{ - cout << "SeqSize = " << seq.size() << " RefSize = " << RefSeq.size() << endl; - vector blank; - RefAltCounts.clear(); - RefRefCounts.clear(); - MutHashListCounts.clear(); - MutAltCounts.clear(); - MutRefCounts.clear(); - RefKmers.clear(); - AltKmers.clear(); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - RefAltCounts.push_back(blank); - RefRefCounts.push_back(blank); - } - for (int j = 0; j 0 ){ - MutAltCounts.push_back(MutantHashes[HashToLong(hash)]); - } - else - MutAltCounts.push_back(-1); - - for (int pi = 0; pi < ParentHashes.size(); pi++){ - if (ParentHashes[pi].count(HashToLong(hash)) > 0){ - RefAltCounts[pi].push_back(ParentHashes[pi][HashToLong(hash)]); - } - else - RefAltCounts[pi].push_back(-1); - } - } - - if (Hash.count(hash) > 0){ - MutHashListCounts.push_back(Hash[hash]); - } - else - MutHashListCounts.push_back(-1); - - - } - else{ - MutAltCounts.push_back(-3); - MutHashListCounts.push_back(-3); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - RefAltCounts[pi].push_back(-3); - } - } - - if(Refhash != ""){ - if (MutantHashes.count(HashToLong(Refhash)) > 0 ) - { - MutRefCounts.push_back(MutantHashes[HashToLong(Refhash)]); - } - else - MutRefCounts.push_back(-1); - - for (int pi = 0; pi < ParentHashes.size(); pi++){ - if (ParentHashes[pi].count(HashToLong(Refhash)) > 0){ - RefRefCounts[pi].push_back(ParentHashes[pi][HashToLong(Refhash)]); - } - else - RefRefCounts[pi].push_back(-1); - } - - } - else{ - - MutRefCounts.push_back(-3); - for (int pi = 0; pi < ParentHashes.size(); pi++){ - RefRefCounts[pi].push_back(-3); - } - } - - } - cout << "donezo" << endl; -} -void SamRead::parse(string read) -{ - - cout << "parsing " << read << endl; - vector temp = Split(read, '\t'); - cout << "boom" << endl; - name = temp[0]; - cout << "name " << name; - flag = atoi(temp[1].c_str()); - chr = temp[2]; - pos = atoi(temp[3].c_str()); - mapQual = atoi(temp[4].c_str()); - cigar = temp[5]; - seq = temp[9]; - if (temp[10] == "*") - { - cout << "correcting missing qualtiy" << endl; - string newQual = ""; - for (int i = 0; i < seq.size(); i++) - { - newQual+='5'; - } - temp[10] = newQual; - } - qual = temp[10]; - alignments.clear(); - - UsedForBigVar = false;UsedForBigVar = false; - first = true; - combined = false; - string NewSeq = ""; - for (int i = 0; i < seq.size(); i++) - NewSeq+=toupper(seq.c_str()[i]); - - seq = NewSeq; - - processCigar(); - cout << "working on strand bias" << endl; - cout << temp[0] << endl; - vector temp2 = Split(name, ':'); - if (temp2.size() >= 2){ - cout << "break it down " << endl; - strands = temp2[1]; - cout << "strands = " << strands << endl; - forward = 0; - reverse = 0; - forward = atoi(temp2[1].c_str()); - reverse = atoi(temp2[2].c_str()); - cout << "forward = " << forward << endl; - cout << "reverse = " << reverse << endl; - StrandBias = ((float)forward)/((float)forward+(float)reverse); - cout << "strand bias = " << StrandBias << endl; - } - else{ - cout << "no strand data " << temp2.size() << endl; - strands = ""; - StrandBias = -1; - forward = -1; - reverse = -1; - } - AlignScore = 0; - for (int i = 11; i< temp.size(); i++){ - vector astemp = Split(temp[i], ':'); - if (astemp[0] == "AS"){ - AlignScore = atoi(astemp[2].c_str()); - } - } - cout << "getting flag bits " << endl; - for (int j = 0; j < 16; ++j){ - FlagBits [j] = 0 != (flag & (1 << j)); - } - cout << "Read Pared = " << FlagBits[0] << endl; - cout << "read mapped in proper pair = " << FlagBits[1] << endl; - cout << "read unmapped = " << FlagBits[2] << endl; - cout << "mate unmapped = " << FlagBits[3] << endl; - cout << "read reverse strand = " << FlagBits[4] << endl; - cout << "mate referse strand = " << FlagBits[5] << endl; - cout << "first in pair =" << FlagBits[6] << endl; - cout << "second in pair =" << FlagBits[7] << endl; - cout << "not primary alignment =" << FlagBits[8] << endl; - cout << "read fails platform or vendor quality checks =" << FlagBits[9] << endl; - cout << "read is PCR or optical duplicate =" << FlagBits[10] << endl; - cout << "supplementary alignment =" << FlagBits[11] << endl; -} -int findBreak(SamRead& read) -{ - char Afirst = read.cigarString.c_str()[0]; - - - cout << "Afirst = " << Afirst << endl; - cout << "starting A check " << endl; - if (Afirst == 'H' or Afirst == 'S') - { - cout << "forward" << endl; - for (int i =0; i < read.seq.size(); i++) - { - if (read.cigarString.c_str()[i] == 'H' or read.cigarString.c_str()[i] == 'S') - { - //keep going - cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i]<< endl; - } - else - { - cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i] << endl; - cout << "fond break at " << i << endl; - return i; - } - } - } - else - { - cout << "reverse" << endl; - for (int i = read.seq.size()-1; i >= 0; i += -1) - { - if (read.cigarString.c_str()[i] == 'H' or read.cigarString.c_str()[i] == 'S') - { - cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i] << endl; - //keep going - } - else - { - cout << i << " == " << read.cigarString.c_str()[i] << ' ' << read.seq.c_str()[i] << endl; - cout << "fond break at " << i << endl; - return i; - } - } - } - - -} -SamRead BetterWay(vector reads) -{ - cout << "In BetterWay" << endl; - int A = 0; - int B = 1; - //cout << "B = " << B << endl; - cout << "Working on " << reads[A].name << ", size = " << reads[B].pos -reads[A].pos << endl; - vector> AlignmentPos; - vector> AlignmentChr; - int ALastGoodRef = -1; - string ALastGoodChr = "nope"; - int BLastGoodRef = -1; - string BLastGoodChr = "nope"; - - - vector NewSeqs; - vector NewQuals; - vector NewRefs; - vector NewCigars; - - for(int i = 0; i currentPos; - vector currentChr; - //need to get all the reads lined up with the same number of bases, taking account of I's and D's that change length// - if (reads[A].cigarString.c_str()[Acount] == 'D' and reads[B].cigarString.c_str()[Acount] != 'D') - { - currentPos.push_back(reads[A].Positions[Acount]); - currentPos.push_back(-1); - - currentChr.push_back(reads[A].ChrPositions[Acount]); - currentChr.push_back("nope"); - - ALastGoodRef = reads[A].Positions[Acount]; - ALastGoodChr = reads[A].ChrPositions[Acount]; - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - - NewSeqs[B]+='-'; - NewQuals[B]+='!'; - NewRefs[B]+="-"; - NewCigars[B]+='R'; - } - else if (reads[A].cigarString.c_str()[Acount] != 'D' and reads[B].cigarString.c_str()[Acount] == 'D') - { - currentPos.push_back(-1); - currentPos.push_back(reads[B].Positions[Bcount]); - - currentChr.push_back("nope"); - currentChr.push_back(reads[B].ChrPositions[Bcount]); - - BLastGoodRef = reads[B].Positions[Bcount]; - BLastGoodChr = reads[B].ChrPositions[Bcount]; - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - - NewSeqs[A]+='-'; - NewQuals[A]+='!'; - NewRefs[A]+='-'; - NewCigars[A]+='R'; - } - else - { - if (reads[A].cigarString.c_str()[Acount] == 'H' or reads[A].cigarString.c_str()[Acount] == 'S') - { - currentPos.push_back(-1); - currentChr.push_back("nope"); - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - - } - else if (reads[A].cigarString.c_str()[Acount] == 'M' or reads[A].cigarString.c_str()[Acount] == 'X' or reads[A].cigarString.c_str()[Acount] == 'D') - { - currentPos.push_back(reads[A].Positions[Acount]); - currentChr.push_back(reads[A].ChrPositions[Acount]); - ALastGoodRef = reads[A].Positions[Acount]; - ALastGoodChr = reads[A].ChrPositions[Acount]; - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - } - else if (reads[A].cigarString.c_str()[Acount] == 'I') - { - currentPos.push_back(ALastGoodRef); - currentChr.push_back(ALastGoodChr); - - NewSeqs[A]+=reads[A].seq.c_str()[Acount]; - NewQuals[A]+=reads[A].qual.c_str()[Acount]; - NewRefs[A]+=reads[A].RefSeq.c_str()[Acount]; - NewCigars[A]+=reads[A].cigarString.c_str()[Acount]; - - Acount++; - } - else - cout << "WTF, cigar = " << reads[A].cigarString.c_str()[Acount]; - - - - if (reads[B].cigarString.c_str()[Bcount] == 'H' or reads[B].cigarString.c_str()[Bcount] == 'S') - { - currentPos.push_back(-1); - currentChr.push_back("nope"); - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - } - else if (reads[B].cigarString.c_str()[Bcount] == 'M' or reads[B].cigarString.c_str()[Bcount] == 'X' or reads[B].cigarString.c_str()[Bcount] == 'D') - { - currentPos.push_back(reads[B].Positions[Bcount]); - currentChr.push_back(reads[B].ChrPositions[Bcount]); - BLastGoodRef = reads[B].Positions[Bcount]; - BLastGoodChr = reads[B].ChrPositions[Bcount]; - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - } - else if (reads[B].cigarString.c_str()[Bcount] == 'I') - { - currentPos.push_back(BLastGoodRef); - currentChr.push_back(BLastGoodChr); - - NewSeqs[B]+=reads[B].seq.c_str()[Bcount]; - NewQuals[B]+=reads[B].qual.c_str()[Bcount]; - NewRefs[B]+=reads[B].RefSeq.c_str()[Bcount]; - NewCigars[B]+=reads[B].cigarString.c_str()[Bcount]; - - Bcount++; - } - else - cout << "WTF, cigar = " << reads[B].cigarString.c_str()[Bcount]; - - } - AlignmentPos.push_back(currentPos); - AlignmentChr.push_back(currentChr); - } - - //write - for (int i =0; i< reads.size(); i++) - { - reads[i].Positions.clear(); - reads[i].ChrPositions.clear(); - reads[i].seq = NewSeqs[i]; - reads[i].qual = NewQuals[i]; - reads[i].RefSeq = NewRefs[i]; - reads[i].cigarString = NewCigars[i]; - for (int j = 0; jNewPos; - vector NewChr; - - char LastAlignedQ = ' '; - int LastAlignedPos = -1; - string LastAlignedChr = "nope"; - - - //set LastAlignedPos to the first base with an aligned base - bool notfound = true; - int base = 0; - while (notfound) - { - for (int i = 0; i< reads.size(); i++) - { - if (reads[i].Positions[base] > -1) - { - LastAlignedPos = reads[i].Positions[base]; - LastAlignedChr = reads[i].ChrPositions[base]; - notfound = false; - break; - } - } - if (notfound) - base++; - } - for (int i =0; i < base; i++) - { - - NewCigar += reads[A].cigarString.c_str()[i]; - NewSeq +=reads[A].seq.c_str()[i]; - NewQual += reads[A].qual.c_str()[i]; - NewRef+= reads[A].RefSeq.c_str()[i]; - NewPos.push_back(reads[A].Positions[i]); - NewChr.push_back(reads[A].ChrPositions[i]); - } - //corect qualites so everyone has the same ones, H will produce no quality - cout << "checking quals" << endl; - string bestQual = reads[0].qual; - for (int i =0; i -1) //if this base is aligned in A - { - if (reads[A].Positions[i] - LastAlignedPos > 1) //indicates a deletion - { - if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!' ) - { - cout << "well fuck this shit A" << endl; - return reads[A]; - } - //if(reads[A].ChrPositions[i] == LastAlignedChr and abs(reads[A].Positions[i] -LastAlignedPos ) < MaxVarentSize ) //must be on the same chromosome - if(reads[A].chr == reads[B].chr and abs(reads[A].Positions[i] -LastAlignedPos ) < MaxVarentSize ) //must be on the same chromosome - { - cout << "wel this dosnt make any sense" << endl; //reads are in order in the bam so A should always be downstream of B, theus the deletion shoould be detected in B - BEDBigStuff << reads[A].chr << "\t" << LastAlignedPos << "\t" << reads[A].Positions[i] << "\t" << "Deletion" << endl; - for (int j = LastAlignedPos; j= MaxVarentSize ) - if( reads[A].chr == reads[B].chr and abs(reads[A].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Too Big, Same strand and chr "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0 ) - { - cout << "INVERSION written to file" << endl; - Translocations << "Possible mob event "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "mobil elemnt " << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Translocataion, same strand "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "we got a translocation" << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - } - } - } - else if (reads[A].Positions[i] -LastAlignedPos < 0 and abs(reads[A].Positions[i] -LastAlignedPos ) < MaxVarentSize) // indicates a possible insertion or tandem duplication - { - if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!') - { - cout << "well fuck this shit B" << endl; - return reads[A]; - } - cout << "this could be one A, last = " << LastAlignedPos << " Current = " << reads[A].Positions[i] << " chr = " << LastAlignedChr << " and " << reads[A].ChrPositions[i] << endl; -// if (reads[A].ChrPositions[i] == LastAlignedChr ) - if (reads[A].chr == reads[B].chr ) - { - cout << "This is an insertion A at base " << i << endl; - BEDBigStuff << reads[A].chr << "\t" << reads[A].Positions[i] << "\t" << LastAlignedPos << "\tTandemDup" << endl; - cout << "tadem dup" << endl; - int j = 0; - for( j = i; j=0; k+= -1) - { - if (reads[A].Positions[k]+1 > 1) - break; - } - //cout << "j= " << reads[A].Positions[k]+1 << " < " << LastAlignedPos << " - " << endl; - for( j = reads[A].Positions[k]+1; j < LastAlignedPos; j++) - { - NewCigar += 'Y'; //'I'; - NewSeq += toupper(Reff.getSubSequence(reads[A].chr, j, 1).c_str()[0]); - NewQual += '!'; - NewRef+= '-'; - NewPos.push_back(j); - NewChr.push_back(reads[A].chr); - } - cout << "yaya finished" << endl; - - } - else - { - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Possible mob event "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - //if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - //{ - // Translocations << "mobil elemnt " << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - //} - } - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Translocation, same strand "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "we got a translocation" << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - - } - else if( reads[A].Positions[i] -LastAlignedPos < 0 and abs(reads[A].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - { - if (LastAlignedQ == '!' or reads[A].qual.c_str()[i] == '!') - { - cout << "well fuck this shit C" << endl; - - return reads[A]; - } - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - if (reads[A].chr == reads[B].chr) - Translocations << "TOO BIG 3 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - else - Translocations << "Translocation 3 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - - - if (i -1) - { - if (reads[B].Positions[i] - LastAlignedPos > 1) - { - if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!') - { - - cout << "well fuck this shit D" << endl; - - return reads[A]; - } - //if(reads[B].ChrPositions[i] == LastAlignedChr and abs(reads[B].Positions[i] - LastAlignedPos ) < MaxVarentSize ) - if(reads[B].chr == reads[A].chr and abs(reads[B].Positions[i] - LastAlignedPos ) < MaxVarentSize ) - { - cout << "striahgtup deletion, size = " << abs(reads[B].Positions[i] -LastAlignedPos ) << " at base " << i << " from Position " << LastAlignedPos << " to " << reads[B].Positions[i] << endl; - BEDBigStuff << reads[B].chr << "\t" << LastAlignedPos << "\t" << reads[B].Positions[i] << "\t" << "Deletion" << endl; -// cout << "Inserting reff sequence from " << LastAlignedPos+1 << " to " << reads[B].Positions[i] << " = " << reads[B].Positions[i]-LastAlignedPos << endl; - for (int j = LastAlignedPos; j< reads[B].Positions[i]-1; j++) - { - //cout << j << " - " << j - LastAlignedPos<< endl; - NewCigar += 'D'; - NewSeq += '-'; - NewQual += LastAlignedQ; - NewRef+= toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); - NewPos.push_back(j); - NewChr.push_back(reads[B].ChrPositions[i]); - - // char tmp = toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); - // cout << "R " << '-' << " " << 'D' << " " << tmp << " " << reads[B].chr << " " << j << " " << NewSeq << endl; - // cout << "R " << '-' << " " << 'D' << " " << tmp << " " << reads[B].chr << " " << j << " " << NewRef << endl << endl; - } - } - else - { - // if( reads[A].ChrPositions[i] == LastAlignedChr and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - if( reads[A].chr == reads[B].chr and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "TOO BIG 2 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Possible mob event "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "mobil elemnt " << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - else - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "Translocation 2 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - - - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "we got a translocation" << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - } - } - - } - else if (reads[B].Positions[i] -LastAlignedPos < 0 and abs(reads[B].Positions[i] - LastAlignedPos ) < MaxVarentSize) // indicates a possible insertion or tandem duplication - { - if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!' ) - { - cout << "well fuck this shit E" << endl; - - return reads[A]; - } - // cout << "this could be one B, last = " << LastAlignedPos << " Current = " << reads[B].Positions[i] << " chr = " << LastAlignedChr << " and " << reads[B].ChrPositions[i] << endl; - //if (reads[B].ChrPositions[i] == LastAlignedChr - if (reads[B].chr == reads[A].chr ) - { - cout << "This is an insertion B at base " << i << endl; - - BEDBigStuff << reads[B].chr << "\t" << reads[B].Positions[i] << "\t" << LastAlignedPos << "\tTandemDup" << endl; - // cout << "tadem dup" << endl; - int j = 0; - for(j = i; j < reads[B].seq.size() and reads[B].Positions[j] <= LastAlignedPos; j++) - { - NewCigar += 'Y'; - NewSeq += reads[B].seq.c_str()[j]; - NewQual += reads[B].qual.c_str()[j]; - NewRef+= '-'; - NewPos.push_back(reads[B].Positions[i]); - NewChr.push_back(reads[B].ChrPositions[i]); - } - i=j; - //need to find last base that was alinged, insetion can mess this up so you can just take the last base pos - int k; - for (k =reads[B].Positions.size()-1; k >=0; k+= -1) - { - if (reads[B].Positions[k]+1 > 1) - break; - } - //cout << "j= " << reads[B].Positions[k]+1 << " < " << LastAlignedPos << " - " << endl; - for( j = reads[B].Positions[k]+1; j < LastAlignedPos; j++) - { - NewCigar += 'Y'; - NewSeq += toupper(Reff.getSubSequence(reads[B].chr, j, 1).c_str()[0]); - NewQual += '!'; - NewRef+= '-'; - NewPos.push_back(j); - NewChr.push_back(reads[B].chr); - } - - } - else - { - cout << "we got a translocation" << endl; - if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - cout << "mobil elemnt " << endl; - //reads[A].write(); - //reads[B].write(); - } - } - - } - else if( reads[B].Positions[i] -LastAlignedPos < 0 and abs(reads[B].Positions[i] -LastAlignedPos ) >= MaxVarentSize ) - { - if (LastAlignedQ == '!' or reads[B].qual.c_str()[i] == '!') - { - cout << "well fuck this shit F" << endl; - return reads[A]; - } - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - - - - cout << " if( "< 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "TOO BIG 1 "<< abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - - // if( /*1==1 or*/ reads[A].PeakMap[i] == 1 or reads[A].PeakMap[i-1] == 1 or reads[B].PeakMap[i] == 1 or reads[B].PeakMap[i -1] == 1) - // { - // Translocations << "TOO BIG " << abs(reads[A].Positions[i] -LastAlignedPos ) << endl; - // reads[A].writetofile(Translocations); - // reads[B].writetofile(Translocations); - // Translocations << endl << endl; - // } - } - - - if(i=0; i--) - { - if(NewCigar.c_str()[i] != 'S' and NewCigar.c_str()[i] != 'H') - { - Last = i; - break; - } - } - - for (int i = 0; i First and i < Last) - { - if (NewCigar.c_str()[i] == 'S' or NewCigar.c_str()[i] == 'H') - NewNewCigar+= 'I'; - else - NewNewCigar+=NewCigar.c_str()[i]; - } - else - NewNewCigar+=NewCigar.c_str()[i]; - - } - NewCigar = NewNewCigar; - - int UnalignedCount = 0; - for (int i =0; i 0 and Bbreak > 0 - if( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1) and ( reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0) - { - cout << "INVERSION written to file" << endl; - Translocations << "INVERSION" << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - else - { - cout << "INVERSION skipped" << endl; - } - string Acig = ""; - string Bcig = ""; - for (int i = 0; i < reads[A].seq.size(); i++) - { - char Ab = reads[A].cigarString.c_str()[i]; - char Bb = reads[B].cigarString.c_str()[i]; - if ((reads[A].cigarString.c_str()[i] == 'M' or reads[A].cigarString.c_str()[i] == 'X') and (reads[B].cigarString.c_str()[i] == 'S' or reads[B].cigarString.c_str()[i] == 'H')) - Bb = 'U'; - if ((reads[B].cigarString.c_str()[i] == 'M' or reads[B].cigarString.c_str()[i] == 'X') and (reads[A].cigarString.c_str()[i] == 'S' or reads[A].cigarString.c_str()[i] == 'H')) - Ab = 'U'; - Acig += Ab; - Bcig += Bb; - - } - reads[A].cigarString = Acig; - reads[B].cigarString = Bcig; - cout << "invertion adjust string"; - reads[A].write(); - reads[B].write(); - } - else if ((reads[A].chr == "hs37d5" and reads[B].chr != "hs37d5" ) or (reads[A].chr != "hs37d5" and reads[B].chr == "hs37d5" )) - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - - - - cout << " if( "< 0 and Bbreak > 0 - if( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1) and ( reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0) - { - Translocations << "mobil elemnt inverted" << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - } - else - { - int Abreak = findBreak(reads[A]); - int Bbreak = findBreak(reads[B]); - - - - cout << " if( "< 0 and Bbreak > 0 - if( /*1==1 or*/ (reads[A].PeakMap[Abreak] == 1 or reads[A].PeakMap[Abreak-1] == 1) and ( reads[B].PeakMap[Bbreak] == 1 or reads[B].PeakMap[Bbreak -1] == 1) and Abreak > 0 and Bbreak > 0) - { - Translocations << "we got a translocation and invertion" << endl; - reads[A].writetofile(Translocations); - reads[B].writetofile(Translocations); - Translocations << endl << endl; - Translocationsbed << reads[A].chr << "\t" << reads[A].Positions[Abreak]-200 << "\t" << reads[A].Positions[Abreak]+200 << endl << reads[B].chr << "\t" << reads[B].Positions[Bbreak]-200 << "\t" << reads[B].Positions[Bbreak]+200 << endl; - } - } - - - cout << "*********SKIPPING************\ndifference strands" << endl; - BEDNotHandled << "Different strands" << endl; - BEDNotHandled << reads[A].chr << "\t" << reads[A].pos << "\t" << reads[A].pos+reads[A].seq.size() << "\t" << reads[A].name << "\t" << reads[A].cigar << endl; - reads[A].writetofile(BEDNotHandled); - BEDNotHandled << reads[B].chr << "\t" << reads[B].pos << "\t" << reads[B].pos+reads[B].seq.size() << "\t" << reads[B].name << "\t" << reads[B].cigar << endl; - reads[B].writetofile(BEDNotHandled); - - BEDNotHandled << endl << endl; - - - Invertions << reads[A].chr << "\t" << reads[A].pos << "\t" << reads[B].pos << "\t" << reads[B].pos- reads[A].pos << endl; - - } - - //**********************Adding K-mer lookup stuff here ********************************* - - //************************************************************************************** - //reads[A].FixTandemRef(); - reads[A].LookUpKmers(); - cout << "ReAdjustedKmers" < longest){longest = count;} - count = 0; - } - - } - if (count > longest){longest = count;} - return longest; -} -bool SamRead::CheckEndsAlign() -{ - int StartAlign = 0; - int j; - for ( j = 10; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] != 'H' and cigarString.c_str()[j] != 'S') - {StartAlign++;} - else - {break;} - } - int EndAlign = 0; - int i; - for ( i = cigarString.size()-10; i>=0; i--) - { - if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') - {EndAlign++;} - else - {break;} - } - - if (StartAlign > 20 or EndAlign > 20) - { - return true; - } - -return false; -} - - -bool SamRead::StartsWithAlignAtPeak(int &pos, string &insert, int &Kdepth) -{ - cout << "starst with " << endl; - /////////////////// - int EndClip = 0; - int i; - int PeakBases = 0; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] == 'H' or cigarString.c_str()[i] == 'S') - {EndClip++;if (PeakMap[i]==1){PeakBases++;}} - else - {break;} - } - //get the inserted sequence - for (int s = i; s 40 && StartAlign > 40) - { - if ((PeakMap[i-1] or PeakMap[i] or PeakMap[i+1]) and (PeakMap[j-1] or PeakMap[j] or PeakMap[j+1])or PeakBases > 10) - {return true;} - } - - - return false; - } -bool SamRead::StartsWithAlign(int &pos, string &insert) -{ - cout << "starst with " << endl; - /////////////////// - int EndClip = 0; - int i; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] == 'H' or cigarString.c_str()[i] == 'S') - {EndClip++;} - else - {break;} - } - //get the inserted sequence - for (int s = i; s 40 && StartAlign > 40) - { - - {return true;} - } - - - return false; - } -bool SamRead::EndsWithAlignAtPeak(int &pos, string &insert, int &Kdepth) -{ - cout << "Running EndsWithAlign" << endl; - //////////////////// - int EndAlign = 0; - int i; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') - {EndAlign++;} - else - {break;} - } - pos = Positions[i+1]; - cout << "EndAlign = " << EndAlign << endl; - /////////////////// - int StartClip = 0; - int j; - int PeakBases = 0; - for ( j = 0; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] == 'H' or cigarString.c_str()[j] == 'S') - {StartClip++; if (PeakMap[j]==1){PeakBases++;}} - else - {break;} - } - cout << "StartClip = " << StartClip << endl; - - for (int s = 0; s 40 && StartClip > 40) - { - if ((PeakMap[i-1] or PeakMap[i] or PeakMap[i+1]) and (PeakMap[j-1] or PeakMap[j] or PeakMap[j+1])or PeakBases > 10 ) - {return true;} - } - - - return false; - } -bool SamRead::EndsWithAlign(int &pos, string &insert) -{ - cout << "Running EndsWithAlign" << endl; - //////////////////// - int EndAlign = 0; - int i; - for ( i = cigarString.size()-1; i>=0; i--) - { - if (cigarString.c_str()[i] != 'H' and cigarString.c_str()[i] != 'S') - {EndAlign++;} - else - {break;} - } - pos = Positions[i+1]; - cout << "EndAlign = " << EndAlign << endl; - /////////////////// - int StartClip = 0; - int j; - for ( j = 0; j< cigarString.size(); j++) - { - if (cigarString.c_str()[j] == 'H' or cigarString.c_str()[j] == 'S') - {StartClip++; } - else - {break;} - } - cout << "StartClip = " << StartClip << endl; - for (int s = 0; s 40 && StartClip > 40) - { - - {return true;} - } - - - return false; - } -int main (int argc, char *argv[]) -{ - -cout << "###########################RUNNING THIS ONE#########################" << endl; -cout << "Modes chr pos type reff alt MutRef MutAlt Par1Ref Par2Ref" << endl; -// ifstream testthis [100]; -// testthis[0].open("./test.txt"); -// string boom2; -// while (getline(testthis[0], boom2)) -// { -// cout << boom2 << endl; -// } -// return 0; - //************************************************ - //my arg parser - - string helptext; - helptext = \ -"\ -RUFUS.interpret: converts RUFUS aligned contigs into a VCF \n\ -By Andrew Farrell\n\ - The Marth Lab\n\ -\n\ -options:\ - -h [ --help ] Print help message\n\ - -sam argPath to input SAM file, omit for stdin\n\ - -r argPath to reference file \n\ - -hf argPath to HashFile from RUFUS.build\n\ - -hS argHash Size\n\ - -o argOutput stub\n\ - -m argMaximum varient size: default 1Mb\n\ -(Sorry it has to be a num, no 1kb, must be 1000\n\ - -c argPath to sorted.tab file for the parent sample\n\ - -s arg Path to sorted.tab file for the subject sample\n\ - -cR argPath to the sorted.tab file fo the parnt sample hashes in the reference\n\ - -sR argPath to the sorted.tab file fo the subject sample hashes in the reference\n\ - -mQ argMinimum map quality to consider varients in\n\ - -mod argPath to the model file from RUFUS.model\n\ - -e arg Path to Kmer file to exlude from LowCov check\n\ -"; - - string MutHashFilePath = "" ; - string MutHashFilePathReference = ""; - MaxVarentSize = 1000000; - string RefFile = ""; - string HashListFile = "" ; - string samFile = "stdin"; - string outStub= ""; - string ModelFilePath = ""; - string ExcludeFilePath = ""; - int MinMapQual = 0; - for(int i = 1; i< argc; i++) - { - cout << i << " = " << argv[i] << endl; - } - cout <<"****************************************************************************************" << endl; - vector ParentHashFilePaths; - vector ParentHashFilePathsReference; - for(int i = 1; i< argc; i++) - { - string p = argv[i]; - cout << i << " = " << argv[i]<< endl; - if( p == "-h") - { - //print help - cout << helptext << endl; - return 0; - } - else if (p == "-r") - { - RefFile = argv[i+1]; - i=i+1; - cout << "YAAAY added RefFile = " << RefFile << endl; - } - else if (p == "-sam") - { - samFile = argv[i+1]; - i++; - } - else if (p == "-o") - { - outStub = argv[i+1]; - i++; - } - else if (p == "-hf") - { - HashListFile = argv[i+1]; - i++; - } - else if (p == "-hs") - { - HashSize = atoi(argv[i+1]); - i++; - } - else if (p == "-m") - { - MaxVarentSize = atoi(argv[i+1]); - i++; - cout << "YAAAY added MaxVarSize = " << MaxVarentSize << endl; - } - else if (p == "-c") - { - cout << "Par Hash = " << argv[i+1] << endl; - ParentHashFilePaths.push_back(i+1); - i=i+1; - } - else if (p == "-cR") - { - cout << "Par Ref Hash = " << argv[i+1] << endl; - ParentHashFilePathsReference.push_back(i+1); - i=i+1; - } - else if (p == "-s") - { - cout << "Sub Hash = " << argv[i+1] << endl; - MutHashFilePath = argv[i+1]; - i+=1; - } - else if (p == "-sR") - { - cout << "Sub Hash = " << argv[i+1] << endl; - MutHashFilePathReference = argv[i+1]; - i+=1; - } - else if (p == "-mod") - { - cout << "model file = " << argv[i+1] << endl; - ModelFilePath = argv[i+1]; - i+=1; - } - else if (p == "-mQ") - { - cout << "Min Mapping Qualtiy = " << argv[i+1] << endl; - MinMapQual = atoi(argv[i+1]); - i+=1; - } - else if(p == "-e") - { - cout << "Exclue File Path = " << argv[i+1] << endl; - ExcludeFilePath = argv[i+1]; - i+=1; - } - else - { - cout << "ERROR: unkown command line paramater -" << argv[i] << "-"<< endl; - return 0; - } - - } - //check values - if (RefFile == "") - { - cout << "ERROR Reference required" << endl; - return 0; - } - if (HashListFile == "") - { - cout << "Error HashList required" << endl; - return 0; - } - if (outStub == "") - { - if (samFile != "stdin") - outStub = samFile; - else - { - cout << "ERROR out file stub required " << endl; - return -1; - } - } - - for (int i = 0; i < ParentHashFilePaths.size(); i++) - { - ifstream reader; - reader.open (argv[ParentHashFilePaths[i]]); - string line = ""; - unordered_map hl; - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - hl[hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - hl[hash] = atoi(temp[1].c_str()); - } - ParentHashes.push_back(hl); - reader.close(); - } - for (int i = 0; i < ParentHashFilePathsReference.size(); i++) - { - ifstream reader; - reader.open (argv[ParentHashFilePathsReference[i]]); - string line = ""; - unordered_map hl; - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - ParentHashes[i][hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - ParentHashes[i][hash] = atoi(temp[1].c_str()); - } - reader.close(); - } - cout << "check parent thing" << endl; - for(int i =0; i < ParentHashes.size(); i++) - { - cout << "sample " << i << endl; - } - - ifstream reader; - reader.open (MutHashFilePath); - string line = ""; - while (getline(reader, line)) - { - - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - MutantHashes[hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - MutantHashes[hash] = atoi(temp[1].c_str()); - } - reader.close(); - - reader.open (MutHashFilePathReference); - line = ""; - while (getline(reader, line)) - { - - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - MutantHashes[hash] = atoi(temp[1].c_str()); - hash = HashToLong(RevComp(temp[0])); - MutantHashes[hash] = atoi(temp[1].c_str()); - } - reader.close(); - - reader.open(ExcludeFilePath); - while (getline(reader, line)) - { - vector temp = Split(line, ' '); - unsigned long hash = HashToLong(temp[0]); - cout << "adding " << temp[0] << " with C=" << temp[1] << endl; - ExcludeHashes[hash] = atoi(temp[1].c_str()); - //hash = HashToLong(RevComp(temp[0])); - //ExcludeHashes[hash] = atoi(temp[1].c_str()); - } - reader.close(); - //*********************************************** - //cout << "Call is Reference Contigs.fa OutStub HashList MaxVarientSize" << endl; - double vm, rss, MAXvm, MAXrss; - MAXvm = 0; - MAXrss = 0; - process_mem_usage(vm, rss, MAXvm, MAXrss); - cout << "VM: " << vm << "; RSS: " << rss << endl; - - - int BufferSize = 1000; - - Reff.open(RefFile); - - ifstream ModelFile; - ModelFile.open (ModelFilePath); - if (ModelFile.is_open()) - { cout << "ModelFile is open";} - else - { - cout << "Error no model file given, not worring abou this now" << endl; - //return -1; - } - - ifstream HashList; - HashList.open (HashListFile); - if ( HashList.is_open()) - { cout << "HashList Open " << HashListFile << endl;} //cout << "##File Opend\n"; - else - { - cout << "Error, HashList could not be opened"; - return -1; - } - line = ""; - getline(HashList, line); - cout << "line = " << line << endl; - char seperator = '\t'; - vector temp = Split(line, seperator); - if (temp.size() ==1){ - cout << "separator is not tab" << endl; - seperator = ' '; - temp = Split(line, seperator); - } - else - cout << "separator is tab" << endl; - - cout << "split = " << temp[0] << " and " << temp[1] << endl; - HashSize = temp[0].size(); - if (temp.size() ==4) - { - HashSize = temp[3].length(); - Hash.insert(pair(temp[3], atoi(temp[2].c_str()))); - - while ( getline(HashList, line)) - { - vector temp = Split(line, seperator); - Hash.insert(pair(temp[3], atoi(temp[2].c_str()))); - Hash.insert(pair(RevComp(temp[3]), atoi(temp[2].c_str()))); - //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; - } - HashList.close(); - cout << "done with HashList" << endl; - } - else if (temp.size() ==2) - { - HashSize = temp[0].length(); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - Hash.insert(pair(RevComp(temp[0]), atoi(temp[1].c_str()))); - while ( getline(HashList, line)) - { - vector temp = Split(line, seperator); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; - } - HashList.close(); - cout << "done with HashList" << endl; - } - /*else if (temp.size() ==1) - { - vector temp = Split(line, ' '); - HashSize = temp[0].length(); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - Hash.insert(pair(RevComp(temp[0]), atoi(temp[1].c_str()))); - while ( getline(HashList, line)) - { - vector temp = Split(line, ' '); - Hash.insert(pair(temp[0], atoi(temp[1].c_str()))); - Hash.insert(pair(RevComp(temp[0]), atoi(temp[1].c_str()))); - //cout << "added pair " << temp[3] << "\t" << temp[2] << endl; - } - HashList.close(); - cout << "done with HashList" << endl; - }*/ - //map::iterator it; - //for ( it = Hash.begin(); it != Hash.end(); it++ ) - //{ - // cout << "-"<first<<"-" << "\t" << it->second << endl; - //} - - ifstream SamFile; - if (samFile == "stdin") - { - cout << "Sam File is STDIN" << endl; - SamFile.open ("/dev/stdin"); - } - else - { - cout << "Sam File is " << samFile << endl; - SamFile.open (samFile); - } - if ( SamFile.is_open()) - { cout << "Sam File Opend\n";} - else - { - cout << "Error, SamFile could not be opened"; - return 0; - } - - string boom = outStub; - VCFOutFile.open(boom+ ".vcf"); - BEDOutFile.open(boom+ ".vcf.bed"); - BEDBigStuff.open(boom+ ".vcf.Big.bed"); - BEDNotHandled.open(boom+ ".vcf.NotHandled.bed"); - Invertions.open(boom+".vcf.invertions.bed"); - Translocations.open(boom+ ".vcf.Translocations"); - Translocationsbed.open(boom+ ".vcf.Translocations.bed"); - Unaligned.open(boom+"vcf.Unaligned"); - - //write VCF header - VCFOutFile << "##fileformat=VCFv4.1" << endl; - VCFOutFile << "##fileDate=" << time(0) << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##FORMAT=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO=" << endl; - VCFOutFile << "##INFO="<"<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO="<< endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##INFO=" << std::endl; - - VCFOutFile << "##INFO=" << std::endl; - VCFOutFile << "##ALT=" << std::endl; - VCFOutFile << "##ALT=" << std::endl; - - VCFOutFile << "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t"; - - string samplename = outStub.substr(0, outStub.find(".generator")); - VCFOutFile << samplename; - //VCFOutFile << outStub; - for(int i =0; i Names; - vector reads; - int counter = 0; - while (getline(SamFile, line)) - { - if (line.c_str()[0] == '@') - { - cout << " HEADER LINE = " << line << endl; - vector temp = Split(line, '\t'); - cout << temp[0] << endl; - if (temp[0] == "@SQ") - { - cout << temp[1] << endl; - vector chr = Split(temp[1], ':'); - vector len = Split(temp[2], ':'); - - cout << "##contig="<< endl; - VCFOutFile <<"##contig=" << endl; - } - } - else - { - cout << line << endl; - counter ++; - SamRead read; - cout << "parse " << endl; - read.parse(line); - //if (read.mapQual > 0) - if (read.FlagBits[2] != 1)//read.flag != 4) - { - cout << "RefSeq" << endl; - read.getRefSeq(); - cout << "peak" << endl; - read.createPeakMap(); - cout << "ummm" << endl; - int a; - string b; - cout << "Aligned bases = " << read.CheckBasesAligned() << endl; - if (read.CheckBasesAligned() > 50 or read.CheckEndsAlign()) - {reads.push_back(read);} - else - {cout << "SKIPPING Alignment" << endl; read.write();} - if (counter%100 == 0) - cout << "read " << counter << " entries " << char(13); - } - //else do I want to track unaliged alignments? - } - } - cout << endl; - cout << "Read in " << reads.size() << " reads " << endl; - - - // VCFOutFile << "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t"; - //VCFOutFile << outStub << endl; - - - cout << "procesing split reads" << endl; - for (int i = 0; i < reads.size(); i++) - { - cout << "processing read " << reads[i].name << endl; - if (reads[i].alignments.size() == 0) - { - reads[i].alignments.push_back(i); - int count = 0; - for (int j = i+1; j < reads.size(); j++) - { - count++; - if (strcmp(reads[i].name.c_str(), reads[j].name.c_str()) == 0 && reads[i].pos !=reads[j].pos) - { - cout << "found mate " << reads[j].name << endl; - - reads[i].alignments.push_back(j); - reads[j].first = false; - - } - if (count > 100000) - break; - } - } - for (int j = 0; j 1) - { - cout << "picking two best alignments" << endl; - map alignScores; - for (int j = 0; j < read.alignments.size(); j++){ - float score = (float) reads[read.alignments[j]].AlignScore; - while (not (alignScores.find(score) == alignScores.end())){ - score = score * 1.0001; - } - alignScores[score] = j; - } - vector goodPos; - std::map::reverse_iterator it; - for ( it = alignScores.rbegin(); it != alignScores.rend(); it++ ) - { - cout << it->first << " - " << it->second << endl; - goodPos.push_back(it->second); - } - cout << "atempting colaps" << endl; - cout << read.name << endl; - vector R; - - for(int j =0; j < read.alignments.size(); j++) //read.alignments.size(); j++) - { - //these better be sorted by position - //if (reads[read.alignments[j]].chr == read.chr) - if (j == goodPos[0] or j == goodPos[1]) - { - R.push_back(reads[read.alignments[j]]); - cout << reads[read.alignments[j]].name << endl; - } - } - - if (R.size() ==2 & /*R[0].chr == R[1].chr & */ R[0].mapQual > 0 or R[1].mapQual > 0) - { - read = BetterWay(R); - } - } - else if(read.first and read.alignments.size() >2) - { - BEDNotHandled << "too many alignments" << endl; - BEDNotHandled << read.chr << "\t" << read.pos << "\t" << read.pos+read.seq.size() << "\t" << read.name << "\t" << read.cigar << endl; - cout << "too many alignments" << endl; - cout << read.chr << "\t" << read.pos << "\t" << read.pos+read.seq.size() << "\t" << read.name << "\t" << read.cigar << endl; - for (int j = 0; j< read.alignments.size(); j++) - { - SamRead mate = reads[read.alignments[j]]; - cout << j << "\t" << mate.chr << "\t" << mate.pos << "\t" << mate.pos+mate.seq.size() << "\t" << mate.name << "\t" << mate.cigar << endl; - BEDNotHandled << mate.chr << "\t" << mate.pos << "\t" << mate.pos+mate.seq.size() << "\t" << mate.name << "\t" << mate.cigar << endl; - mate.writetofile(BEDNotHandled); - } - BEDNotHandled << endl << endl; - } - if (read.mapQual > MinMapQual and read.alignments.size() <=2) - { - read.parseMutations(argv); - } - } - } - cout << "lets start this" << endl; - //find big insertionsf - for (int i = 0; i < reads.size()-1; i++) - { - int pos, pos2, kdep, kdep2; - string InsStart, InsEnd; - if (reads[i].StartsWithAlign(pos, InsStart)) - { - - cout << "chekingBig " << endl; - reads[i].write(); - reads[i+1].write(); - if (reads[i].name != reads[i+1].name ){cout << "names are different" << endl; }else{cout << "NAMES ERROR" << endl;} - if (reads[i].alignments.size() == 1){cout << "primary alignemts are 1" << endl;}else{cout << "PRIAMRY ALIGNEMT ERRPR " << reads[i].alignments.size() << endl; } - if (reads[i].StrandBias < 0.9 and reads[i].StrandBias > 0.1) { cout << "Primary strand bias is good " << reads[i].StrandBias << endl; }else{cout << "STRAND BIAS ERROR " << reads[i].StrandBias << endl; } - if (reads[i+1].StrandBias < 0.9 and reads[i+1].StrandBias > 0.1) { cout << "Primary strand bias is good " << reads[i+1].StrandBias << endl; }else{cout << "STRAND BIAS ERROR " << reads[i+1].StrandBias << endl; } - if (reads[i+1].alignments.size() == 1){cout << "second alignemts are 1" << endl;}else{cout << "second ALIGNEMT ERRPR " << reads[i+1].alignments.size() << endl; } - if (reads[i+1].EndsWithAlign(pos2, InsEnd)){cout << "second ends with clip" << endl;}else{cout << "SECOND NOPT CLOPPED" << endl;} - if (reads[i].mapQual > 0 or reads[i+1].mapQual > 0){cout << "passed map qual" << endl; }else{cout << "failed map qual" << endl; } - if (reads[i].StartsWithAlignAtPeak(pos, InsStart, kdep)){cout << "primary starts with clip at peak " << endl;}else{cout << "PRIMARY DOES NOT START AT PEAK" << endl; } - if (reads[i+1].EndsWithAlignAtPeak(pos2, InsEnd, kdep2)){cout << "secondary align end with clip at peak" << endl;}else{cout << "SECONDARY DOES NOT START AT PEAK" << endl;} - - if (reads[i].name != reads[i+1].name and reads[i].alignments.size() == 1 and reads[i+1].alignments.size() == 1 and reads[i].StartsWithAlign(pos, InsStart) and reads[i+1].EndsWithAlign(pos2, InsEnd) and (reads[i].StartsWithAlignAtPeak(pos, InsStart, kdep) or reads[i+1].EndsWithAlignAtPeak(pos2, InsEnd, kdep2)) and (reads[i].mapQual > 0 or reads[i+1].mapQual > 0) and abs(pos -pos2) <100 ) - { - string D = "StrandBias"; - if ((reads[i+1].StrandBias < 1.0 and reads[i+1].StrandBias > 0.0) or (reads[i].StrandBias < 1.0 and reads[i].StrandBias > 0.0)) - D = "DeNovo"; - cout << reads[i].chr << "\t" << pos << "\t" << "LargeInsert" <<"-" << D /*"."*/ << "\t" << InsStart.c_str()[0] << "\t" << InsStart << "NNNNNNNNNNNNNNNNNNNN" << InsEnd << "\t" << kdep << "-" << kdep2 << "\t" << "." << "\t" << "INS" <<"RN=" << reads[i].name << ";MQ=" << reads[i].mapQual << ";cigar=" << reads[i].cigar << ";" << "RN=" << reads[i+1].name << ";MQ=" << reads[i+1].mapQual << ";cigar=" << reads[i+1].cigar << ";" <<"CVT=" << endl ; - VCFOutFile << reads[i].chr << "\t" << pos << "\t" << "LargeInsert" <<"-" << D /*"."*/ << "\t" << InsStart.c_str()[0] << "\t" << InsStart << "NNNNNNNNNNNNNNNNNNNN" << InsEnd << "\t" << kdep << "-" << kdep2 << "\t" << "." << "\t" << "INS" <<"RN=" << reads[i].name << ";MQ=" << reads[i].mapQual << ";cigar=" << reads[i].cigar << ";" << "RN=" << reads[i+1].name << ";MQ=" << reads[i+1].mapQual << ";cigar=" << reads[i+1].cigar << ";" << "CVT=" << ";Pos=" << pos << "-" << pos2 << "-" << pos2-pos; - - string Genotype = "0/1"; - int MutRefMode = 1; - int MutAltMode = 1; - int LP = 1; - int PC = 1; - int SB = 1; - VCFOutFile << "\tGT:DP:RO:AO:LP:PC:SB" << "\t" << Genotype << ":" << MutRefMode + MutAltMode << ":" << MutRefMode << ":" << MutAltMode << ":" << LP << ":" << PC << ":" << SB << endl; - - cout << "found INSERT " << endl; reads[i].write(); reads[i+1].write(); reads[i].writeVertical(); reads[i+1].writeVertical(); - } - } - } - VCFOutFile.close(); - BEDOutFile.close(); - BEDBigStuff.close(); - BEDNotHandled.close(); - Invertions.close(); - cout << "finishing RUFUS.Interpret for " << outStub << std::endl; - return 0; -} - diff --git a/src/RUFUS.search.1kg.cpp b/src/RUFUS.search.1kg.cpp deleted file mode 100644 index 171e3493..00000000 --- a/src/RUFUS.search.1kg.cpp +++ /dev/null @@ -1,493 +0,0 @@ -/*This vertion imcorporates both copy number and mutation detection in 1 - * * it needs to be run in two sptes, first the build, then the filter - * * it is split up to allow distribution to a cluster */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define NUMINTS (1000) -#define FILESIZE (NUMINTS * sizeof(int)) - -using namespace std; - - -int HashSize = 25; -///////////////////////// -const vector Split(const string& line, const char delim) { - vector tokens; - stringstream lineStream(line); - string token; - while ( getline(lineStream, token, delim) ) - tokens.push_back(token); - return tokens; -} - -int checkPage( char *data, string hash, long int pageSize, string line) -{ - //cout << "checking page" << "with size = " << pageSize<< endl; - bool firstNew = false; - for (int i = 0; i < pageSize; i++) - { - // cout << i << endl; - // cout << data[i] << endl; - if (data[i] == '\n') - { - // cout << "n found"; - if (firstNew != true) - firstNew = true; - else - { - vector stuff; - stuff = Split(line, ' '); - string PageHash = stuff[0]; - // cout << "PageHash " << endl; - if (hash == PageHash) - { - // cout << "found a hash " << hash << " - " << PageHash; - return atoi(stuff[1].c_str()); - } - line = ""; - } - } - else if (firstNew == true) - { - // cout << "first Newline found" << endl; - line += data[i]; - } - - } - return 0; -} - -void ProcessPage( char *data, string& PageFirstHash, string& PageLastHash, long int pageSize) -{ - string line = ""; - bool firstNew = false;\ - for (int i = 0; i < pageSize; i++) - { - if (data[i] == '\n') - { - - if (firstNew == true) - break; - else - firstNew = true; - } - else if (firstNew == true) - line += data[i]; - } - - vector stuff; - stuff = Split(line, ' '); - PageFirstHash = stuff[0]; - firstNew = false; - line = ""; - for (int i = pageSize-1; i > 0; i+=-1) - { - if ( data[i] == '\n') - { - if (firstNew == true) - break; - else - firstNew = true; - } - else if(firstNew == true) - line = data[i] + line; - } - stuff = Split(line, ' '); - PageLastHash = stuff[0]; - -} - - - -int search(long int& fd, string hash, char* fileptr) -{ - //cout << "searching for " << hash << endl; - char *data; - struct stat sb; - fstat(fd, &sb); - - long int pageSize; - pageSize = sysconf(_SC_PAGE_SIZE); - long int NumPages = sb.st_size/pageSize; - //cout << "Number of pages = " << NumPages << endl; - // char *fileptr = NULL; - - long int off = 0; - long int firstPos; - long int lastPos; - firstPos = 0; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos*pageSize); - data = fileptr; - // above should get me first page - string FirstPageFirstHash; - string FirstPageLastHash; - ProcessPage(data, FirstPageFirstHash, FirstPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - //cout << FirstPageFirstHash << endl << FirstPageLastHash << endl; - //quck check to see if on first page - if (hash >= FirstPageFirstHash and hash <= FirstPageLastHash) - { - //cout << "found on first page" << endl; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, firstPos*pageSize); - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - if (hash < FirstPageFirstHash) - { - //cout << "HASH NOT IN FILE " << hash << endl; - return 0; - } - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*(NumPages-1)); - data = fileptr; - lastPos = NumPages-1; - //the above should get me the last two pages, we take two to ensure the last pages isnt just one character or something like that - - string LastPageFirstHash; - string LastPageLastHash; - ProcessPage(data, LastPageFirstHash, LastPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - //cout << LastPageFirstHash << endl << LastPageLastHash << endl; - //quck check to see if on last page - if (hash >= LastPageFirstHash and hash <= LastPageLastHash) - { - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*(NumPages-1)); - //cout << "found on last page" << endl; - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - if (hash > LastPageLastHash) - { - //cout << "HASH NOT IN FILE " << hash << endl; - return 0; - } - //start the search - int counter = 0; - while (true) - { - //cout << "ON LOOP " << counter << endl << endl; - counter++; - long int currentPage = lastPos - ((lastPos-firstPos)/2); - //cout << "checking page " << currentPage << " last = " << lastPos << " and first = " << firstPos << endl;; - if (currentPage == lastPos or currentPage == firstPos or lastPos - firstPos <= 3) - { - string extra = ""; - // cout << "\nenvoked this" << endl; - fileptr = (char*)mmap64(NULL, pageSize*5, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize * (firstPos-1)); - data = fileptr; - // cout << "made it here" << endl; - int val = checkPage(data, hash, pageSize*5, extra); - if (munmap(fileptr, pageSize*5) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - //cout << " fileptr = (char*)mmap64(NULL, " << pageSize*2 <<", PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, " << pageSize<<" * " << currentPage <<");"<< endl; - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*currentPage); - data = fileptr; - string CurrentPageFirstHash; - string CurrentPageLastHash; - ProcessPage(data, CurrentPageFirstHash, CurrentPageLastHash, pageSize); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - //cout << " with " << CurrentPageFirstHash << " and " << CurrentPageLastHash << endl; - if (hash >= CurrentPageFirstHash and hash <= CurrentPageLastHash) - { - fileptr = (char*)mmap64(NULL, pageSize, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, pageSize*currentPage); - int val = checkPage(data, hash, pageSize, ""); - if (munmap(fileptr, pageSize) == -1) { - perror("Error un-mmapping the file"); - } - return val; - } - else - { - if (hash < CurrentPageFirstHash) - { - // cout << "hash " << hash << " is greater than " << CurrentPageFirstHash << " looking above" << endl; - lastPos = currentPage; - LastPageFirstHash = CurrentPageFirstHash; - LastPageLastHash = CurrentPageLastHash; - } - else if (hash > CurrentPageLastHash) - { - // cout << "hash \n" << hash << " is less than \n" << CurrentPageLastHash << " looking below" << endl; - firstPos = currentPage; - FirstPageFirstHash = CurrentPageFirstHash; - FirstPageLastHash = CurrentPageLastHash; - } - } - - } - close(fd); - -} - -bool fncomp (char lhs, char rhs) {return lhs=0; i+= -1) - { - char C = Sequence.c_str()[i]; - // cout << C << endl; - if (C == 'A') - NewString += 'T'; - else if (C == 'C') - NewString += 'G'; - else if (C == 'G') - NewString += 'C'; - else if (C == 'T') - NewString += 'A'; - else if (C == 'N') - NewString += 'N'; - else - cout << "ERROR IN RevComp - " << C << endl; - - - } - //cout << "end\n"; - return NewString; -} - -void process_mem_usage(double& vm_usage, double& resident_set, double& MAXvm, double& MAXrss) -{ - using std::ios_base; - using std::ifstream; - using std::string; - - vm_usage = 0.0; - resident_set = 0.0; - - // 'file' stat seems to give the most reliable results - // - ifstream stat_stream("/proc/self/stat",ios_base::in); - - // dummy vars for leading entries in stat that we don't care about - // - string pid, comm, state, ppid, pgrp, session, tty_nr; - string tpgid, flags, minflt, cminflt, majflt, cmajflt; - string utime, stime, cutime, cstime, priority, nice; - string O, itrealvalue, starttime; - - // the two fields we want - // - unsigned long vsize; - long rss; - - stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr - >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt - >> utime >> stime >> cutime >> cstime >> priority >> nice - >> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest - - stat_stream.close(); - - long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages - vm_usage = vsize / 1024.0; - resident_set = rss * page_size_kb; - if (vm_usage > MAXvm){MAXvm = vm_usage;} - if (resident_set > MAXrss){MAXrss = resident_set;} -} -int main (int argc, char *argv[]) -{ -// ifstream testthis [100]; -// testthis[0].open("./test.txt"); -// string boom2; -// while (getline(testthis[0], boom2)) -// { -// cout << boom2 << endl; -// } -// return 0; - //************************************************ - //my arg parser - - string helptext; - helptext = \ -"\ -RUFUS.t: converts RUFUS aligned contigs into a VCF \n\ -By Andrew Farrell\n\ - The Marth Lab\n\ -\n\ -options:\ - -h [ --help ] Print help message\n\ - -hf arg Path to HashFile from RUFUS.build\n\ - -o arg Output stub\n\ - -c arg Path to sorted.tab file for the parent sample\n\ - -hs arg Hash size (default = 25)\n\ -"; - - string RefFile = ""; - string HashListFile = "" ; - string outStub= ""; - int Reff1kgArgPos = -1; - for(int i = 1; i< argc; i++) - { - // cout << i << " = " << argv[i] << endl; - } - //cout <<"****************************************************************************************" << endl; - for(int i = 1; i< argc; i++) - { - string p = argv[i]; - // cout << i << " = " << argv[i]<< endl; - if( p == "-h") - { - //print help - cout << helptext << endl; - return 0; - } - else if (p == "-o") - { - outStub = argv[i+1]; - i++; - } - else if (p == "-hf") - { - HashListFile = argv[i+1]; - i++; - } - else if (p == "-c") - { - // cout << "Par Hash = " << argv[i+1] << endl; - Reff1kgArgPos = i+1; - i=i+1; - } - else if (p == "-hs") - { - // cout << "Hash Size= " << argv[i+1] << endl; - HashSize = atoi(argv[i+1]); - i+=1; - } - else - { - cout << "ERROR: unkown command line paramater -" << argv[i] << "-"<< endl; - return 0; - } - - } - //check values - if (Reff1kgArgPos == -1) - { - cout << "ERROR 1kg Reference required" << endl; - return 0; - } - if (HashListFile == "") - { - cout << "Error HashList required" << endl; - return 0; - } - if (outStub == "") - { - cout << "ERROR out file stub required " << endl; - return -1; - - } - //*********************************************** - - - ifstream HashList; - HashList.open (HashListFile); - if ( HashList.is_open()) - { }// cout << "HashList Open " << HashListFile << endl;} //cout << "##File Opend\n"; - else - { - cout << "Error, HashList could not be opened"; - return 0; - } - ofstream Outfile; - Outfile.open(outStub); - if (Outfile.is_open()) - { cout << "Out file open " << outStub << endl;} - else - { - cout << "Error, out could not be opened"; - return 0; - } - - string line; - - long int Reader1kg; - char* fName = argv[Reff1kgArgPos]; - Reader1kg = open(fName, O_RDONLY); - while ( getline(HashList, line)) - { - vector temp = Split(line, ' '); - string hash = ""; - string hashcount = ""; - if (temp.size() ==2) - { - hash = temp[0]; - hashcount = temp[1]; - - //cout << temp[0]< temp = Util::Split(L6, ' '); + // todo: why are we iterating through same data twice? for (vector::size_type i = 0; i < temp.size(); i++) { unsigned char C = atoi(temp[i].c_str()); depths += C; diff --git a/src/externals/fastahack/Fasta.o b/src/externals/fastahack/Fasta.o deleted file mode 100644 index 92e79b52..00000000 Binary files a/src/externals/fastahack/Fasta.o and /dev/null differ diff --git a/src/externals/fastahack/tests/correct.fasta b/src/externals/fastahack/tests/correct.fasta deleted file mode 100644 index 99af0c03..00000000 --- a/src/externals/fastahack/tests/correct.fasta +++ /dev/null @@ -1,30 +0,0 @@ ->1 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCTAACC -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGGCGCAGGCG ->2 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCTAACC -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAAC ->3 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGGCGCAGGCG -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCT diff --git a/src/externals/fastahack/tests/embedded_newline.fasta b/src/externals/fastahack/tests/embedded_newline.fasta deleted file mode 100644 index 26b21e72..00000000 --- a/src/externals/fastahack/tests/embedded_newline.fasta +++ /dev/null @@ -1,35 +0,0 @@ ->1 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCTAACC -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGGCGCAGGCG - - - ->2 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA - -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCTAACC -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAAC - ->3 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGGCGCAGGCG -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCT diff --git a/src/externals/fastahack/tests/mismatched_lines.fasta b/src/externals/fastahack/tests/mismatched_lines.fasta deleted file mode 100644 index 56a7020c..00000000 --- a/src/externals/fastahack/tests/mismatched_lines.fasta +++ /dev/null @@ -1,30 +0,0 @@ ->1 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCTAACC -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGGCGCAGGCG ->2 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCTAACC -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAAC ->3 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCT -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGGCGCAGGCG diff --git a/src/externals/fastahack/tests/trailing_newlines.fasta b/src/externals/fastahack/tests/trailing_newlines.fasta deleted file mode 100644 index 377513f2..00000000 --- a/src/externals/fastahack/tests/trailing_newlines.fasta +++ /dev/null @@ -1,34 +0,0 @@ ->1 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCTAACC -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGGCGCAGGCG - - - ->2 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCTAACC -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAAC - ->3 -TAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAC -CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCAACCCTAACCCTAACCCTAACCCTAACCCTAA -CCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCTAACCCT -AACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTAACCCTAACCCTAACCCTA -CTACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTA -ACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCCG -CCCGCCCGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAC -AACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGGCGCAGGCG -ACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCAACCCTAACCCCTAACCCTAACCCT diff --git a/src/externals/patches/jellyfish-configure-ac.patch b/src/externals/patches/jellyfish-configure-ac.patch new file mode 100644 index 00000000..4027e484 --- /dev/null +++ b/src/externals/patches/jellyfish-configure-ac.patch @@ -0,0 +1,15 @@ +--- configure.ac.orig 2026-01-24 01:23:15.513188674 +0000 ++++ configure.ac 2026-01-24 01:23:38.873344707 +0000 +@@ -18,9 +18,9 @@ + + # Check for md5 or md5sum + AC_ARG_VAR([MD5], [Path to md5 hashing program]) +-AS_IF([test "x$MD5" = "x"], AC_CHECK_PROG([MD5], [md5sum], [md5sum]), []) +-AS_IF([test "x$MD5" = "x"], AC_CHECK_PROG([MD5], [md5], [md5 -r]), []) +-AS_IF([test "x$MD5" = "x"], AC_MSG_ERROR([Could not find md5 hashing program in your path]), []) ++AS_IF([test "x$MD5" = "x"], [AC_CHECK_PROG([MD5], [md5sum], [md5sum])], []) ++AS_IF([test "x$MD5" = "x"], [AC_CHECK_PROG([MD5], [md5], [md5 -r])], []) ++AS_IF([test "x$MD5" = "x"], [AC_MSG_ERROR([Could not find md5 hashing program in your path])], []) + + # Check for yaggo + AC_ARG_VAR([YAGGO], [Yaggo switch parser generator]) diff --git a/src/include/Fasta.o b/src/include/Fasta.o deleted file mode 100644 index 92e79b52..00000000 Binary files a/src/include/Fasta.o and /dev/null differ diff --git a/src/include/disorder.o b/src/include/disorder.o deleted file mode 100644 index d0d05e74..00000000 Binary files a/src/include/disorder.o and /dev/null differ diff --git a/src/include/split.o b/src/include/split.o deleted file mode 100644 index 0ef60eea..00000000 Binary files a/src/include/split.o and /dev/null differ diff --git a/src/launchUtilities.cpp b/src/launchUtilities.cpp deleted file mode 100644 index 83dfa457..00000000 --- a/src/launchUtilities.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// -// Created by Stephanie Georges on 8/13/24. -// -#include -#include -#include - -class Chunk { -private: - std::string* chroms; - static std::array grch38_chroms = { - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "11", - "12", - "13", - "14", - "15", - "16", - "17", - "18", - "19", - "20", - "21", - "22", - "X", - "Y" - }; - std::string* lengths; - static std::array grch38_chrom_lengths = { - 248956422, - 242193529, - 198295559, - 190214555, - 181538259, - 170805979, - 159345973, - 145138636, - 138394717, - 133797422, - 135086622, - 133275309, - 114364328, - 107043718, - 101991189, - 90338345, - 83257441, - 80373285, - 58617616, - 64444167, - 46709983, - 50818468, - 156040895, - 57227415 - }; -public: - // Constructor - Chunk(int chunkSize, string species, string build) { - this->chunkSize = chunkSize; - if (build == "GRCh38" && species == "human") { - this->chroms = grch38_chroms; - this->lengths = grch38_chrom_lengths; - } else { - std::cout << "Genome not found" << std::endl; - } - } - - // Returns chromosome and coordinates for a given chunk - std::string getChunk(int chunkNum) { - int chunkStart = 0; - int chunkEnd = 0; - int chunkSize = this->chunkSize; - for (int i = 0; i < this->chroms.size(); i++) { - if (chunkNum < this->lengths[i] / chunkSize) { - chunkStart = chunkNum * chunkSize; - chunkEnd = chunkStart + chunkSize; - return this->chroms[i] + ":" + std::to_string(chunkStart) + "-" + std::to_string(chunkEnd); - } else { - chunkNum -= this->lengths[i] / chunkSize; - } - } - return "Chunk not found"; - -R chr${curr_chr}:${start_coord}-${end_coord} - } -}; \ No newline at end of file diff --git a/src/modifiedJellyfish b/src/modifiedJellyfish new file mode 160000 index 00000000..9556cfae --- /dev/null +++ b/src/modifiedJellyfish @@ -0,0 +1 @@ +Subproject commit 9556cfaeabedf179166775d214c1f815e736a69a diff --git a/src/modifiedJellyfish.tar.gz b/src/modifiedJellyfish.tar.gz deleted file mode 100644 index 5e6b685d..00000000 Binary files a/src/modifiedJellyfish.tar.gz and /dev/null differ diff --git a/src/modifiedJellyfish/LICENSE b/src/modifiedJellyfish/LICENSE deleted file mode 100644 index 94a9ed02..00000000 --- a/src/modifiedJellyfish/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - 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/src/modifiedJellyfish/Makefile.am b/src/modifiedJellyfish/Makefile.am deleted file mode 100644 index 1a6ae27b..00000000 --- a/src/modifiedJellyfish/Makefile.am +++ /dev/null @@ -1,221 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 - -EXTRA_DIST = doc/jellyfish.pdf doc/jellyfish.man README LICENSE # jellyfish.spec -man1_MANS = doc/jellyfish.man - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = jellyfish-2.0.pc - -AM_LDFLAGS = -lpthread # $(VALGRIND_LIBS) -AM_CPPFLAGS = -Wall -Wnon-virtual-dtor -I$(srcdir) -I$(srcdir)/include -g -O3 $(VALGRIND_CFLAGS) -AM_CXXFLAGS = $(ALL_CXXFLAGS) -g -O3 - -noinst_HEADERS = $(YAGGO_SOURCES) -bin_PROGRAMS = -dist_bin_SCRIPTS = -data_DATA = -BUILT_SOURCES = $(YAGGO_SOURCES) -CLEANFILES = -DISTCLEANFILES = $(BUILT_SOURCES) - -# Yaggo automatic rules with silencing -V_YAGGO = $(V_YAGGO_$(V)) -V_YAGGO_ = $(V_YAGGO_$(AM_DEFAULT_VERBOSITY)) -V_YAGGO_0 = @echo " YAGGO " $@; -.yaggo.hpp: - $(V_YAGGO)$(YAGGO) --license $(srcdir)/header-license -o $@ $< - -YAGGO_SOURCES = # Append all file to be built by yaggo - -# What to build -bin_PROGRAMS += bin/jellyfish -lib_LTLIBRARIES = libjellyfish-2.0.la -LDADD = libjellyfish-2.0.la # $(VALGRIND_LIBS) -check_PROGRAMS = bin/generate_sequence - -############################ -# Build Jellyfish the exec # -############################ -bin_jellyfish_SOURCES = sub_commands/jellyfish.cc \ - sub_commands/count_main.cc \ - sub_commands/info_main.cc \ - sub_commands/dump_main.cc \ - sub_commands/histo_main.cc \ - sub_commands/stats_main.cc \ - sub_commands/merge_main.cc \ - sub_commands/bc_main.cc \ - sub_commands/query_main.cc \ - sub_commands/cite_main.cc \ - sub_commands/mem_main.cc \ - jellyfish/merge_files.cc -bin_jellyfish_LDFLAGS = $(AM_LDFLAGS) $(STATIC_FLAGS) - - -YAGGO_SOURCES += sub_commands/count_main_cmdline.hpp \ - sub_commands/info_main_cmdline.hpp \ - sub_commands/dump_main_cmdline.hpp \ - sub_commands/histo_main_cmdline.hpp \ - sub_commands/stats_main_cmdline.hpp \ - sub_commands/merge_main_cmdline.hpp \ - sub_commands/bc_main_cmdline.hpp \ - sub_commands/query_main_cmdline.hpp \ - sub_commands/cite_main_cmdline.hpp \ - sub_commands/mem_main_cmdline.hpp - -###################################### -# Build Jellyfish the shared library # -###################################### -libjellyfish_2_0_la_LDFLAGS = -version-info 2:0:0 -libjellyfish_2_0_la_SOURCES = lib/rectangular_binary_matrix.cc \ - lib/mer_dna.cc lib/storage.cc \ - lib/allocators_mmap.cc lib/misc.cc \ - lib/int128.cc lib/thread_exec.cc \ - lib/jsoncpp.cpp lib/time.cc \ - lib/generator_manager.cc - - -library_includedir=$(includedir)/jellyfish-@PACKAGE_VERSION@/jellyfish -JFI = include/jellyfish -library_include_HEADERS = $(JFI)/allocators_mmap.hpp \ - $(JFI)/backtrace.hpp $(JFI)/atomic_gcc.hpp \ - $(JFI)/large_hash_array.hpp $(JFI)/err.hpp \ - $(JFI)/misc.hpp \ - $(JFI)/offsets_key_value.hpp \ - $(JFI)/int128.hpp \ - $(JFI)/rectangular_binary_matrix.hpp \ - $(JFI)/mer_dna.hpp $(JFI)/storage.hpp \ - $(JFI)/simple_circular_buffer.hpp \ - $(JFI)/circular_buffer.hpp \ - $(JFI)/atomic_field.hpp \ - $(JFI)/compare_and_swap.hpp \ - $(JFI)/divisor.hpp \ - $(JFI)/large_hash_iterator.hpp \ - $(JFI)/jellyfish.hpp $(JFI)/thread_exec.hpp \ - $(JFI)/stream_iterator.hpp \ - $(JFI)/mer_overlap_sequence_parser.hpp \ - $(JFI)/whole_sequence_parser.hpp \ - $(JFI)/binary_dumper.hpp \ - $(JFI)/sorted_dumper.hpp \ - $(JFI)/text_dumper.hpp $(JFI)/dumper.hpp \ - $(JFI)/time.hpp $(JFI)/mer_heap.hpp \ - $(JFI)/token_ring.hpp \ - $(JFI)/locks_pthread.hpp \ - $(JFI)/file_header.hpp \ - $(JFI)/generic_file_header.hpp \ - $(JFI)/json.h $(JFI)/hash_counter.hpp \ - $(JFI)/mapped_file.hpp \ - $(JFI)/mer_dna_bloom_counter.hpp \ - $(JFI)/bloom_common.hpp \ - $(JFI)/bloom_counter2.hpp \ - $(JFI)/bloom_filter.hpp \ - $(JFI)/cooperative_pool.hpp \ - $(JFI)/cooperative_pool2.hpp \ - $(JFI)/stream_manager.hpp \ - $(JFI)/generator_manager.hpp \ - $(JFI)/cpp_array.hpp \ - $(JFI)/mer_iterator.hpp \ - $(JFI)/atomic_bits_array.hpp \ - $(JFI)/stdio_filebuf.hpp \ - $(JFI)/mer_qual_iterator.hpp - - -noinst_HEADERS += jellyfish/fstream_default.hpp jellyfish/dbg.hpp \ - jellyfish/randomc.h jellyfish/merge_files.hpp - -############### -# Build tests # -############### -bin_generate_sequence_SOURCES = jellyfish/generate_sequence.cc \ - jellyfish/mersenne.cpp \ - jellyfish/backtrace.cc \ - jellyfish/dbg.cc -YAGGO_SOURCES += jellyfish/generate_sequence_cmdline.hpp - -######### -# Tests # -######### -TEST_EXTENSIONS = .sh -SH_LOG_COMPILER = $(SHELL) -AM_SH_LOG_FLAGS = - -TESTS = tests/generate_sequence.sh tests/parallel_hashing.sh \ - tests/merge.sh tests/bloom_filter.sh tests/big.sh \ - tests/subset_hashing.sh tests/multi_file.sh \ - tests/bloom_counter.sh tests/large_key.sh - -EXTRA_DIST += $(TESTS) -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - -cd tests; rm -f * - -tests/parallel_hashing.log: tests/generate_sequence.log -tests/subset_hashing.log: tests/generate_sequence.log -tests/bloom_filter.log: tests/generate_sequence.log -tests/bloom_counter.log: tests/generate_sequence.log -tests/multi_file.log: tests/generate_sequence.log -tests/merge.log: tests/generate_sequence.log -tests/min_qual.log: tests/generate_fastq_sequence.log -tests/large_key.log: tests/generate_sequence.log -tests/quality_filter.log: tests/generate_sequence.log - -# SWIG tests -TESTS += tests/swig_python.sh tests/swig_ruby.sh tests/swig_perl.sh -tests/swig_python.log: tests/generate_sequence.log -tests/swig_ruby.log: tests/generate_sequence.log -tests/swig_perl.log: tests/generate_sequence.log -EXTRA_DIST += swig/python/test_mer_file.py swig/python/test_hash_counter.py swig/python/test_string_mers.py -EXTRA_DIST += swig/ruby/test_mer_file.rb swig/ruby/test_hash_counter.rb swig/ruby/test_string_mers.rb -EXTRA_DIST += swig/perl5/t/test_mer_file.t swig/perl5/t/test_hash_counter.t swig/perl5/t/test_string_mers.t - - -############## -# Unit tests # -############## -TESTS += unit_tests/unit_tests.sh -check_PROGRAMS += bin/test_all - -bin_test_all_SOURCES = unit_tests/test_main.cc \ - unit_tests/test_misc.cc \ - unit_tests/test_offsets_key_value.cc \ - unit_tests/test_simple_circular_buffer.cc \ - unit_tests/test_rectangular_binary_matrix.cc \ - unit_tests/test_mer_dna.cc \ - unit_tests/test_large_hash_array.cc \ - unit_tests/test_mer_overlap_sequence_parser.cc \ - unit_tests/test_file_header.cc \ - unit_tests/test_mer_iterator.cc \ - unit_tests/test_hash_counter.cc \ - unit_tests/test_mer_heap.cc \ - unit_tests/test_stream_iterator.cc \ - unit_tests/test_token_ring.cc \ - unit_tests/test_text_dumper.cc \ - unit_tests/test_dumpers.cc \ - unit_tests/test_mapped_file.cc \ - unit_tests/test_int128.cc \ - unit_tests/test_mer_dna_bloom_counter.cc \ - unit_tests/test_whole_sequence_parser.cc \ - unit_tests/test_allocators_mmap.cc \ - unit_tests/test_cooperative_pool2.cc \ - unit_tests/test_generator_manager.cc \ - unit_tests/test_atomic_bits_array.cc \ - unit_tests/test_stdio_filebuf.cc -bin_test_all_SOURCES += jellyfish/backtrace.cc - -bin_test_all_CPPFLAGS = -DJSON_IS_AMALGAMATION=1 -bin_test_all_CXXFLAGS = $(AM_CXXFLAGS) -I$(srcdir)/unit_tests/gtest/include -I$(srcdir)/unit_tests -I$(srcdir)/include -bin_test_all_LDADD = libgtest.la $(LDADD) -YAGGO_SOURCES += unit_tests/test_main_cmdline.hpp -noinst_HEADERS += unit_tests/test_main.hpp - -################# -# SWIG bindings # -################# -include swig/Makefile.am - -include gtest.mk --include $(srcdir)/development.mk - -# Print the value of a variable -print-%: - @echo -n $($*) diff --git a/src/modifiedJellyfish/Makefile.in b/src/modifiedJellyfish/Makefile.in deleted file mode 100644 index 6f510ab4..00000000 --- a/src/modifiedJellyfish/Makefile.in +++ /dev/null @@ -1,2773 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - - - - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -bin_PROGRAMS = bin/jellyfish$(EXEEXT) -check_PROGRAMS = bin/generate_sequence$(EXEEXT) bin/test_all$(EXEEXT) -DIST_COMMON = $(srcdir)/swig/Makefile.am $(srcdir)/gtest.mk \ - $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/configure $(am__configure_deps) \ - $(srcdir)/config.h.in $(top_srcdir)/tests/compat.sh.in \ - $(srcdir)/jellyfish-2.0.pc.in $(dist_bin_SCRIPTS) depcomp \ - $(library_include_HEADERS) $(noinst_HEADERS) test-driver \ - README compile config.guess config.sub install-sh missing \ - ltmain.sh -@PYTHON_BINDING_TRUE@am__append_1 = $(PYTHON_BUILT) -@PYTHON_BINDING_TRUE@am__append_2 = $(PYTHON_BUILT) $(pythonext_SCRIPTS) -@PYTHON_BINDING_TRUE@am__append_3 = $(PYTHON_BUILT) -@RUBY_BINDING_TRUE@am__append_4 = $(RUBY_BUILT) -@RUBY_BINDING_TRUE@am__append_5 = $(RUBY_BUILT) -@PERL_BINDING_TRUE@am__append_6 = $(PERL_BUILT) -@PERL_BINDING_TRUE@am__append_7 = $(PERL_BUILT) -@PERL_BINDING_TRUE@am__append_8 = $(PERL_BUILT) -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/m4-ax_perl_ext.m4 \ - $(top_srcdir)/m4/m4-ax_pkg_swig.m4 \ - $(top_srcdir)/m4/m4-ax_python_devel.m4 \ - $(top_srcdir)/m4/m4-ax_ruby_ext.m4 \ - $(top_srcdir)/m4/m4-ax_swig_enable_cxx.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = tests/compat.sh jellyfish-2.0.pc -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(perlextdir)" \ - "$(DESTDIR)$(pythonextdir)" "$(DESTDIR)$(rubyextdir)" \ - "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \ - "$(DESTDIR)$(perlextdir)" "$(DESTDIR)$(pythonextdir)" \ - "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(datadir)" \ - "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(library_includedir)" -LTLIBRARIES = $(lib_LTLIBRARIES) $(perlext_LTLIBRARIES) \ - $(pythonext_LTLIBRARIES) $(rubyext_LTLIBRARIES) -libgtest_la_LIBADD = -am__dirstamp = $(am__leading_dot)dirstamp -am_libgtest_la_OBJECTS = \ - unit_tests/gtest/src/libgtest_la-gtest-all.lo -libgtest_la_OBJECTS = $(am_libgtest_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libgtest_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libgtest_la_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -libgtest_main_la_DEPENDENCIES = libgtest.la -am_libgtest_main_la_OBJECTS = \ - unit_tests/gtest/src/libgtest_main_la-gtest_main.lo -libgtest_main_la_OBJECTS = $(am_libgtest_main_la_OBJECTS) -libgtest_main_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(libgtest_main_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -libjellyfish_2_0_la_LIBADD = -am_libjellyfish_2_0_la_OBJECTS = lib/rectangular_binary_matrix.lo \ - lib/mer_dna.lo lib/storage.lo lib/allocators_mmap.lo \ - lib/misc.lo lib/int128.lo lib/thread_exec.lo lib/jsoncpp.lo \ - lib/time.lo lib/generator_manager.lo -libjellyfish_2_0_la_OBJECTS = $(am_libjellyfish_2_0_la_OBJECTS) -libjellyfish_2_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(libjellyfish_2_0_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -@PERL_BINDING_TRUE@swig_perl5_jellyfish_la_DEPENDENCIES = \ -@PERL_BINDING_TRUE@ libjellyfish-2.0.la -am__swig_perl5_jellyfish_la_SOURCES_DIST = swig/perl5/swig_wrap.cpp \ - swig/jellyfish.i swig/hash_counter.i swig/hash_set.i \ - swig/mer_dna.i swig/mer_file.i swig/string_mers.i -am__objects_1 = -@PERL_BINDING_TRUE@am_swig_perl5_jellyfish_la_OBJECTS = swig/perl5/swig_perl5_jellyfish_la-swig_wrap.lo \ -@PERL_BINDING_TRUE@ $(am__objects_1) -swig_perl5_jellyfish_la_OBJECTS = \ - $(am_swig_perl5_jellyfish_la_OBJECTS) -swig_perl5_jellyfish_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(swig_perl5_jellyfish_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -@PERL_BINDING_TRUE@am_swig_perl5_jellyfish_la_rpath = -rpath \ -@PERL_BINDING_TRUE@ $(perlextdir) -@PYTHON_BINDING_TRUE@swig_python__jellyfish_la_DEPENDENCIES = \ -@PYTHON_BINDING_TRUE@ libjellyfish-2.0.la -am__swig_python__jellyfish_la_SOURCES_DIST = \ - swig/python/swig_wrap.cpp swig/jellyfish.i swig/hash_counter.i \ - swig/hash_set.i swig/mer_dna.i swig/mer_file.i \ - swig/string_mers.i -@PYTHON_BINDING_TRUE@am_swig_python__jellyfish_la_OBJECTS = swig/python/swig_python__jellyfish_la-swig_wrap.lo \ -@PYTHON_BINDING_TRUE@ $(am__objects_1) -swig_python__jellyfish_la_OBJECTS = \ - $(am_swig_python__jellyfish_la_OBJECTS) -swig_python__jellyfish_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) \ - $(swig_python__jellyfish_la_LDFLAGS) $(LDFLAGS) -o $@ -@PYTHON_BINDING_TRUE@am_swig_python__jellyfish_la_rpath = -rpath \ -@PYTHON_BINDING_TRUE@ $(pythonextdir) -@RUBY_BINDING_TRUE@swig_ruby_jellyfish_la_DEPENDENCIES = \ -@RUBY_BINDING_TRUE@ libjellyfish-2.0.la -am__swig_ruby_jellyfish_la_SOURCES_DIST = swig/ruby/swig_wrap.cpp \ - swig/jellyfish.i swig/hash_counter.i swig/hash_set.i \ - swig/mer_dna.i swig/mer_file.i swig/string_mers.i -@RUBY_BINDING_TRUE@am_swig_ruby_jellyfish_la_OBJECTS = swig/ruby/swig_ruby_jellyfish_la-swig_wrap.lo \ -@RUBY_BINDING_TRUE@ $(am__objects_1) -swig_ruby_jellyfish_la_OBJECTS = $(am_swig_ruby_jellyfish_la_OBJECTS) -swig_ruby_jellyfish_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(swig_ruby_jellyfish_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -@RUBY_BINDING_TRUE@am_swig_ruby_jellyfish_la_rpath = -rpath \ -@RUBY_BINDING_TRUE@ $(rubyextdir) -PROGRAMS = $(bin_PROGRAMS) -am_bin_generate_sequence_OBJECTS = \ - jellyfish/generate_sequence.$(OBJEXT) \ - jellyfish/mersenne.$(OBJEXT) jellyfish/backtrace.$(OBJEXT) \ - jellyfish/dbg.$(OBJEXT) -bin_generate_sequence_OBJECTS = $(am_bin_generate_sequence_OBJECTS) -bin_generate_sequence_LDADD = $(LDADD) -bin_generate_sequence_DEPENDENCIES = libjellyfish-2.0.la -am_bin_jellyfish_OBJECTS = sub_commands/jellyfish.$(OBJEXT) \ - sub_commands/count_main.$(OBJEXT) \ - sub_commands/info_main.$(OBJEXT) \ - sub_commands/dump_main.$(OBJEXT) \ - sub_commands/histo_main.$(OBJEXT) \ - sub_commands/stats_main.$(OBJEXT) \ - sub_commands/merge_main.$(OBJEXT) \ - sub_commands/bc_main.$(OBJEXT) \ - sub_commands/query_main.$(OBJEXT) \ - sub_commands/cite_main.$(OBJEXT) \ - sub_commands/mem_main.$(OBJEXT) \ - jellyfish/merge_files.$(OBJEXT) -bin_jellyfish_OBJECTS = $(am_bin_jellyfish_OBJECTS) -bin_jellyfish_LDADD = $(LDADD) -bin_jellyfish_DEPENDENCIES = libjellyfish-2.0.la -bin_jellyfish_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(bin_jellyfish_LDFLAGS) $(LDFLAGS) \ - -o $@ -am_bin_test_all_OBJECTS = unit_tests/bin_test_all-test_main.$(OBJEXT) \ - unit_tests/bin_test_all-test_misc.$(OBJEXT) \ - unit_tests/bin_test_all-test_offsets_key_value.$(OBJEXT) \ - unit_tests/bin_test_all-test_simple_circular_buffer.$(OBJEXT) \ - unit_tests/bin_test_all-test_rectangular_binary_matrix.$(OBJEXT) \ - unit_tests/bin_test_all-test_mer_dna.$(OBJEXT) \ - unit_tests/bin_test_all-test_large_hash_array.$(OBJEXT) \ - unit_tests/bin_test_all-test_mer_overlap_sequence_parser.$(OBJEXT) \ - unit_tests/bin_test_all-test_file_header.$(OBJEXT) \ - unit_tests/bin_test_all-test_mer_iterator.$(OBJEXT) \ - unit_tests/bin_test_all-test_hash_counter.$(OBJEXT) \ - unit_tests/bin_test_all-test_mer_heap.$(OBJEXT) \ - unit_tests/bin_test_all-test_stream_iterator.$(OBJEXT) \ - unit_tests/bin_test_all-test_token_ring.$(OBJEXT) \ - unit_tests/bin_test_all-test_text_dumper.$(OBJEXT) \ - unit_tests/bin_test_all-test_dumpers.$(OBJEXT) \ - unit_tests/bin_test_all-test_mapped_file.$(OBJEXT) \ - unit_tests/bin_test_all-test_int128.$(OBJEXT) \ - unit_tests/bin_test_all-test_mer_dna_bloom_counter.$(OBJEXT) \ - unit_tests/bin_test_all-test_whole_sequence_parser.$(OBJEXT) \ - unit_tests/bin_test_all-test_allocators_mmap.$(OBJEXT) \ - unit_tests/bin_test_all-test_cooperative_pool2.$(OBJEXT) \ - unit_tests/bin_test_all-test_generator_manager.$(OBJEXT) \ - unit_tests/bin_test_all-test_atomic_bits_array.$(OBJEXT) \ - unit_tests/bin_test_all-test_stdio_filebuf.$(OBJEXT) \ - jellyfish/bin_test_all-backtrace.$(OBJEXT) -bin_test_all_OBJECTS = $(am_bin_test_all_OBJECTS) -bin_test_all_DEPENDENCIES = libgtest.la $(LDADD) -bin_test_all_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(bin_test_all_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SCRIPTS = $(dist_bin_SCRIPTS) $(perlext_SCRIPTS) $(pythonext_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(libgtest_la_SOURCES) $(libgtest_main_la_SOURCES) \ - $(libjellyfish_2_0_la_SOURCES) \ - $(swig_perl5_jellyfish_la_SOURCES) \ - $(swig_python__jellyfish_la_SOURCES) \ - $(swig_ruby_jellyfish_la_SOURCES) \ - $(bin_generate_sequence_SOURCES) $(bin_jellyfish_SOURCES) \ - $(bin_test_all_SOURCES) -DIST_SOURCES = $(libgtest_la_SOURCES) $(libgtest_main_la_SOURCES) \ - $(libjellyfish_2_0_la_SOURCES) \ - $(am__swig_perl5_jellyfish_la_SOURCES_DIST) \ - $(am__swig_python__jellyfish_la_SOURCES_DIST) \ - $(am__swig_ruby_jellyfish_la_SOURCES_DIST) \ - $(bin_generate_sequence_SOURCES) $(bin_jellyfish_SOURCES) \ - $(bin_test_all_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -man1dir = $(mandir)/man1 -NROFF = nroff -MANS = $(man1_MANS) -DATA = $(data_DATA) $(pkgconfig_DATA) -HEADERS = $(library_include_HEADERS) $(noinst_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope -AM_RECURSIVE_TARGETS = cscope check recheck -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red=''; \ - grn=''; \ - lgn=''; \ - blu=''; \ - mgn=''; \ - brg=''; \ - std=''; \ - fi; \ -} -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -TEST_SUITE_LOG = test-suite.log -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.sh.log=.log) -SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__post_remove_distdir = $(am__remove_distdir) -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -DIST_TARGETS = dist-gzip -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -ALL_CXXFLAGS = @ALL_CXXFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MD5 = @MD5@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_LIB = @PACKAGE_LIB@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_EXT_CPPFLAGS = @PERL_EXT_CPPFLAGS@ -PERL_EXT_INC = @PERL_EXT_INC@ -PERL_EXT_LDFLAGS = @PERL_EXT_LDFLAGS@ -PERL_EXT_LIB = @PERL_EXT_LIB@ -PERL_EXT_PREFIX = @PERL_EXT_PREFIX@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PYTHON = @PYTHON@ -PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ -PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ -PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ -PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ -PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -RUBY = @RUBY@ -RUBY_EXT_CFLAGS = @RUBY_EXT_CFLAGS@ -RUBY_EXT_LDFLAGS = @RUBY_EXT_LDFLAGS@ -RUBY_EXT_LIB = @RUBY_EXT_LIB@ -RUBY_EXT_LIBS = @RUBY_EXT_LIBS@ -RUBY_VERSION = @RUBY_VERSION@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STATIC_FLAGS = @STATIC_FLAGS@ -STRIP = @STRIP@ -SWIG = @SWIG@ -SWIG_LIB = @SWIG_LIB@ -VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ -VALGRIND_LIBS = @VALGRIND_LIBS@ -VERSION = @VERSION@ -YAGGO = @YAGGO@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -ACLOCAL_AMFLAGS = -I m4 -EXTRA_DIST = doc/jellyfish.pdf doc/jellyfish.man README LICENSE \ - $(TESTS) swig/python/test_mer_file.py \ - swig/python/test_hash_counter.py \ - swig/python/test_string_mers.py swig/ruby/test_mer_file.rb \ - swig/ruby/test_hash_counter.rb swig/ruby/test_string_mers.rb \ - swig/perl5/t/test_mer_file.t swig/perl5/t/test_hash_counter.t \ - swig/perl5/t/test_string_mers.t $(am__append_3) \ - $(am__append_8) $(GTEST_SRC) -man1_MANS = doc/jellyfish.man -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = jellyfish-2.0.pc -AM_LDFLAGS = -lpthread # $(VALGRIND_LIBS) -AM_CPPFLAGS = -Wall -Wnon-virtual-dtor -I$(srcdir) -I$(srcdir)/include -g -O3 $(VALGRIND_CFLAGS) -AM_CXXFLAGS = $(ALL_CXXFLAGS) -g -O3 -noinst_HEADERS = $(YAGGO_SOURCES) jellyfish/fstream_default.hpp \ - jellyfish/dbg.hpp jellyfish/randomc.h \ - jellyfish/merge_files.hpp unit_tests/test_main.hpp -dist_bin_SCRIPTS = -data_DATA = -BUILT_SOURCES = $(YAGGO_SOURCES) $(am__append_1) $(am__append_4) \ - $(am__append_6) -CLEANFILES = $(am__append_2) $(am__append_5) $(am__append_7) -DISTCLEANFILES = $(BUILT_SOURCES) - -# Yaggo automatic rules with silencing -V_YAGGO = $(V_YAGGO_$(V)) -V_YAGGO_ = $(V_YAGGO_$(AM_DEFAULT_VERBOSITY)) -V_YAGGO_0 = @echo " YAGGO " $@; -YAGGO_SOURCES = sub_commands/count_main_cmdline.hpp \ - sub_commands/info_main_cmdline.hpp \ - sub_commands/dump_main_cmdline.hpp \ - sub_commands/histo_main_cmdline.hpp \ - sub_commands/stats_main_cmdline.hpp \ - sub_commands/merge_main_cmdline.hpp \ - sub_commands/bc_main_cmdline.hpp \ - sub_commands/query_main_cmdline.hpp \ - sub_commands/cite_main_cmdline.hpp \ - sub_commands/mem_main_cmdline.hpp \ - jellyfish/generate_sequence_cmdline.hpp \ - unit_tests/test_main_cmdline.hpp -lib_LTLIBRARIES = libjellyfish-2.0.la -LDADD = libjellyfish-2.0.la # $(VALGRIND_LIBS) - -############################ -# Build Jellyfish the exec # -############################ -bin_jellyfish_SOURCES = sub_commands/jellyfish.cc \ - sub_commands/count_main.cc \ - sub_commands/info_main.cc \ - sub_commands/dump_main.cc \ - sub_commands/histo_main.cc \ - sub_commands/stats_main.cc \ - sub_commands/merge_main.cc \ - sub_commands/bc_main.cc \ - sub_commands/query_main.cc \ - sub_commands/cite_main.cc \ - sub_commands/mem_main.cc \ - jellyfish/merge_files.cc - -bin_jellyfish_LDFLAGS = $(AM_LDFLAGS) $(STATIC_FLAGS) - -###################################### -# Build Jellyfish the shared library # -###################################### -libjellyfish_2_0_la_LDFLAGS = -version-info 2:0:0 -libjellyfish_2_0_la_SOURCES = lib/rectangular_binary_matrix.cc \ - lib/mer_dna.cc lib/storage.cc \ - lib/allocators_mmap.cc lib/misc.cc \ - lib/int128.cc lib/thread_exec.cc \ - lib/jsoncpp.cpp lib/time.cc \ - lib/generator_manager.cc - -library_includedir = $(includedir)/jellyfish-@PACKAGE_VERSION@/jellyfish -JFI = include/jellyfish -library_include_HEADERS = $(JFI)/allocators_mmap.hpp \ - $(JFI)/backtrace.hpp $(JFI)/atomic_gcc.hpp \ - $(JFI)/large_hash_array.hpp $(JFI)/err.hpp \ - $(JFI)/misc.hpp \ - $(JFI)/offsets_key_value.hpp \ - $(JFI)/int128.hpp \ - $(JFI)/rectangular_binary_matrix.hpp \ - $(JFI)/mer_dna.hpp $(JFI)/storage.hpp \ - $(JFI)/simple_circular_buffer.hpp \ - $(JFI)/circular_buffer.hpp \ - $(JFI)/atomic_field.hpp \ - $(JFI)/compare_and_swap.hpp \ - $(JFI)/divisor.hpp \ - $(JFI)/large_hash_iterator.hpp \ - $(JFI)/jellyfish.hpp $(JFI)/thread_exec.hpp \ - $(JFI)/stream_iterator.hpp \ - $(JFI)/mer_overlap_sequence_parser.hpp \ - $(JFI)/whole_sequence_parser.hpp \ - $(JFI)/binary_dumper.hpp \ - $(JFI)/sorted_dumper.hpp \ - $(JFI)/text_dumper.hpp $(JFI)/dumper.hpp \ - $(JFI)/time.hpp $(JFI)/mer_heap.hpp \ - $(JFI)/token_ring.hpp \ - $(JFI)/locks_pthread.hpp \ - $(JFI)/file_header.hpp \ - $(JFI)/generic_file_header.hpp \ - $(JFI)/json.h $(JFI)/hash_counter.hpp \ - $(JFI)/mapped_file.hpp \ - $(JFI)/mer_dna_bloom_counter.hpp \ - $(JFI)/bloom_common.hpp \ - $(JFI)/bloom_counter2.hpp \ - $(JFI)/bloom_filter.hpp \ - $(JFI)/cooperative_pool.hpp \ - $(JFI)/cooperative_pool2.hpp \ - $(JFI)/stream_manager.hpp \ - $(JFI)/generator_manager.hpp \ - $(JFI)/cpp_array.hpp \ - $(JFI)/mer_iterator.hpp \ - $(JFI)/atomic_bits_array.hpp \ - $(JFI)/stdio_filebuf.hpp \ - $(JFI)/mer_qual_iterator.hpp - - -############### -# Build tests # -############### -bin_generate_sequence_SOURCES = jellyfish/generate_sequence.cc \ - jellyfish/mersenne.cpp \ - jellyfish/backtrace.cc \ - jellyfish/dbg.cc - - -######### -# Tests # -######### -TEST_EXTENSIONS = .sh -SH_LOG_COMPILER = $(SHELL) -AM_SH_LOG_FLAGS = - -# SWIG tests - -############## -# Unit tests # -############## -TESTS = tests/generate_sequence.sh tests/parallel_hashing.sh \ - tests/merge.sh tests/bloom_filter.sh tests/big.sh \ - tests/subset_hashing.sh tests/multi_file.sh \ - tests/bloom_counter.sh tests/large_key.sh tests/swig_python.sh \ - tests/swig_ruby.sh tests/swig_perl.sh unit_tests/unit_tests.sh -bin_test_all_SOURCES = unit_tests/test_main.cc unit_tests/test_misc.cc \ - unit_tests/test_offsets_key_value.cc \ - unit_tests/test_simple_circular_buffer.cc \ - unit_tests/test_rectangular_binary_matrix.cc \ - unit_tests/test_mer_dna.cc unit_tests/test_large_hash_array.cc \ - unit_tests/test_mer_overlap_sequence_parser.cc \ - unit_tests/test_file_header.cc unit_tests/test_mer_iterator.cc \ - unit_tests/test_hash_counter.cc unit_tests/test_mer_heap.cc \ - unit_tests/test_stream_iterator.cc \ - unit_tests/test_token_ring.cc unit_tests/test_text_dumper.cc \ - unit_tests/test_dumpers.cc unit_tests/test_mapped_file.cc \ - unit_tests/test_int128.cc \ - unit_tests/test_mer_dna_bloom_counter.cc \ - unit_tests/test_whole_sequence_parser.cc \ - unit_tests/test_allocators_mmap.cc \ - unit_tests/test_cooperative_pool2.cc \ - unit_tests/test_generator_manager.cc \ - unit_tests/test_atomic_bits_array.cc \ - unit_tests/test_stdio_filebuf.cc jellyfish/backtrace.cc -bin_test_all_CPPFLAGS = -DJSON_IS_AMALGAMATION=1 -bin_test_all_CXXFLAGS = $(AM_CXXFLAGS) -I$(srcdir)/unit_tests/gtest/include -I$(srcdir)/unit_tests -I$(srcdir)/include -bin_test_all_LDADD = libgtest.la $(LDADD) - -# SWIG -SWIG_SRC = swig/jellyfish.i swig/hash_counter.i swig/hash_set.i \ - swig/mer_dna.i swig/mer_file.i swig/string_mers.i - -@HAVE_SWIG_TRUE@SWIG_V_GEN = $(swig_v_GEN_$(V)) -@HAVE_SWIG_TRUE@swig_v_GEN_ = $(swig_v_GEN_$(AM_DEFAULT_VERBOSITY)) -@HAVE_SWIG_TRUE@swig_v_GEN_0 = @echo " SWIG " $@; - -# Python support -@PYTHON_BINDING_TRUE@PYTHON_BUILT = swig/python/swig_wrap.cpp swig/python/jellyfish.py -@PYTHON_BINDING_TRUE@pythonextdir = $(PYTHON_SITE_PKG)/jellyfish -@PYTHON_BINDING_TRUE@pythonext_SCRIPTS = swig/python/__init__.pyc -@PYTHON_BINDING_TRUE@pythonext_LTLIBRARIES = swig/python/_jellyfish.la -@PYTHON_BINDING_TRUE@swig_python__jellyfish_la_SOURCES = swig/python/swig_wrap.cpp $(SWIG_SRC) -@PYTHON_BINDING_TRUE@swig_python__jellyfish_la_CPPFLAGS = $(PYTHON_CPPFLAGS) -I$(srcdir)/include -@PYTHON_BINDING_TRUE@swig_python__jellyfish_la_LDFLAGS = -module -@PYTHON_BINDING_TRUE@swig_python__jellyfish_la_LIBADD = libjellyfish-2.0.la -@PYTHON_BINDING_TRUE@PYTHONC_V_GEN = $(pythonc_v_GEN_$(V)) -@PYTHON_BINDING_TRUE@pythonc_v_GEN_ = $(pythonc_v_GEN_$(AM_DEFAULT_VERBOSITY)) -@PYTHON_BINDING_TRUE@pythonc_v_GEN_0 = @echo " PYTHONC " $@; - -# Ruby support -@RUBY_BINDING_TRUE@RUBY_BUILT = swig/ruby/swig_wrap.cpp -@RUBY_BINDING_TRUE@rubyextdir = $(RUBY_EXT_LIB) -@RUBY_BINDING_TRUE@rubyext_LTLIBRARIES = swig/ruby/jellyfish.la -@RUBY_BINDING_TRUE@swig_ruby_jellyfish_la_SOURCES = swig/ruby/swig_wrap.cpp $(SWIG_SRC) -@RUBY_BINDING_TRUE@swig_ruby_jellyfish_la_CPPFLAGS = $(RUBY_EXT_CFLAGS) -I$(srcdir)/include -@RUBY_BINDING_TRUE@swig_ruby_jellyfish_la_LDFLAGS = -module -@RUBY_BINDING_TRUE@swig_ruby_jellyfish_la_LIBADD = libjellyfish-2.0.la - -# Perl5 support -@PERL_BINDING_TRUE@PERL_BUILT = swig/perl5/swig_wrap.cpp swig/perl5/jellyfish.pm -@PERL_BINDING_TRUE@perlextdir = $(PERL_EXT_LIB) -@PERL_BINDING_TRUE@perlext_SCRIPTS = swig/perl5/jellyfish.pm -@PERL_BINDING_TRUE@perlext_LTLIBRARIES = swig/perl5/jellyfish.la -@PERL_BINDING_TRUE@swig_perl5_jellyfish_la_SOURCES = swig/perl5/swig_wrap.cpp $(SWIG_SRC) -@PERL_BINDING_TRUE@swig_perl5_jellyfish_la_CPPFLAGS = $(PERL_EXT_CPPFLAGS) -I$(PERL_EXT_INC) -I$(srcdir)/include -@PERL_BINDING_TRUE@swig_perl5_jellyfish_la_LDFLAGS = -module -@PERL_BINDING_TRUE@swig_perl5_jellyfish_la_LIBADD = libjellyfish-2.0.la - -############################## -# Gtest build. -############################## -# Build rules for libraries. -check_LTLIBRARIES = libgtest.la libgtest_main.la -libgtest_la_SOURCES = unit_tests/gtest/src/gtest-all.cc -libgtest_main_la_SOURCES = unit_tests/gtest/src/gtest_main.cc -libgtest_main_la_LIBADD = libgtest.la -libgtest_la_CXXFLAGS = -I$(srcdir)/unit_tests -libgtest_main_la_CXXFLAGS = -I$(srcdir)/unit_tests -GTEST_SRC = unit_tests/gtest/src/gtest-all.cc \ - unit_tests/gtest/src/gtest_main.cc \ - unit_tests/gtest/gtest.h - -all: $(BUILT_SOURCES) config.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .cc .cpp .hpp .lo .log .o .obj .sh .sh$(EXEEXT) .trs .yaggo -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/swig/Makefile.am $(srcdir)/gtest.mk $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; -$(srcdir)/swig/Makefile.am $(srcdir)/gtest.mk: - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): - -config.h: stamp-h1 - @test -f $@ || rm -f stamp-h1 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -tests/compat.sh: $(top_builddir)/config.status $(top_srcdir)/tests/compat.sh.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -jellyfish-2.0.pc: $(top_builddir)/config.status $(srcdir)/jellyfish-2.0.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ - -clean-checkLTLIBRARIES: - -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES) - @list='$(check_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ - } - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -install-perlextLTLIBRARIES: $(perlext_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(perlext_LTLIBRARIES)'; test -n "$(perlextdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(perlextdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(perlextdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(perlextdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(perlextdir)"; \ - } - -uninstall-perlextLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(perlext_LTLIBRARIES)'; test -n "$(perlextdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(perlextdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(perlextdir)/$$f"; \ - done - -clean-perlextLTLIBRARIES: - -test -z "$(perlext_LTLIBRARIES)" || rm -f $(perlext_LTLIBRARIES) - @list='$(perlext_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -install-pythonextLTLIBRARIES: $(pythonext_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(pythonext_LTLIBRARIES)'; test -n "$(pythonextdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(pythonextdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pythonextdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pythonextdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pythonextdir)"; \ - } - -uninstall-pythonextLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(pythonext_LTLIBRARIES)'; test -n "$(pythonextdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pythonextdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pythonextdir)/$$f"; \ - done - -clean-pythonextLTLIBRARIES: - -test -z "$(pythonext_LTLIBRARIES)" || rm -f $(pythonext_LTLIBRARIES) - @list='$(pythonext_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -install-rubyextLTLIBRARIES: $(rubyext_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(rubyext_LTLIBRARIES)'; test -n "$(rubyextdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(rubyextdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(rubyextdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(rubyextdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(rubyextdir)"; \ - } - -uninstall-rubyextLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(rubyext_LTLIBRARIES)'; test -n "$(rubyextdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(rubyextdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(rubyextdir)/$$f"; \ - done - -clean-rubyextLTLIBRARIES: - -test -z "$(rubyext_LTLIBRARIES)" || rm -f $(rubyext_LTLIBRARIES) - @list='$(rubyext_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } -unit_tests/gtest/src/$(am__dirstamp): - @$(MKDIR_P) unit_tests/gtest/src - @: > unit_tests/gtest/src/$(am__dirstamp) -unit_tests/gtest/src/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) unit_tests/gtest/src/$(DEPDIR) - @: > unit_tests/gtest/src/$(DEPDIR)/$(am__dirstamp) -unit_tests/gtest/src/libgtest_la-gtest-all.lo: \ - unit_tests/gtest/src/$(am__dirstamp) \ - unit_tests/gtest/src/$(DEPDIR)/$(am__dirstamp) - -libgtest.la: $(libgtest_la_OBJECTS) $(libgtest_la_DEPENDENCIES) $(EXTRA_libgtest_la_DEPENDENCIES) - $(AM_V_CXXLD)$(libgtest_la_LINK) $(libgtest_la_OBJECTS) $(libgtest_la_LIBADD) $(LIBS) -unit_tests/gtest/src/libgtest_main_la-gtest_main.lo: \ - unit_tests/gtest/src/$(am__dirstamp) \ - unit_tests/gtest/src/$(DEPDIR)/$(am__dirstamp) - -libgtest_main.la: $(libgtest_main_la_OBJECTS) $(libgtest_main_la_DEPENDENCIES) $(EXTRA_libgtest_main_la_DEPENDENCIES) - $(AM_V_CXXLD)$(libgtest_main_la_LINK) $(libgtest_main_la_OBJECTS) $(libgtest_main_la_LIBADD) $(LIBS) -lib/$(am__dirstamp): - @$(MKDIR_P) lib - @: > lib/$(am__dirstamp) -lib/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) lib/$(DEPDIR) - @: > lib/$(DEPDIR)/$(am__dirstamp) -lib/rectangular_binary_matrix.lo: lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) -lib/mer_dna.lo: lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp) -lib/storage.lo: lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp) -lib/allocators_mmap.lo: lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) -lib/misc.lo: lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp) -lib/int128.lo: lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp) -lib/thread_exec.lo: lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp) -lib/jsoncpp.lo: lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp) -lib/time.lo: lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp) -lib/generator_manager.lo: lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -libjellyfish-2.0.la: $(libjellyfish_2_0_la_OBJECTS) $(libjellyfish_2_0_la_DEPENDENCIES) $(EXTRA_libjellyfish_2_0_la_DEPENDENCIES) - $(AM_V_CXXLD)$(libjellyfish_2_0_la_LINK) -rpath $(libdir) $(libjellyfish_2_0_la_OBJECTS) $(libjellyfish_2_0_la_LIBADD) $(LIBS) -swig/perl5/$(am__dirstamp): - @$(MKDIR_P) swig/perl5 - @: > swig/perl5/$(am__dirstamp) -swig/perl5/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) swig/perl5/$(DEPDIR) - @: > swig/perl5/$(DEPDIR)/$(am__dirstamp) -swig/perl5/swig_perl5_jellyfish_la-swig_wrap.lo: \ - swig/perl5/$(am__dirstamp) \ - swig/perl5/$(DEPDIR)/$(am__dirstamp) - -swig/perl5/jellyfish.la: $(swig_perl5_jellyfish_la_OBJECTS) $(swig_perl5_jellyfish_la_DEPENDENCIES) $(EXTRA_swig_perl5_jellyfish_la_DEPENDENCIES) swig/perl5/$(am__dirstamp) - $(AM_V_CXXLD)$(swig_perl5_jellyfish_la_LINK) $(am_swig_perl5_jellyfish_la_rpath) $(swig_perl5_jellyfish_la_OBJECTS) $(swig_perl5_jellyfish_la_LIBADD) $(LIBS) -swig/python/$(am__dirstamp): - @$(MKDIR_P) swig/python - @: > swig/python/$(am__dirstamp) -swig/python/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) swig/python/$(DEPDIR) - @: > swig/python/$(DEPDIR)/$(am__dirstamp) -swig/python/swig_python__jellyfish_la-swig_wrap.lo: \ - swig/python/$(am__dirstamp) \ - swig/python/$(DEPDIR)/$(am__dirstamp) - -swig/python/_jellyfish.la: $(swig_python__jellyfish_la_OBJECTS) $(swig_python__jellyfish_la_DEPENDENCIES) $(EXTRA_swig_python__jellyfish_la_DEPENDENCIES) swig/python/$(am__dirstamp) - $(AM_V_CXXLD)$(swig_python__jellyfish_la_LINK) $(am_swig_python__jellyfish_la_rpath) $(swig_python__jellyfish_la_OBJECTS) $(swig_python__jellyfish_la_LIBADD) $(LIBS) -swig/ruby/$(am__dirstamp): - @$(MKDIR_P) swig/ruby - @: > swig/ruby/$(am__dirstamp) -swig/ruby/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) swig/ruby/$(DEPDIR) - @: > swig/ruby/$(DEPDIR)/$(am__dirstamp) -swig/ruby/swig_ruby_jellyfish_la-swig_wrap.lo: \ - swig/ruby/$(am__dirstamp) swig/ruby/$(DEPDIR)/$(am__dirstamp) - -swig/ruby/jellyfish.la: $(swig_ruby_jellyfish_la_OBJECTS) $(swig_ruby_jellyfish_la_DEPENDENCIES) $(EXTRA_swig_ruby_jellyfish_la_DEPENDENCIES) swig/ruby/$(am__dirstamp) - $(AM_V_CXXLD)$(swig_ruby_jellyfish_la_LINK) $(am_swig_ruby_jellyfish_la_rpath) $(swig_ruby_jellyfish_la_OBJECTS) $(swig_ruby_jellyfish_la_LIBADD) $(LIBS) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -jellyfish/$(am__dirstamp): - @$(MKDIR_P) jellyfish - @: > jellyfish/$(am__dirstamp) -jellyfish/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) jellyfish/$(DEPDIR) - @: > jellyfish/$(DEPDIR)/$(am__dirstamp) -jellyfish/generate_sequence.$(OBJEXT): jellyfish/$(am__dirstamp) \ - jellyfish/$(DEPDIR)/$(am__dirstamp) -jellyfish/mersenne.$(OBJEXT): jellyfish/$(am__dirstamp) \ - jellyfish/$(DEPDIR)/$(am__dirstamp) -jellyfish/backtrace.$(OBJEXT): jellyfish/$(am__dirstamp) \ - jellyfish/$(DEPDIR)/$(am__dirstamp) -jellyfish/dbg.$(OBJEXT): jellyfish/$(am__dirstamp) \ - jellyfish/$(DEPDIR)/$(am__dirstamp) -bin/$(am__dirstamp): - @$(MKDIR_P) bin - @: > bin/$(am__dirstamp) - -bin/generate_sequence$(EXEEXT): $(bin_generate_sequence_OBJECTS) $(bin_generate_sequence_DEPENDENCIES) $(EXTRA_bin_generate_sequence_DEPENDENCIES) bin/$(am__dirstamp) - @rm -f bin/generate_sequence$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(bin_generate_sequence_OBJECTS) $(bin_generate_sequence_LDADD) $(LIBS) -sub_commands/$(am__dirstamp): - @$(MKDIR_P) sub_commands - @: > sub_commands/$(am__dirstamp) -sub_commands/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) sub_commands/$(DEPDIR) - @: > sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/jellyfish.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/count_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/info_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/dump_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/histo_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/stats_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/merge_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/bc_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/query_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/cite_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -sub_commands/mem_main.$(OBJEXT): sub_commands/$(am__dirstamp) \ - sub_commands/$(DEPDIR)/$(am__dirstamp) -jellyfish/merge_files.$(OBJEXT): jellyfish/$(am__dirstamp) \ - jellyfish/$(DEPDIR)/$(am__dirstamp) - -bin/jellyfish$(EXEEXT): $(bin_jellyfish_OBJECTS) $(bin_jellyfish_DEPENDENCIES) $(EXTRA_bin_jellyfish_DEPENDENCIES) bin/$(am__dirstamp) - @rm -f bin/jellyfish$(EXEEXT) - $(AM_V_CXXLD)$(bin_jellyfish_LINK) $(bin_jellyfish_OBJECTS) $(bin_jellyfish_LDADD) $(LIBS) -unit_tests/$(am__dirstamp): - @$(MKDIR_P) unit_tests - @: > unit_tests/$(am__dirstamp) -unit_tests/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) unit_tests/$(DEPDIR) - @: > unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_main.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_misc.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_offsets_key_value.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_simple_circular_buffer.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_rectangular_binary_matrix.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_mer_dna.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_large_hash_array.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_mer_overlap_sequence_parser.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_file_header.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_mer_iterator.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_hash_counter.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_mer_heap.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_stream_iterator.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_token_ring.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_text_dumper.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_dumpers.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_mapped_file.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_int128.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_mer_dna_bloom_counter.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_whole_sequence_parser.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_allocators_mmap.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_cooperative_pool2.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_generator_manager.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_atomic_bits_array.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -unit_tests/bin_test_all-test_stdio_filebuf.$(OBJEXT): \ - unit_tests/$(am__dirstamp) \ - unit_tests/$(DEPDIR)/$(am__dirstamp) -jellyfish/bin_test_all-backtrace.$(OBJEXT): jellyfish/$(am__dirstamp) \ - jellyfish/$(DEPDIR)/$(am__dirstamp) - -bin/test_all$(EXEEXT): $(bin_test_all_OBJECTS) $(bin_test_all_DEPENDENCIES) $(EXTRA_bin_test_all_DEPENDENCIES) bin/$(am__dirstamp) - @rm -f bin/test_all$(EXEEXT) - $(AM_V_CXXLD)$(bin_test_all_LINK) $(bin_test_all_OBJECTS) $(bin_test_all_LDADD) $(LIBS) -install-dist_binSCRIPTS: $(dist_bin_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-dist_binSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) -install-perlextSCRIPTS: $(perlext_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(perlext_SCRIPTS)'; test -n "$(perlextdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(perlextdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(perlextdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(perlextdir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(perlextdir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-perlextSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(perlext_SCRIPTS)'; test -n "$(perlextdir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(perlextdir)'; $(am__uninstall_files_from_dir) -install-pythonextSCRIPTS: $(pythonext_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(pythonext_SCRIPTS)'; test -n "$(pythonextdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pythonextdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pythonextdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(pythonextdir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(pythonextdir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-pythonextSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(pythonext_SCRIPTS)'; test -n "$(pythonextdir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(pythonextdir)'; $(am__uninstall_files_from_dir) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f jellyfish/*.$(OBJEXT) - -rm -f lib/*.$(OBJEXT) - -rm -f lib/*.lo - -rm -f sub_commands/*.$(OBJEXT) - -rm -f swig/perl5/*.$(OBJEXT) - -rm -f swig/perl5/*.lo - -rm -f swig/python/*.$(OBJEXT) - -rm -f swig/python/*.lo - -rm -f swig/ruby/*.$(OBJEXT) - -rm -f swig/ruby/*.lo - -rm -f unit_tests/*.$(OBJEXT) - -rm -f unit_tests/gtest/src/*.$(OBJEXT) - -rm -f unit_tests/gtest/src/*.lo - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@jellyfish/$(DEPDIR)/backtrace.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@jellyfish/$(DEPDIR)/bin_test_all-backtrace.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@jellyfish/$(DEPDIR)/dbg.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@jellyfish/$(DEPDIR)/generate_sequence.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@jellyfish/$(DEPDIR)/merge_files.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@jellyfish/$(DEPDIR)/mersenne.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/allocators_mmap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/generator_manager.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/int128.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/jsoncpp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/mer_dna.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/misc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/rectangular_binary_matrix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/storage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/thread_exec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/time.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/bc_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/cite_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/count_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/dump_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/histo_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/info_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/jellyfish.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/mem_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/merge_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/query_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sub_commands/$(DEPDIR)/stats_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@swig/perl5/$(DEPDIR)/swig_perl5_jellyfish_la-swig_wrap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@swig/python/$(DEPDIR)/swig_python__jellyfish_la-swig_wrap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@swig/ruby/$(DEPDIR)/swig_ruby_jellyfish_la-swig_wrap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_allocators_mmap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_atomic_bits_array.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_cooperative_pool2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_dumpers.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_file_header.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_generator_manager.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_hash_counter.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_int128.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_large_hash_array.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_mapped_file.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna_bloom_counter.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_mer_heap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_mer_iterator.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_mer_overlap_sequence_parser.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_misc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_offsets_key_value.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_rectangular_binary_matrix.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_simple_circular_buffer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_stdio_filebuf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_stream_iterator.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_text_dumper.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_token_ring.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/$(DEPDIR)/bin_test_all-test_whole_sequence_parser.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/gtest/src/$(DEPDIR)/libgtest_la-gtest-all.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unit_tests/gtest/src/$(DEPDIR)/libgtest_main_la-gtest_main.Plo@am__quote@ - -.cc.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cc.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -unit_tests/gtest/src/libgtest_la-gtest-all.lo: unit_tests/gtest/src/gtest-all.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgtest_la_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/gtest/src/libgtest_la-gtest-all.lo -MD -MP -MF unit_tests/gtest/src/$(DEPDIR)/libgtest_la-gtest-all.Tpo -c -o unit_tests/gtest/src/libgtest_la-gtest-all.lo `test -f 'unit_tests/gtest/src/gtest-all.cc' || echo '$(srcdir)/'`unit_tests/gtest/src/gtest-all.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/gtest/src/$(DEPDIR)/libgtest_la-gtest-all.Tpo unit_tests/gtest/src/$(DEPDIR)/libgtest_la-gtest-all.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/gtest/src/gtest-all.cc' object='unit_tests/gtest/src/libgtest_la-gtest-all.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgtest_la_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/gtest/src/libgtest_la-gtest-all.lo `test -f 'unit_tests/gtest/src/gtest-all.cc' || echo '$(srcdir)/'`unit_tests/gtest/src/gtest-all.cc - -unit_tests/gtest/src/libgtest_main_la-gtest_main.lo: unit_tests/gtest/src/gtest_main.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgtest_main_la_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/gtest/src/libgtest_main_la-gtest_main.lo -MD -MP -MF unit_tests/gtest/src/$(DEPDIR)/libgtest_main_la-gtest_main.Tpo -c -o unit_tests/gtest/src/libgtest_main_la-gtest_main.lo `test -f 'unit_tests/gtest/src/gtest_main.cc' || echo '$(srcdir)/'`unit_tests/gtest/src/gtest_main.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/gtest/src/$(DEPDIR)/libgtest_main_la-gtest_main.Tpo unit_tests/gtest/src/$(DEPDIR)/libgtest_main_la-gtest_main.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/gtest/src/gtest_main.cc' object='unit_tests/gtest/src/libgtest_main_la-gtest_main.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgtest_main_la_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/gtest/src/libgtest_main_la-gtest_main.lo `test -f 'unit_tests/gtest/src/gtest_main.cc' || echo '$(srcdir)/'`unit_tests/gtest/src/gtest_main.cc - -swig/perl5/swig_perl5_jellyfish_la-swig_wrap.lo: swig/perl5/swig_wrap.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(swig_perl5_jellyfish_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT swig/perl5/swig_perl5_jellyfish_la-swig_wrap.lo -MD -MP -MF swig/perl5/$(DEPDIR)/swig_perl5_jellyfish_la-swig_wrap.Tpo -c -o swig/perl5/swig_perl5_jellyfish_la-swig_wrap.lo `test -f 'swig/perl5/swig_wrap.cpp' || echo '$(srcdir)/'`swig/perl5/swig_wrap.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) swig/perl5/$(DEPDIR)/swig_perl5_jellyfish_la-swig_wrap.Tpo swig/perl5/$(DEPDIR)/swig_perl5_jellyfish_la-swig_wrap.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='swig/perl5/swig_wrap.cpp' object='swig/perl5/swig_perl5_jellyfish_la-swig_wrap.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(swig_perl5_jellyfish_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o swig/perl5/swig_perl5_jellyfish_la-swig_wrap.lo `test -f 'swig/perl5/swig_wrap.cpp' || echo '$(srcdir)/'`swig/perl5/swig_wrap.cpp - -swig/python/swig_python__jellyfish_la-swig_wrap.lo: swig/python/swig_wrap.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(swig_python__jellyfish_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT swig/python/swig_python__jellyfish_la-swig_wrap.lo -MD -MP -MF swig/python/$(DEPDIR)/swig_python__jellyfish_la-swig_wrap.Tpo -c -o swig/python/swig_python__jellyfish_la-swig_wrap.lo `test -f 'swig/python/swig_wrap.cpp' || echo '$(srcdir)/'`swig/python/swig_wrap.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) swig/python/$(DEPDIR)/swig_python__jellyfish_la-swig_wrap.Tpo swig/python/$(DEPDIR)/swig_python__jellyfish_la-swig_wrap.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='swig/python/swig_wrap.cpp' object='swig/python/swig_python__jellyfish_la-swig_wrap.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(swig_python__jellyfish_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o swig/python/swig_python__jellyfish_la-swig_wrap.lo `test -f 'swig/python/swig_wrap.cpp' || echo '$(srcdir)/'`swig/python/swig_wrap.cpp - -swig/ruby/swig_ruby_jellyfish_la-swig_wrap.lo: swig/ruby/swig_wrap.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(swig_ruby_jellyfish_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT swig/ruby/swig_ruby_jellyfish_la-swig_wrap.lo -MD -MP -MF swig/ruby/$(DEPDIR)/swig_ruby_jellyfish_la-swig_wrap.Tpo -c -o swig/ruby/swig_ruby_jellyfish_la-swig_wrap.lo `test -f 'swig/ruby/swig_wrap.cpp' || echo '$(srcdir)/'`swig/ruby/swig_wrap.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) swig/ruby/$(DEPDIR)/swig_ruby_jellyfish_la-swig_wrap.Tpo swig/ruby/$(DEPDIR)/swig_ruby_jellyfish_la-swig_wrap.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='swig/ruby/swig_wrap.cpp' object='swig/ruby/swig_ruby_jellyfish_la-swig_wrap.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(swig_ruby_jellyfish_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o swig/ruby/swig_ruby_jellyfish_la-swig_wrap.lo `test -f 'swig/ruby/swig_wrap.cpp' || echo '$(srcdir)/'`swig/ruby/swig_wrap.cpp - -unit_tests/bin_test_all-test_main.o: unit_tests/test_main.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_main.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_main.Tpo -c -o unit_tests/bin_test_all-test_main.o `test -f 'unit_tests/test_main.cc' || echo '$(srcdir)/'`unit_tests/test_main.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_main.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_main.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_main.cc' object='unit_tests/bin_test_all-test_main.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_main.o `test -f 'unit_tests/test_main.cc' || echo '$(srcdir)/'`unit_tests/test_main.cc - -unit_tests/bin_test_all-test_main.obj: unit_tests/test_main.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_main.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_main.Tpo -c -o unit_tests/bin_test_all-test_main.obj `if test -f 'unit_tests/test_main.cc'; then $(CYGPATH_W) 'unit_tests/test_main.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_main.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_main.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_main.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_main.cc' object='unit_tests/bin_test_all-test_main.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_main.obj `if test -f 'unit_tests/test_main.cc'; then $(CYGPATH_W) 'unit_tests/test_main.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_main.cc'; fi` - -unit_tests/bin_test_all-test_misc.o: unit_tests/test_misc.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_misc.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_misc.Tpo -c -o unit_tests/bin_test_all-test_misc.o `test -f 'unit_tests/test_misc.cc' || echo '$(srcdir)/'`unit_tests/test_misc.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_misc.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_misc.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_misc.cc' object='unit_tests/bin_test_all-test_misc.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_misc.o `test -f 'unit_tests/test_misc.cc' || echo '$(srcdir)/'`unit_tests/test_misc.cc - -unit_tests/bin_test_all-test_misc.obj: unit_tests/test_misc.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_misc.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_misc.Tpo -c -o unit_tests/bin_test_all-test_misc.obj `if test -f 'unit_tests/test_misc.cc'; then $(CYGPATH_W) 'unit_tests/test_misc.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_misc.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_misc.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_misc.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_misc.cc' object='unit_tests/bin_test_all-test_misc.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_misc.obj `if test -f 'unit_tests/test_misc.cc'; then $(CYGPATH_W) 'unit_tests/test_misc.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_misc.cc'; fi` - -unit_tests/bin_test_all-test_offsets_key_value.o: unit_tests/test_offsets_key_value.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_offsets_key_value.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_offsets_key_value.Tpo -c -o unit_tests/bin_test_all-test_offsets_key_value.o `test -f 'unit_tests/test_offsets_key_value.cc' || echo '$(srcdir)/'`unit_tests/test_offsets_key_value.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_offsets_key_value.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_offsets_key_value.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_offsets_key_value.cc' object='unit_tests/bin_test_all-test_offsets_key_value.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_offsets_key_value.o `test -f 'unit_tests/test_offsets_key_value.cc' || echo '$(srcdir)/'`unit_tests/test_offsets_key_value.cc - -unit_tests/bin_test_all-test_offsets_key_value.obj: unit_tests/test_offsets_key_value.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_offsets_key_value.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_offsets_key_value.Tpo -c -o unit_tests/bin_test_all-test_offsets_key_value.obj `if test -f 'unit_tests/test_offsets_key_value.cc'; then $(CYGPATH_W) 'unit_tests/test_offsets_key_value.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_offsets_key_value.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_offsets_key_value.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_offsets_key_value.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_offsets_key_value.cc' object='unit_tests/bin_test_all-test_offsets_key_value.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_offsets_key_value.obj `if test -f 'unit_tests/test_offsets_key_value.cc'; then $(CYGPATH_W) 'unit_tests/test_offsets_key_value.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_offsets_key_value.cc'; fi` - -unit_tests/bin_test_all-test_simple_circular_buffer.o: unit_tests/test_simple_circular_buffer.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_simple_circular_buffer.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_simple_circular_buffer.Tpo -c -o unit_tests/bin_test_all-test_simple_circular_buffer.o `test -f 'unit_tests/test_simple_circular_buffer.cc' || echo '$(srcdir)/'`unit_tests/test_simple_circular_buffer.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_simple_circular_buffer.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_simple_circular_buffer.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_simple_circular_buffer.cc' object='unit_tests/bin_test_all-test_simple_circular_buffer.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_simple_circular_buffer.o `test -f 'unit_tests/test_simple_circular_buffer.cc' || echo '$(srcdir)/'`unit_tests/test_simple_circular_buffer.cc - -unit_tests/bin_test_all-test_simple_circular_buffer.obj: unit_tests/test_simple_circular_buffer.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_simple_circular_buffer.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_simple_circular_buffer.Tpo -c -o unit_tests/bin_test_all-test_simple_circular_buffer.obj `if test -f 'unit_tests/test_simple_circular_buffer.cc'; then $(CYGPATH_W) 'unit_tests/test_simple_circular_buffer.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_simple_circular_buffer.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_simple_circular_buffer.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_simple_circular_buffer.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_simple_circular_buffer.cc' object='unit_tests/bin_test_all-test_simple_circular_buffer.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_simple_circular_buffer.obj `if test -f 'unit_tests/test_simple_circular_buffer.cc'; then $(CYGPATH_W) 'unit_tests/test_simple_circular_buffer.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_simple_circular_buffer.cc'; fi` - -unit_tests/bin_test_all-test_rectangular_binary_matrix.o: unit_tests/test_rectangular_binary_matrix.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_rectangular_binary_matrix.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_rectangular_binary_matrix.Tpo -c -o unit_tests/bin_test_all-test_rectangular_binary_matrix.o `test -f 'unit_tests/test_rectangular_binary_matrix.cc' || echo '$(srcdir)/'`unit_tests/test_rectangular_binary_matrix.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_rectangular_binary_matrix.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_rectangular_binary_matrix.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_rectangular_binary_matrix.cc' object='unit_tests/bin_test_all-test_rectangular_binary_matrix.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_rectangular_binary_matrix.o `test -f 'unit_tests/test_rectangular_binary_matrix.cc' || echo '$(srcdir)/'`unit_tests/test_rectangular_binary_matrix.cc - -unit_tests/bin_test_all-test_rectangular_binary_matrix.obj: unit_tests/test_rectangular_binary_matrix.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_rectangular_binary_matrix.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_rectangular_binary_matrix.Tpo -c -o unit_tests/bin_test_all-test_rectangular_binary_matrix.obj `if test -f 'unit_tests/test_rectangular_binary_matrix.cc'; then $(CYGPATH_W) 'unit_tests/test_rectangular_binary_matrix.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_rectangular_binary_matrix.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_rectangular_binary_matrix.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_rectangular_binary_matrix.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_rectangular_binary_matrix.cc' object='unit_tests/bin_test_all-test_rectangular_binary_matrix.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_rectangular_binary_matrix.obj `if test -f 'unit_tests/test_rectangular_binary_matrix.cc'; then $(CYGPATH_W) 'unit_tests/test_rectangular_binary_matrix.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_rectangular_binary_matrix.cc'; fi` - -unit_tests/bin_test_all-test_mer_dna.o: unit_tests/test_mer_dna.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_dna.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna.Tpo -c -o unit_tests/bin_test_all-test_mer_dna.o `test -f 'unit_tests/test_mer_dna.cc' || echo '$(srcdir)/'`unit_tests/test_mer_dna.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_dna.cc' object='unit_tests/bin_test_all-test_mer_dna.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_dna.o `test -f 'unit_tests/test_mer_dna.cc' || echo '$(srcdir)/'`unit_tests/test_mer_dna.cc - -unit_tests/bin_test_all-test_mer_dna.obj: unit_tests/test_mer_dna.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_dna.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna.Tpo -c -o unit_tests/bin_test_all-test_mer_dna.obj `if test -f 'unit_tests/test_mer_dna.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_dna.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_dna.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_dna.cc' object='unit_tests/bin_test_all-test_mer_dna.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_dna.obj `if test -f 'unit_tests/test_mer_dna.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_dna.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_dna.cc'; fi` - -unit_tests/bin_test_all-test_large_hash_array.o: unit_tests/test_large_hash_array.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_large_hash_array.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_large_hash_array.Tpo -c -o unit_tests/bin_test_all-test_large_hash_array.o `test -f 'unit_tests/test_large_hash_array.cc' || echo '$(srcdir)/'`unit_tests/test_large_hash_array.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_large_hash_array.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_large_hash_array.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_large_hash_array.cc' object='unit_tests/bin_test_all-test_large_hash_array.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_large_hash_array.o `test -f 'unit_tests/test_large_hash_array.cc' || echo '$(srcdir)/'`unit_tests/test_large_hash_array.cc - -unit_tests/bin_test_all-test_large_hash_array.obj: unit_tests/test_large_hash_array.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_large_hash_array.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_large_hash_array.Tpo -c -o unit_tests/bin_test_all-test_large_hash_array.obj `if test -f 'unit_tests/test_large_hash_array.cc'; then $(CYGPATH_W) 'unit_tests/test_large_hash_array.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_large_hash_array.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_large_hash_array.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_large_hash_array.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_large_hash_array.cc' object='unit_tests/bin_test_all-test_large_hash_array.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_large_hash_array.obj `if test -f 'unit_tests/test_large_hash_array.cc'; then $(CYGPATH_W) 'unit_tests/test_large_hash_array.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_large_hash_array.cc'; fi` - -unit_tests/bin_test_all-test_mer_overlap_sequence_parser.o: unit_tests/test_mer_overlap_sequence_parser.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_overlap_sequence_parser.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_overlap_sequence_parser.Tpo -c -o unit_tests/bin_test_all-test_mer_overlap_sequence_parser.o `test -f 'unit_tests/test_mer_overlap_sequence_parser.cc' || echo '$(srcdir)/'`unit_tests/test_mer_overlap_sequence_parser.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_overlap_sequence_parser.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_overlap_sequence_parser.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_overlap_sequence_parser.cc' object='unit_tests/bin_test_all-test_mer_overlap_sequence_parser.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_overlap_sequence_parser.o `test -f 'unit_tests/test_mer_overlap_sequence_parser.cc' || echo '$(srcdir)/'`unit_tests/test_mer_overlap_sequence_parser.cc - -unit_tests/bin_test_all-test_mer_overlap_sequence_parser.obj: unit_tests/test_mer_overlap_sequence_parser.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_overlap_sequence_parser.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_overlap_sequence_parser.Tpo -c -o unit_tests/bin_test_all-test_mer_overlap_sequence_parser.obj `if test -f 'unit_tests/test_mer_overlap_sequence_parser.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_overlap_sequence_parser.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_overlap_sequence_parser.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_overlap_sequence_parser.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_overlap_sequence_parser.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_overlap_sequence_parser.cc' object='unit_tests/bin_test_all-test_mer_overlap_sequence_parser.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_overlap_sequence_parser.obj `if test -f 'unit_tests/test_mer_overlap_sequence_parser.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_overlap_sequence_parser.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_overlap_sequence_parser.cc'; fi` - -unit_tests/bin_test_all-test_file_header.o: unit_tests/test_file_header.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_file_header.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_file_header.Tpo -c -o unit_tests/bin_test_all-test_file_header.o `test -f 'unit_tests/test_file_header.cc' || echo '$(srcdir)/'`unit_tests/test_file_header.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_file_header.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_file_header.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_file_header.cc' object='unit_tests/bin_test_all-test_file_header.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_file_header.o `test -f 'unit_tests/test_file_header.cc' || echo '$(srcdir)/'`unit_tests/test_file_header.cc - -unit_tests/bin_test_all-test_file_header.obj: unit_tests/test_file_header.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_file_header.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_file_header.Tpo -c -o unit_tests/bin_test_all-test_file_header.obj `if test -f 'unit_tests/test_file_header.cc'; then $(CYGPATH_W) 'unit_tests/test_file_header.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_file_header.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_file_header.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_file_header.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_file_header.cc' object='unit_tests/bin_test_all-test_file_header.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_file_header.obj `if test -f 'unit_tests/test_file_header.cc'; then $(CYGPATH_W) 'unit_tests/test_file_header.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_file_header.cc'; fi` - -unit_tests/bin_test_all-test_mer_iterator.o: unit_tests/test_mer_iterator.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_iterator.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_iterator.Tpo -c -o unit_tests/bin_test_all-test_mer_iterator.o `test -f 'unit_tests/test_mer_iterator.cc' || echo '$(srcdir)/'`unit_tests/test_mer_iterator.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_iterator.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_iterator.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_iterator.cc' object='unit_tests/bin_test_all-test_mer_iterator.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_iterator.o `test -f 'unit_tests/test_mer_iterator.cc' || echo '$(srcdir)/'`unit_tests/test_mer_iterator.cc - -unit_tests/bin_test_all-test_mer_iterator.obj: unit_tests/test_mer_iterator.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_iterator.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_iterator.Tpo -c -o unit_tests/bin_test_all-test_mer_iterator.obj `if test -f 'unit_tests/test_mer_iterator.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_iterator.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_iterator.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_iterator.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_iterator.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_iterator.cc' object='unit_tests/bin_test_all-test_mer_iterator.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_iterator.obj `if test -f 'unit_tests/test_mer_iterator.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_iterator.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_iterator.cc'; fi` - -unit_tests/bin_test_all-test_hash_counter.o: unit_tests/test_hash_counter.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_hash_counter.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_hash_counter.Tpo -c -o unit_tests/bin_test_all-test_hash_counter.o `test -f 'unit_tests/test_hash_counter.cc' || echo '$(srcdir)/'`unit_tests/test_hash_counter.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_hash_counter.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_hash_counter.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_hash_counter.cc' object='unit_tests/bin_test_all-test_hash_counter.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_hash_counter.o `test -f 'unit_tests/test_hash_counter.cc' || echo '$(srcdir)/'`unit_tests/test_hash_counter.cc - -unit_tests/bin_test_all-test_hash_counter.obj: unit_tests/test_hash_counter.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_hash_counter.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_hash_counter.Tpo -c -o unit_tests/bin_test_all-test_hash_counter.obj `if test -f 'unit_tests/test_hash_counter.cc'; then $(CYGPATH_W) 'unit_tests/test_hash_counter.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_hash_counter.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_hash_counter.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_hash_counter.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_hash_counter.cc' object='unit_tests/bin_test_all-test_hash_counter.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_hash_counter.obj `if test -f 'unit_tests/test_hash_counter.cc'; then $(CYGPATH_W) 'unit_tests/test_hash_counter.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_hash_counter.cc'; fi` - -unit_tests/bin_test_all-test_mer_heap.o: unit_tests/test_mer_heap.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_heap.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_heap.Tpo -c -o unit_tests/bin_test_all-test_mer_heap.o `test -f 'unit_tests/test_mer_heap.cc' || echo '$(srcdir)/'`unit_tests/test_mer_heap.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_heap.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_heap.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_heap.cc' object='unit_tests/bin_test_all-test_mer_heap.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_heap.o `test -f 'unit_tests/test_mer_heap.cc' || echo '$(srcdir)/'`unit_tests/test_mer_heap.cc - -unit_tests/bin_test_all-test_mer_heap.obj: unit_tests/test_mer_heap.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_heap.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_heap.Tpo -c -o unit_tests/bin_test_all-test_mer_heap.obj `if test -f 'unit_tests/test_mer_heap.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_heap.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_heap.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_heap.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_heap.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_heap.cc' object='unit_tests/bin_test_all-test_mer_heap.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_heap.obj `if test -f 'unit_tests/test_mer_heap.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_heap.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_heap.cc'; fi` - -unit_tests/bin_test_all-test_stream_iterator.o: unit_tests/test_stream_iterator.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_stream_iterator.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_stream_iterator.Tpo -c -o unit_tests/bin_test_all-test_stream_iterator.o `test -f 'unit_tests/test_stream_iterator.cc' || echo '$(srcdir)/'`unit_tests/test_stream_iterator.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_stream_iterator.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_stream_iterator.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_stream_iterator.cc' object='unit_tests/bin_test_all-test_stream_iterator.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_stream_iterator.o `test -f 'unit_tests/test_stream_iterator.cc' || echo '$(srcdir)/'`unit_tests/test_stream_iterator.cc - -unit_tests/bin_test_all-test_stream_iterator.obj: unit_tests/test_stream_iterator.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_stream_iterator.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_stream_iterator.Tpo -c -o unit_tests/bin_test_all-test_stream_iterator.obj `if test -f 'unit_tests/test_stream_iterator.cc'; then $(CYGPATH_W) 'unit_tests/test_stream_iterator.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_stream_iterator.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_stream_iterator.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_stream_iterator.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_stream_iterator.cc' object='unit_tests/bin_test_all-test_stream_iterator.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_stream_iterator.obj `if test -f 'unit_tests/test_stream_iterator.cc'; then $(CYGPATH_W) 'unit_tests/test_stream_iterator.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_stream_iterator.cc'; fi` - -unit_tests/bin_test_all-test_token_ring.o: unit_tests/test_token_ring.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_token_ring.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_token_ring.Tpo -c -o unit_tests/bin_test_all-test_token_ring.o `test -f 'unit_tests/test_token_ring.cc' || echo '$(srcdir)/'`unit_tests/test_token_ring.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_token_ring.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_token_ring.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_token_ring.cc' object='unit_tests/bin_test_all-test_token_ring.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_token_ring.o `test -f 'unit_tests/test_token_ring.cc' || echo '$(srcdir)/'`unit_tests/test_token_ring.cc - -unit_tests/bin_test_all-test_token_ring.obj: unit_tests/test_token_ring.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_token_ring.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_token_ring.Tpo -c -o unit_tests/bin_test_all-test_token_ring.obj `if test -f 'unit_tests/test_token_ring.cc'; then $(CYGPATH_W) 'unit_tests/test_token_ring.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_token_ring.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_token_ring.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_token_ring.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_token_ring.cc' object='unit_tests/bin_test_all-test_token_ring.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_token_ring.obj `if test -f 'unit_tests/test_token_ring.cc'; then $(CYGPATH_W) 'unit_tests/test_token_ring.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_token_ring.cc'; fi` - -unit_tests/bin_test_all-test_text_dumper.o: unit_tests/test_text_dumper.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_text_dumper.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_text_dumper.Tpo -c -o unit_tests/bin_test_all-test_text_dumper.o `test -f 'unit_tests/test_text_dumper.cc' || echo '$(srcdir)/'`unit_tests/test_text_dumper.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_text_dumper.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_text_dumper.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_text_dumper.cc' object='unit_tests/bin_test_all-test_text_dumper.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_text_dumper.o `test -f 'unit_tests/test_text_dumper.cc' || echo '$(srcdir)/'`unit_tests/test_text_dumper.cc - -unit_tests/bin_test_all-test_text_dumper.obj: unit_tests/test_text_dumper.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_text_dumper.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_text_dumper.Tpo -c -o unit_tests/bin_test_all-test_text_dumper.obj `if test -f 'unit_tests/test_text_dumper.cc'; then $(CYGPATH_W) 'unit_tests/test_text_dumper.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_text_dumper.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_text_dumper.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_text_dumper.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_text_dumper.cc' object='unit_tests/bin_test_all-test_text_dumper.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_text_dumper.obj `if test -f 'unit_tests/test_text_dumper.cc'; then $(CYGPATH_W) 'unit_tests/test_text_dumper.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_text_dumper.cc'; fi` - -unit_tests/bin_test_all-test_dumpers.o: unit_tests/test_dumpers.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_dumpers.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_dumpers.Tpo -c -o unit_tests/bin_test_all-test_dumpers.o `test -f 'unit_tests/test_dumpers.cc' || echo '$(srcdir)/'`unit_tests/test_dumpers.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_dumpers.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_dumpers.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_dumpers.cc' object='unit_tests/bin_test_all-test_dumpers.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_dumpers.o `test -f 'unit_tests/test_dumpers.cc' || echo '$(srcdir)/'`unit_tests/test_dumpers.cc - -unit_tests/bin_test_all-test_dumpers.obj: unit_tests/test_dumpers.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_dumpers.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_dumpers.Tpo -c -o unit_tests/bin_test_all-test_dumpers.obj `if test -f 'unit_tests/test_dumpers.cc'; then $(CYGPATH_W) 'unit_tests/test_dumpers.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_dumpers.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_dumpers.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_dumpers.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_dumpers.cc' object='unit_tests/bin_test_all-test_dumpers.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_dumpers.obj `if test -f 'unit_tests/test_dumpers.cc'; then $(CYGPATH_W) 'unit_tests/test_dumpers.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_dumpers.cc'; fi` - -unit_tests/bin_test_all-test_mapped_file.o: unit_tests/test_mapped_file.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mapped_file.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mapped_file.Tpo -c -o unit_tests/bin_test_all-test_mapped_file.o `test -f 'unit_tests/test_mapped_file.cc' || echo '$(srcdir)/'`unit_tests/test_mapped_file.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mapped_file.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mapped_file.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mapped_file.cc' object='unit_tests/bin_test_all-test_mapped_file.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mapped_file.o `test -f 'unit_tests/test_mapped_file.cc' || echo '$(srcdir)/'`unit_tests/test_mapped_file.cc - -unit_tests/bin_test_all-test_mapped_file.obj: unit_tests/test_mapped_file.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mapped_file.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mapped_file.Tpo -c -o unit_tests/bin_test_all-test_mapped_file.obj `if test -f 'unit_tests/test_mapped_file.cc'; then $(CYGPATH_W) 'unit_tests/test_mapped_file.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mapped_file.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mapped_file.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mapped_file.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mapped_file.cc' object='unit_tests/bin_test_all-test_mapped_file.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mapped_file.obj `if test -f 'unit_tests/test_mapped_file.cc'; then $(CYGPATH_W) 'unit_tests/test_mapped_file.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mapped_file.cc'; fi` - -unit_tests/bin_test_all-test_int128.o: unit_tests/test_int128.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_int128.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_int128.Tpo -c -o unit_tests/bin_test_all-test_int128.o `test -f 'unit_tests/test_int128.cc' || echo '$(srcdir)/'`unit_tests/test_int128.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_int128.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_int128.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_int128.cc' object='unit_tests/bin_test_all-test_int128.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_int128.o `test -f 'unit_tests/test_int128.cc' || echo '$(srcdir)/'`unit_tests/test_int128.cc - -unit_tests/bin_test_all-test_int128.obj: unit_tests/test_int128.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_int128.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_int128.Tpo -c -o unit_tests/bin_test_all-test_int128.obj `if test -f 'unit_tests/test_int128.cc'; then $(CYGPATH_W) 'unit_tests/test_int128.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_int128.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_int128.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_int128.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_int128.cc' object='unit_tests/bin_test_all-test_int128.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_int128.obj `if test -f 'unit_tests/test_int128.cc'; then $(CYGPATH_W) 'unit_tests/test_int128.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_int128.cc'; fi` - -unit_tests/bin_test_all-test_mer_dna_bloom_counter.o: unit_tests/test_mer_dna_bloom_counter.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_dna_bloom_counter.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna_bloom_counter.Tpo -c -o unit_tests/bin_test_all-test_mer_dna_bloom_counter.o `test -f 'unit_tests/test_mer_dna_bloom_counter.cc' || echo '$(srcdir)/'`unit_tests/test_mer_dna_bloom_counter.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna_bloom_counter.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna_bloom_counter.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_dna_bloom_counter.cc' object='unit_tests/bin_test_all-test_mer_dna_bloom_counter.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_dna_bloom_counter.o `test -f 'unit_tests/test_mer_dna_bloom_counter.cc' || echo '$(srcdir)/'`unit_tests/test_mer_dna_bloom_counter.cc - -unit_tests/bin_test_all-test_mer_dna_bloom_counter.obj: unit_tests/test_mer_dna_bloom_counter.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_mer_dna_bloom_counter.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna_bloom_counter.Tpo -c -o unit_tests/bin_test_all-test_mer_dna_bloom_counter.obj `if test -f 'unit_tests/test_mer_dna_bloom_counter.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_dna_bloom_counter.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_dna_bloom_counter.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna_bloom_counter.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_mer_dna_bloom_counter.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_mer_dna_bloom_counter.cc' object='unit_tests/bin_test_all-test_mer_dna_bloom_counter.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_mer_dna_bloom_counter.obj `if test -f 'unit_tests/test_mer_dna_bloom_counter.cc'; then $(CYGPATH_W) 'unit_tests/test_mer_dna_bloom_counter.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_mer_dna_bloom_counter.cc'; fi` - -unit_tests/bin_test_all-test_whole_sequence_parser.o: unit_tests/test_whole_sequence_parser.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_whole_sequence_parser.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_whole_sequence_parser.Tpo -c -o unit_tests/bin_test_all-test_whole_sequence_parser.o `test -f 'unit_tests/test_whole_sequence_parser.cc' || echo '$(srcdir)/'`unit_tests/test_whole_sequence_parser.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_whole_sequence_parser.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_whole_sequence_parser.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_whole_sequence_parser.cc' object='unit_tests/bin_test_all-test_whole_sequence_parser.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_whole_sequence_parser.o `test -f 'unit_tests/test_whole_sequence_parser.cc' || echo '$(srcdir)/'`unit_tests/test_whole_sequence_parser.cc - -unit_tests/bin_test_all-test_whole_sequence_parser.obj: unit_tests/test_whole_sequence_parser.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_whole_sequence_parser.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_whole_sequence_parser.Tpo -c -o unit_tests/bin_test_all-test_whole_sequence_parser.obj `if test -f 'unit_tests/test_whole_sequence_parser.cc'; then $(CYGPATH_W) 'unit_tests/test_whole_sequence_parser.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_whole_sequence_parser.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_whole_sequence_parser.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_whole_sequence_parser.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_whole_sequence_parser.cc' object='unit_tests/bin_test_all-test_whole_sequence_parser.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_whole_sequence_parser.obj `if test -f 'unit_tests/test_whole_sequence_parser.cc'; then $(CYGPATH_W) 'unit_tests/test_whole_sequence_parser.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_whole_sequence_parser.cc'; fi` - -unit_tests/bin_test_all-test_allocators_mmap.o: unit_tests/test_allocators_mmap.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_allocators_mmap.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_allocators_mmap.Tpo -c -o unit_tests/bin_test_all-test_allocators_mmap.o `test -f 'unit_tests/test_allocators_mmap.cc' || echo '$(srcdir)/'`unit_tests/test_allocators_mmap.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_allocators_mmap.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_allocators_mmap.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_allocators_mmap.cc' object='unit_tests/bin_test_all-test_allocators_mmap.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_allocators_mmap.o `test -f 'unit_tests/test_allocators_mmap.cc' || echo '$(srcdir)/'`unit_tests/test_allocators_mmap.cc - -unit_tests/bin_test_all-test_allocators_mmap.obj: unit_tests/test_allocators_mmap.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_allocators_mmap.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_allocators_mmap.Tpo -c -o unit_tests/bin_test_all-test_allocators_mmap.obj `if test -f 'unit_tests/test_allocators_mmap.cc'; then $(CYGPATH_W) 'unit_tests/test_allocators_mmap.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_allocators_mmap.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_allocators_mmap.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_allocators_mmap.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_allocators_mmap.cc' object='unit_tests/bin_test_all-test_allocators_mmap.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_allocators_mmap.obj `if test -f 'unit_tests/test_allocators_mmap.cc'; then $(CYGPATH_W) 'unit_tests/test_allocators_mmap.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_allocators_mmap.cc'; fi` - -unit_tests/bin_test_all-test_cooperative_pool2.o: unit_tests/test_cooperative_pool2.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_cooperative_pool2.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_cooperative_pool2.Tpo -c -o unit_tests/bin_test_all-test_cooperative_pool2.o `test -f 'unit_tests/test_cooperative_pool2.cc' || echo '$(srcdir)/'`unit_tests/test_cooperative_pool2.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_cooperative_pool2.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_cooperative_pool2.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_cooperative_pool2.cc' object='unit_tests/bin_test_all-test_cooperative_pool2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_cooperative_pool2.o `test -f 'unit_tests/test_cooperative_pool2.cc' || echo '$(srcdir)/'`unit_tests/test_cooperative_pool2.cc - -unit_tests/bin_test_all-test_cooperative_pool2.obj: unit_tests/test_cooperative_pool2.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_cooperative_pool2.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_cooperative_pool2.Tpo -c -o unit_tests/bin_test_all-test_cooperative_pool2.obj `if test -f 'unit_tests/test_cooperative_pool2.cc'; then $(CYGPATH_W) 'unit_tests/test_cooperative_pool2.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_cooperative_pool2.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_cooperative_pool2.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_cooperative_pool2.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_cooperative_pool2.cc' object='unit_tests/bin_test_all-test_cooperative_pool2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_cooperative_pool2.obj `if test -f 'unit_tests/test_cooperative_pool2.cc'; then $(CYGPATH_W) 'unit_tests/test_cooperative_pool2.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_cooperative_pool2.cc'; fi` - -unit_tests/bin_test_all-test_generator_manager.o: unit_tests/test_generator_manager.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_generator_manager.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_generator_manager.Tpo -c -o unit_tests/bin_test_all-test_generator_manager.o `test -f 'unit_tests/test_generator_manager.cc' || echo '$(srcdir)/'`unit_tests/test_generator_manager.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_generator_manager.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_generator_manager.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_generator_manager.cc' object='unit_tests/bin_test_all-test_generator_manager.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_generator_manager.o `test -f 'unit_tests/test_generator_manager.cc' || echo '$(srcdir)/'`unit_tests/test_generator_manager.cc - -unit_tests/bin_test_all-test_generator_manager.obj: unit_tests/test_generator_manager.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_generator_manager.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_generator_manager.Tpo -c -o unit_tests/bin_test_all-test_generator_manager.obj `if test -f 'unit_tests/test_generator_manager.cc'; then $(CYGPATH_W) 'unit_tests/test_generator_manager.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_generator_manager.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_generator_manager.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_generator_manager.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_generator_manager.cc' object='unit_tests/bin_test_all-test_generator_manager.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_generator_manager.obj `if test -f 'unit_tests/test_generator_manager.cc'; then $(CYGPATH_W) 'unit_tests/test_generator_manager.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_generator_manager.cc'; fi` - -unit_tests/bin_test_all-test_atomic_bits_array.o: unit_tests/test_atomic_bits_array.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_atomic_bits_array.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_atomic_bits_array.Tpo -c -o unit_tests/bin_test_all-test_atomic_bits_array.o `test -f 'unit_tests/test_atomic_bits_array.cc' || echo '$(srcdir)/'`unit_tests/test_atomic_bits_array.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_atomic_bits_array.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_atomic_bits_array.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_atomic_bits_array.cc' object='unit_tests/bin_test_all-test_atomic_bits_array.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_atomic_bits_array.o `test -f 'unit_tests/test_atomic_bits_array.cc' || echo '$(srcdir)/'`unit_tests/test_atomic_bits_array.cc - -unit_tests/bin_test_all-test_atomic_bits_array.obj: unit_tests/test_atomic_bits_array.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_atomic_bits_array.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_atomic_bits_array.Tpo -c -o unit_tests/bin_test_all-test_atomic_bits_array.obj `if test -f 'unit_tests/test_atomic_bits_array.cc'; then $(CYGPATH_W) 'unit_tests/test_atomic_bits_array.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_atomic_bits_array.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_atomic_bits_array.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_atomic_bits_array.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_atomic_bits_array.cc' object='unit_tests/bin_test_all-test_atomic_bits_array.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_atomic_bits_array.obj `if test -f 'unit_tests/test_atomic_bits_array.cc'; then $(CYGPATH_W) 'unit_tests/test_atomic_bits_array.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_atomic_bits_array.cc'; fi` - -unit_tests/bin_test_all-test_stdio_filebuf.o: unit_tests/test_stdio_filebuf.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_stdio_filebuf.o -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_stdio_filebuf.Tpo -c -o unit_tests/bin_test_all-test_stdio_filebuf.o `test -f 'unit_tests/test_stdio_filebuf.cc' || echo '$(srcdir)/'`unit_tests/test_stdio_filebuf.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_stdio_filebuf.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_stdio_filebuf.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_stdio_filebuf.cc' object='unit_tests/bin_test_all-test_stdio_filebuf.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_stdio_filebuf.o `test -f 'unit_tests/test_stdio_filebuf.cc' || echo '$(srcdir)/'`unit_tests/test_stdio_filebuf.cc - -unit_tests/bin_test_all-test_stdio_filebuf.obj: unit_tests/test_stdio_filebuf.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT unit_tests/bin_test_all-test_stdio_filebuf.obj -MD -MP -MF unit_tests/$(DEPDIR)/bin_test_all-test_stdio_filebuf.Tpo -c -o unit_tests/bin_test_all-test_stdio_filebuf.obj `if test -f 'unit_tests/test_stdio_filebuf.cc'; then $(CYGPATH_W) 'unit_tests/test_stdio_filebuf.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_stdio_filebuf.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unit_tests/$(DEPDIR)/bin_test_all-test_stdio_filebuf.Tpo unit_tests/$(DEPDIR)/bin_test_all-test_stdio_filebuf.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='unit_tests/test_stdio_filebuf.cc' object='unit_tests/bin_test_all-test_stdio_filebuf.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o unit_tests/bin_test_all-test_stdio_filebuf.obj `if test -f 'unit_tests/test_stdio_filebuf.cc'; then $(CYGPATH_W) 'unit_tests/test_stdio_filebuf.cc'; else $(CYGPATH_W) '$(srcdir)/unit_tests/test_stdio_filebuf.cc'; fi` - -jellyfish/bin_test_all-backtrace.o: jellyfish/backtrace.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT jellyfish/bin_test_all-backtrace.o -MD -MP -MF jellyfish/$(DEPDIR)/bin_test_all-backtrace.Tpo -c -o jellyfish/bin_test_all-backtrace.o `test -f 'jellyfish/backtrace.cc' || echo '$(srcdir)/'`jellyfish/backtrace.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) jellyfish/$(DEPDIR)/bin_test_all-backtrace.Tpo jellyfish/$(DEPDIR)/bin_test_all-backtrace.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='jellyfish/backtrace.cc' object='jellyfish/bin_test_all-backtrace.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o jellyfish/bin_test_all-backtrace.o `test -f 'jellyfish/backtrace.cc' || echo '$(srcdir)/'`jellyfish/backtrace.cc - -jellyfish/bin_test_all-backtrace.obj: jellyfish/backtrace.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -MT jellyfish/bin_test_all-backtrace.obj -MD -MP -MF jellyfish/$(DEPDIR)/bin_test_all-backtrace.Tpo -c -o jellyfish/bin_test_all-backtrace.obj `if test -f 'jellyfish/backtrace.cc'; then $(CYGPATH_W) 'jellyfish/backtrace.cc'; else $(CYGPATH_W) '$(srcdir)/jellyfish/backtrace.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) jellyfish/$(DEPDIR)/bin_test_all-backtrace.Tpo jellyfish/$(DEPDIR)/bin_test_all-backtrace.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='jellyfish/backtrace.cc' object='jellyfish/bin_test_all-backtrace.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_test_all_CPPFLAGS) $(CPPFLAGS) $(bin_test_all_CXXFLAGS) $(CXXFLAGS) -c -o jellyfish/bin_test_all-backtrace.obj `if test -f 'jellyfish/backtrace.cc'; then $(CYGPATH_W) 'jellyfish/backtrace.cc'; else $(CYGPATH_W) '$(srcdir)/jellyfish/backtrace.cc'; fi` - -.cpp.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -rm -rf bin/.libs bin/_libs - -rm -rf lib/.libs lib/_libs - -rm -rf swig/perl5/.libs swig/perl5/_libs - -rm -rf swig/python/.libs swig/python/_libs - -rm -rf swig/ruby/.libs swig/ruby/_libs - -rm -rf unit_tests/gtest/src/.libs unit_tests/gtest/src/_libs - -distclean-libtool: - -rm -f libtool config.lt -install-man1: $(man1_MANS) - @$(NORMAL_INSTALL) - @list1='$(man1_MANS)'; \ - list2=''; \ - test -n "$(man1dir)" \ - && test -n "`echo $$list1$$list2`" \ - || exit 0; \ - echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ - { for i in $$list1; do echo "$$i"; done; \ - if test -n "$$list2"; then \ - for i in $$list2; do echo "$$i"; done \ - | sed -n '/\.1[a-z]*$$/p'; \ - fi; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ - while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ - done; } - -uninstall-man1: - @$(NORMAL_UNINSTALL) - @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) -install-dataDATA: $(data_DATA) - @$(NORMAL_INSTALL) - @list='$(data_DATA)'; test -n "$(datadir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(datadir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(datadir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(datadir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(datadir)" || exit $$?; \ - done - -uninstall-dataDATA: - @$(NORMAL_UNINSTALL) - @list='$(data_DATA)'; test -n "$(datadir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(datadir)'; $(am__uninstall_files_from_dir) -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) -install-library_includeHEADERS: $(library_include_HEADERS) - @$(NORMAL_INSTALL) - @list='$(library_include_HEADERS)'; test -n "$(library_includedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(library_includedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(library_includedir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(library_includedir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(library_includedir)" || exit $$?; \ - done - -uninstall-library_includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(library_include_HEADERS)'; test -n "$(library_includedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(library_includedir)'; $(am__uninstall_files_from_dir) - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscope: cscope.files - test ! -s cscope.files \ - || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) -clean-cscope: - -rm -f cscope.files -cscope.files: clean-cscope cscopelist -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - else \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ - done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ - else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ - fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ - else \ - color_start= color_end=; \ - fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all $(check_LTLIBRARIES) $(check_PROGRAMS) - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -.sh.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.sh$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__post_remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__post_remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__post_remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__post_remove_distdir) - -dist-tarZ: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__post_remove_distdir) - -dist-shar: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__post_remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__post_remove_distdir) - -dist dist-all: - $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' - $(am__post_remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir) - chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=.. --prefix="$$dc_install_base" \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__post_remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) \ - $(HEADERS) config.h -install-binPROGRAMS: install-libLTLIBRARIES - -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(perlextdir)" "$(DESTDIR)$(pythonextdir)" "$(DESTDIR)$(rubyextdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(perlextdir)" "$(DESTDIR)$(pythonextdir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(datadir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(library_includedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -rm -f bin/$(am__dirstamp) - -rm -f jellyfish/$(DEPDIR)/$(am__dirstamp) - -rm -f jellyfish/$(am__dirstamp) - -rm -f lib/$(DEPDIR)/$(am__dirstamp) - -rm -f lib/$(am__dirstamp) - -rm -f sub_commands/$(DEPDIR)/$(am__dirstamp) - -rm -f sub_commands/$(am__dirstamp) - -rm -f swig/perl5/$(DEPDIR)/$(am__dirstamp) - -rm -f swig/perl5/$(am__dirstamp) - -rm -f swig/python/$(DEPDIR)/$(am__dirstamp) - -rm -f swig/python/$(am__dirstamp) - -rm -f swig/ruby/$(DEPDIR)/$(am__dirstamp) - -rm -f swig/ruby/$(am__dirstamp) - -rm -f unit_tests/$(DEPDIR)/$(am__dirstamp) - -rm -f unit_tests/$(am__dirstamp) - -rm -f unit_tests/gtest/src/$(DEPDIR)/$(am__dirstamp) - -rm -f unit_tests/gtest/src/$(am__dirstamp) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-am - -clean-am: clean-binPROGRAMS clean-checkLTLIBRARIES clean-checkPROGRAMS \ - clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ - clean-perlextLTLIBRARIES clean-pythonextLTLIBRARIES \ - clean-rubyextLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf jellyfish/$(DEPDIR) lib/$(DEPDIR) sub_commands/$(DEPDIR) swig/perl5/$(DEPDIR) swig/python/$(DEPDIR) swig/ruby/$(DEPDIR) unit_tests/$(DEPDIR) unit_tests/gtest/src/$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-dataDATA install-library_includeHEADERS \ - install-man install-perlextLTLIBRARIES install-perlextSCRIPTS \ - install-pkgconfigDATA install-pythonextLTLIBRARIES \ - install-pythonextSCRIPTS install-rubyextLTLIBRARIES - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-binPROGRAMS install-dist_binSCRIPTS \ - install-libLTLIBRARIES - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: install-man1 - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf jellyfish/$(DEPDIR) lib/$(DEPDIR) sub_commands/$(DEPDIR) swig/perl5/$(DEPDIR) swig/python/$(DEPDIR) swig/ruby/$(DEPDIR) unit_tests/$(DEPDIR) unit_tests/gtest/src/$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-dataDATA \ - uninstall-dist_binSCRIPTS uninstall-libLTLIBRARIES \ - uninstall-library_includeHEADERS uninstall-man \ - uninstall-perlextLTLIBRARIES uninstall-perlextSCRIPTS \ - uninstall-pkgconfigDATA uninstall-pythonextLTLIBRARIES \ - uninstall-pythonextSCRIPTS uninstall-rubyextLTLIBRARIES - -uninstall-man: uninstall-man1 - -.MAKE: all check check-am install install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-TESTS \ - check-am clean clean-binPROGRAMS clean-checkLTLIBRARIES \ - clean-checkPROGRAMS clean-cscope clean-generic \ - clean-libLTLIBRARIES clean-libtool clean-local \ - clean-perlextLTLIBRARIES clean-pythonextLTLIBRARIES \ - clean-rubyextLTLIBRARIES cscope cscopelist-am ctags ctags-am \ - dist dist-all dist-bzip2 dist-gzip dist-lzip dist-shar \ - dist-tarZ dist-xz dist-zip distcheck distclean \ - distclean-compile distclean-generic distclean-hdr \ - distclean-libtool distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ - install-data-am install-dataDATA install-dist_binSCRIPTS \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-library_includeHEADERS \ - install-man install-man1 install-pdf install-pdf-am \ - install-perlextLTLIBRARIES install-perlextSCRIPTS \ - install-pkgconfigDATA install-ps install-ps-am \ - install-pythonextLTLIBRARIES install-pythonextSCRIPTS \ - install-rubyextLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - recheck tags tags-am uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-dataDATA \ - uninstall-dist_binSCRIPTS uninstall-libLTLIBRARIES \ - uninstall-library_includeHEADERS uninstall-man uninstall-man1 \ - uninstall-perlextLTLIBRARIES uninstall-perlextSCRIPTS \ - uninstall-pkgconfigDATA uninstall-pythonextLTLIBRARIES \ - uninstall-pythonextSCRIPTS uninstall-rubyextLTLIBRARIES - -.yaggo.hpp: - $(V_YAGGO)$(YAGGO) --license $(srcdir)/header-license -o $@ $< -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - -cd tests; rm -f * - -tests/parallel_hashing.log: tests/generate_sequence.log -tests/subset_hashing.log: tests/generate_sequence.log -tests/bloom_filter.log: tests/generate_sequence.log -tests/bloom_counter.log: tests/generate_sequence.log -tests/multi_file.log: tests/generate_sequence.log -tests/merge.log: tests/generate_sequence.log -tests/min_qual.log: tests/generate_fastq_sequence.log -tests/large_key.log: tests/generate_sequence.log -tests/quality_filter.log: tests/generate_sequence.log -tests/swig_python.log: tests/generate_sequence.log -tests/swig_ruby.log: tests/generate_sequence.log -tests/swig_perl.log: tests/generate_sequence.log -@HAVE_SWIG_TRUE@%/swig_wrap.cpp: $(SWIG_SRC) -@HAVE_SWIG_TRUE@ $(SWIG_V_GEN)$(SWIG) -$(notdir $*) -I$(srcdir)/../include -o $@ $< -@HAVE_SWIG_FALSE@%/swig_wrap.cc: -@HAVE_SWIG_FALSE@ @echo >&2 SWIG >= 3.x.x not found. Make sure it is install and rerun configure -@HAVE_SWIG_FALSE@ @false -@PYTHON_BINDING_TRUE@%/__init__.pyc: %/jellyfish.py -@PYTHON_BINDING_TRUE@ $(PYTHONC_V_GEN)$(PYTHON) -c 'import py_compile, sys; py_compile.compile(sys.argv[1], sys.argv[2])' $< $@ -@PYTHON_BINDING_TRUE@swig/python/jellyfish.py: swig/python/swig_wrap.cpp -@PERL_BINDING_TRUE@swig/perl5/jellyfish.pm: swig/perl5/swig_wrap.cpp - -################# -# SWIG bindings # -################# - --include $(srcdir)/development.mk - -# Print the value of a variable -print-%: - @echo -n $($*) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/modifiedJellyfish/README b/src/modifiedJellyfish/README deleted file mode 100644 index d73a91b3..00000000 --- a/src/modifiedJellyfish/README +++ /dev/null @@ -1,98 +0,0 @@ -Installation -============ - -% ./configure -% make -# As root: -% make install - -To install in a custom directory: - -% ./configure --prefix=/my/dir -% make -% make install - -Then make sure the following environment variables contain the correct -paths: - -PATH -> /my/dir/bin -LD_LIBRARY_PATH -> /my/dir/lib -MANPATH -> /my/dir/share/man -PKG_CONFIG_PATH -> /my/dir/lib/pkgconfig - -Only the PATH environment variables is necessary to run -jellyfish. MANPATH is used by the man command. PKG_CONFIG_PATH and -LD_LIBRARY_PATH are used to compile software against the jellyfish -shared library. - -GCC requirement -=============== - -GCC version 4.4 or higher is required to compile Jellyfish. Most -current Linux distribution provides a version of gcc current -enough. On RedHat 5.x, install the packages gcc44 and gcc44-c++. - -To install on Mac OS X: Jellyfish 2.0 does not compile with Apple's -Xcode GCC 4.2. Instead, the easiest thing to do is to install GCC 4.8 -using MacPorts (http://www.macports.org) using the following commands: - - sudo port install gcc48 - sudo port install gcc_select - sudo port select -set gcc mp-gcc48 - -The first command installs GCC version 4.8. The third command makes -that version of GCC the default, and the second installs a package that -makes the third command work. After the above, you should be able to -run './configure ; make' as normal. - -Tests -===== - -To run the built-in tests, do: - -% make check - -All tests should pass and 1 test should be skipped (big.sh). Running -'make check' will use about 50MB of disk space and will use every CPUs -found on the machine. On our test machine with 32 cores, it takes a -few minutes to run. - -To tests also on large data set, do: - -% make check BIG=1 - -WARNING: this uses >40GB of disk space and takes 30 minutes to run (20 -to create the data, 10 to run jellyfish). - -Notes -===== - -* Jellyfish has been developed and tested on x86-64 GNU/Linux. It - compiles and runs correctly the tests on MacOS X (Intel) and - FreeBSD. It should be fairly easy to port on other *NIX platform - with the gcc compiler, but no guarantee is made. Support for 32-bits - platform has not been tested. - -License -======= - -* The Mersenne Twister random generator is copyrighted by Agner Fog - and distributed under the GPL version 3 or - higher. http://www.agner.org. - -* The Half float implementation is copyrighted by Industrial Light & - Magic and is distributed under the license described in the - HalfLICENSE file. - -* 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 . diff --git a/src/modifiedJellyfish/aclocal.m4 b/src/modifiedJellyfish/aclocal.m4 deleted file mode 100644 index b030c850..00000000 --- a/src/modifiedJellyfish/aclocal.m4 +++ /dev/null @@ -1,1411 +0,0 @@ -# generated automatically by aclocal 1.14.1 -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. - -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant . -# -# 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 2 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) -m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) -AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) -AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_default([$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi -fi[]dnl -])# PKG_PROG_PKG_CONFIG - -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_default([$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test -n "$$1"; then - pkg_cv_[]$1="$$1" - elif test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes ], - [pkg_failed=yes]) - else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG - -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- -AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED - - -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $1]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) - -m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS -and $1[]_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details.]) - -if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - - m4_default([$4], [AC_MSG_ERROR( -[Package requirements ($2) were not met: - -$$1_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -_PKG_TEXT])[]dnl - ]) -elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -_PKG_TEXT - -To get pkg-config, see .])[]dnl - ]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - AC_MSG_RESULT([yes]) - $3 -fi[]dnl -])# PKG_CHECK_MODULES - - -# PKG_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable pkgconfigdir as the location where a module -# should install pkg-config .pc files. By default the directory is -# $libdir/pkgconfig, but the default can be changed by passing -# DIRECTORY. The user can override through the --with-pkgconfigdir -# parameter. -AC_DEFUN([PKG_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([pkgconfigdir], - [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, - [with_pkgconfigdir=]pkg_default) -AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -]) dnl PKG_INSTALLDIR - - -# PKG_NOARCH_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable noarch_pkgconfigdir as the location where a -# module should install arch-independent pkg-config .pc files. By -# default the directory is $datadir/pkgconfig, but the default can be -# changed by passing DIRECTORY. The user can override through the -# --with-noarch-pkgconfigdir parameter. -AC_DEFUN([PKG_NOARCH_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([noarch-pkgconfigdir], - [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, - [with_noarch_pkgconfigdir=]pkg_default) -AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -]) dnl PKG_NOARCH_INSTALLDIR - - -# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ------------------------------------------- -# Retrieves the value of the pkg-config variable for the given module. -AC_DEFUN([PKG_CHECK_VAR], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl - -_PKG_CONFIG([$1], [variable="][$3]["], [$2]) -AS_VAR_COPY([$1], [pkg_cv_][$1]) - -AS_VAR_IF([$1], [""], [$5], [$4])dnl -])# PKG_CHECK_VAR - -# Copyright (C) 2002-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.14' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14.1], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14.1])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to -# '$srcdir', '$srcdir/..', or '$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is '.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` -]) - -# AM_COND_IF -*- Autoconf -*- - -# Copyright (C) 2008-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_COND_IF -# _AM_COND_ELSE -# _AM_COND_ENDIF -# -------------- -# These macros are only used for tracing. -m4_define([_AM_COND_IF]) -m4_define([_AM_COND_ELSE]) -m4_define([_AM_COND_ENDIF]) - -# AM_COND_IF(COND, [IF-TRUE], [IF-FALSE]) -# --------------------------------------- -# If the shell condition COND is true, execute IF-TRUE, otherwise execute -# IF-FALSE. Allow automake to learn about conditional instantiating macros -# (the AC_CONFIG_FOOS). -AC_DEFUN([AM_COND_IF], -[m4_ifndef([_AM_COND_VALUE_$1], - [m4_fatal([$0: no such condition "$1"])])dnl -_AM_COND_IF([$1])dnl -if test -z "$$1_TRUE"; then : - m4_n([$2])[]dnl -m4_ifval([$3], -[_AM_COND_ELSE([$1])dnl -else - $3 -])dnl -_AM_COND_ENDIF([$1])dnl -fi[]dnl -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ([2.52])dnl - m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], - [$1], [CXX], [depcc="$CXX" am_compiler_list=], - [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], - [$1], [UPC], [depcc="$UPC" am_compiler_list=], - [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES. -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE([dependency-tracking], [dnl -AS_HELP_STRING( - [--enable-dependency-tracking], - [do not reject slow dependency extractors]) -AS_HELP_STRING( - [--disable-dependency-tracking], - [speeds up one-time build])]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. -m4_define([AC_PROG_CC], -m4_defn([AC_PROG_CC]) -[_AM_PROG_CC_C_O -]) - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.65])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[AC_DIAGNOSE([obsolete], - [$0: two- and three-arguments forms are deprecated.]) -m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), - [ok:ok],, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) - AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) -AM_MISSING_PROG([AUTOCONF], [autoconf]) -AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) -AM_MISSING_PROG([AUTOHEADER], [autoheader]) -AM_MISSING_PROG([MAKEINFO], [makeinfo]) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES([CC])], - [m4_define([AC_PROG_CC], - m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES([CXX])], - [m4_define([AC_PROG_CXX], - m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES([OBJC])], - [m4_define([AC_PROG_OBJC], - m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], - [_AM_DEPENDENCIES([OBJCXX])], - [m4_define([AC_PROG_OBJCXX], - m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl -]) -AC_REQUIRE([AM_SILENT_RULES])dnl -dnl The testsuite driver may need to know about EXEEXT, so add the -dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This -dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi -]) - -dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST([install_sh])]) - -# Copyright (C) 2003-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it is modern enough. -# If it is, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - AC_MSG_WARN(['missing' script is too old or missing]) -fi -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# -------------------- -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) - -# _AM_SET_OPTIONS(OPTIONS) -# ------------------------ -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_CC_C_O -# --------------- -# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC -# to automatically call this. -AC_DEFUN([_AM_PROG_CC_C_O], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -AC_LANG_PUSH([C])dnl -AC_CACHE_CHECK( - [whether $CC understands -c and -o together], - [am_cv_prog_cc_c_o], - [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i]) -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -AC_LANG_POP([C])]) - -# For backward compatibility. -AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_RUN_LOG(COMMAND) -# ------------------- -# Run COMMAND, save the exit status in ac_status, and log it. -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) -AC_DEFUN([AM_RUN_LOG], -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD - ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - (exit $ac_status); }]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT([yes]) -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi -AC_CONFIG_COMMANDS_PRE( - [AC_MSG_CHECKING([that generated files are newer than configure]) - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - AC_MSG_RESULT([done])]) -rm -f conftest.file -]) - -# Copyright (C) 2009-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl -AS_HELP_STRING( - [--enable-silent-rules], - [less verbose build output (undo: "make V=1")]) -AS_HELP_STRING( - [--disable-silent-rules], - [verbose build output (undo: "make V=0")])dnl -]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few 'make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor 'install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in "make install-strip", and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of 'v7', 'ustar', or 'pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -# -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' - -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - - [m4_case([$1], - [ustar], - [# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi - AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi], - - [pax], - [], - - [m4_fatal([Unknown tar format])]) - - AC_MSG_CHECKING([how to create a $1 tar archive]) - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_$1-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi - done - rm -rf conftest.dir - - AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) - AC_MSG_RESULT([$am_cv_prog_tar_$1])]) - -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([m4/libtool.m4]) -m4_include([m4/ltoptions.m4]) -m4_include([m4/ltsugar.m4]) -m4_include([m4/ltversion.m4]) -m4_include([m4/lt~obsolete.m4]) -m4_include([m4/m4-ax_perl_ext.m4]) -m4_include([m4/m4-ax_pkg_swig.m4]) -m4_include([m4/m4-ax_python_devel.m4]) -m4_include([m4/m4-ax_ruby_ext.m4]) -m4_include([m4/m4-ax_swig_enable_cxx.m4]) diff --git a/src/modifiedJellyfish/compile b/src/modifiedJellyfish/compile deleted file mode 100755 index 531136b0..00000000 --- a/src/modifiedJellyfish/compile +++ /dev/null @@ -1,347 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand '-c -o'. - -scriptversion=2012-10-14.11; # UTC - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# 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 2, 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 . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -nl=' -' - -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent tools from complaining about whitespace usage. -IFS=" "" $nl" - -file_conv= - -# func_file_conv build_file lazy -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. If the determined conversion -# type is listed in (the comma separated) LAZY, no conversion will -# take place. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv/,$2, in - *,$file_conv,*) - ;; - mingw/*) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin/*) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine/*) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_cl_dashL linkdir -# Make cl look for libraries in LINKDIR -func_cl_dashL () -{ - func_file_conv "$1" - if test -z "$lib_path"; then - lib_path=$file - else - lib_path="$lib_path;$file" - fi - linker_opts="$linker_opts -LIBPATH:$file" -} - -# func_cl_dashl library -# Do a library search-path lookup for cl -func_cl_dashl () -{ - lib=$1 - found=no - save_IFS=$IFS - IFS=';' - for dir in $lib_path $LIB - do - IFS=$save_IFS - if $shared && test -f "$dir/$lib.dll.lib"; then - found=yes - lib=$dir/$lib.dll.lib - break - fi - if test -f "$dir/$lib.lib"; then - found=yes - lib=$dir/$lib.lib - break - fi - if test -f "$dir/lib$lib.a"; then - found=yes - lib=$dir/lib$lib.a - break - fi - done - IFS=$save_IFS - - if test "$found" != yes; then - lib=$lib.lib - fi -} - -# func_cl_wrapper cl arg... -# Adjust compile command to suit cl -func_cl_wrapper () -{ - # Assume a capable shell - lib_path= - shared=: - linker_opts= - for arg - do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - eat=1 - case $2 in - *.o | *.[oO][bB][jJ]) - func_file_conv "$2" - set x "$@" -Fo"$file" - shift - ;; - *) - func_file_conv "$2" - set x "$@" -Fe"$file" - shift - ;; - esac - ;; - -I) - eat=1 - func_file_conv "$2" mingw - set x "$@" -I"$file" - shift - ;; - -I*) - func_file_conv "${1#-I}" mingw - set x "$@" -I"$file" - shift - ;; - -l) - eat=1 - func_cl_dashl "$2" - set x "$@" "$lib" - shift - ;; - -l*) - func_cl_dashl "${1#-l}" - set x "$@" "$lib" - shift - ;; - -L) - eat=1 - func_cl_dashL "$2" - ;; - -L*) - func_cl_dashL "${1#-L}" - ;; - -static) - shared=false - ;; - -Wl,*) - arg=${1#-Wl,} - save_ifs="$IFS"; IFS=',' - for flag in $arg; do - IFS="$save_ifs" - linker_opts="$linker_opts $flag" - done - IFS="$save_ifs" - ;; - -Xlinker) - eat=1 - linker_opts="$linker_opts $2" - ;; - -*) - set x "$@" "$1" - shift - ;; - *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) - func_file_conv "$1" - set x "$@" -Tp"$file" - shift - ;; - *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) - func_file_conv "$1" mingw - set x "$@" "$file" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift - done - if test -n "$linker_opts"; then - linker_opts="-link$linker_opts" - fi - exec "$@" $linker_opts - exit 1 -} - -eat= - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand '-c -o'. -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file 'INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) - func_cl_wrapper "$@" # Doesn't return... - ;; -esac - -ofile= -cfile= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - # So we strip '-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no '-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # '.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use '[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/src/modifiedJellyfish/config.guess b/src/modifiedJellyfish/config.guess deleted file mode 100755 index 1f5c50c0..00000000 --- a/src/modifiedJellyfish/config.guess +++ /dev/null @@ -1,1420 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. - -timestamp='2014-03-23' - -# This file 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 . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -# -# Please send patches with a ChangeLog entry to config-patches@gnu.org. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - *:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi - else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; - x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; -esac - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/modifiedJellyfish/config.h.in b/src/modifiedJellyfish/config.h.in deleted file mode 100644 index 06aea984..00000000 --- a/src/modifiedJellyfish/config.h.in +++ /dev/null @@ -1,89 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_EXECINFO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_EXT_STDIO_FILEBUF_H - -/* Define if type __int128 is supported */ -#undef HAVE_INT128 - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Used to find executable path on MacOS X */ -#undef HAVE_NSGETEXECUTABLEPATH - -/* Define if numeric limits specialization exists for __int128 */ -#undef HAVE_NUMERIC_LIMITS128 - -/* If available, contains the Python version number currently in use. */ -#undef HAVE_PYTHON - -/* Define if siginfo_t.si_int exists */ -#undef HAVE_SI_INT - -/* Define if you have SSE */ -#undef HAVE_SSE - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define is using Valgrind */ -#undef HAVE_VALGRIND - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/src/modifiedJellyfish/config.sub b/src/modifiedJellyfish/config.sub deleted file mode 100755 index bba4efb8..00000000 --- a/src/modifiedJellyfish/config.sub +++ /dev/null @@ -1,1799 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. - -timestamp='2014-09-11' - -# This file 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 . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches with a ChangeLog entry to config-patches@gnu.org. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2014 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/modifiedJellyfish/configure b/src/modifiedJellyfish/configure deleted file mode 100755 index 829f30f6..00000000 --- a/src/modifiedJellyfish/configure +++ /dev/null @@ -1,19334 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for jellyfish 2.2.5. -# -# Report bugs to . -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and gmarcais@umd.edu -$0: about your system, including any error possibly output -$0: before this message. Then install a modern shell, or -$0: manually run the script under such a shell if you do -$0: have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -SHELL=${CONFIG_SHELL-/bin/sh} - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='jellyfish' -PACKAGE_TARNAME='jellyfish' -PACKAGE_VERSION='2.2.5' -PACKAGE_STRING='jellyfish 2.2.5' -PACKAGE_BUGREPORT='gmarcais@umd.edu' -PACKAGE_URL='' - -ac_unique_file="jellyfish" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_header_list= -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -PERL_EXT_LDFLAGS -PERL_EXT_CPPFLAGS -PERL_EXT_LIB -PERL_EXT_INC -PERL_EXT_PREFIX -PERL -PERL_BINDING_FALSE -PERL_BINDING_TRUE -RUBY_EXT_LDFLAGS -RUBY_EXT_LIBS -RUBY_EXT_CFLAGS -RUBY_EXT_LIB -RUBY_VERSION -RUBY -RUBY_BINDING_FALSE -RUBY_BINDING_TRUE -PYTHON_EXTRA_LDFLAGS -PYTHON_EXTRA_LIBS -PYTHON_SITE_PKG -PYTHON_LDFLAGS -PYTHON_CPPFLAGS -PYTHON -PYTHON_VERSION -PYTHON_BINDING_FALSE -PYTHON_BINDING_TRUE -HAVE_SWIG_FALSE -HAVE_SWIG_TRUE -SWIG_LIB -SWIG -STATIC_FLAGS -VALGRIND_LIBS -VALGRIND_CFLAGS -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH -PKG_CONFIG -YAGGO -MD5 -PACKAGE_LIB -CXXCPP -am__fastdepCXX_FALSE -am__fastdepCXX_TRUE -CXXDEPMODE -ac_ct_CXX -CXXFLAGS -CXX -ALL_CXXFLAGS -CPP -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -MANIFEST_TOOL -RANLIB -ac_ct_AR -AR -DLLTOOL -OBJDUMP -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -EGREP -GREP -SED -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -LIBTOOL -AM_BACKSLASH -AM_DEFAULT_VERBOSITY -AM_DEFAULT_V -AM_V -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_silent_rules -enable_shared -enable_static -with_pic -enable_fast_install -enable_dependency_tracking -with_gnu_ld -with_sysroot -enable_libtool_lock -with_sse -enable_valgrind -with_int128 -enable_all_static -enable_python_binding -enable_ruby_binding -enable_perl_binding -enable_swig -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -CXX -CXXFLAGS -CCC -CXXCPP -MD5 -YAGGO -PKG_CONFIG -PKG_CONFIG_PATH -PKG_CONFIG_LIBDIR -VALGRIND_CFLAGS -VALGRIND_LIBS -PYTHON_VERSION -RUBY -PERL_EXT_PREFIX -PERL_EXT_INC -PERL_EXT_LIB -PERL_EXT_CPPFLAGS -PERL_EXT_LDFLAGS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures jellyfish 2.2.5 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/jellyfish] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of jellyfish 2.2.5:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --enable-dependency-tracking - do not reject slow dependency extractors - --disable-dependency-tracking - speeds up one-time build - --disable-libtool-lock avoid locking (might break parallel builds) - --enable-valgrind Instrument mmap memory allocation with valgrind - --enable-all-static create statically linked executable - --enable-python-binding[=PATH] - create SWIG python module and install in PATH - --enable-ruby-binding[=PATH] - create SWIG ruby module and install in PATH - --enable-perl-binding[=PATH] - create SWIG perl module and install in PATH - --enable-swig enable development of swig binding - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot=DIR Search for dependent libraries within DIR - (or the compiler's sysroot if not specified). - --with-sse enable SSE - --with-int128 enable int128 - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - MD5 Path to md5 hashing program - YAGGO Yaggo switch parser generator - PKG_CONFIG path to pkg-config utility - PKG_CONFIG_PATH - directories to add to pkg-config's search path - PKG_CONFIG_LIBDIR - path overriding pkg-config's built-in search path - VALGRIND_CFLAGS - C compiler flags for VALGRIND, overriding pkg-config - VALGRIND_LIBS - linker flags for VALGRIND, overriding pkg-config - PYTHON_VERSION - The installed Python version to use, for example '2.3'. This - string will be appended to the Python interpreter canonical - name. - RUBY the Ruby interpreter - PERL_EXT_PREFIX - Perl PREFIX - PERL_EXT_INC - Directory to include XS headers from - PERL_EXT_LIB - Directory to install perl files into - PERL_EXT_CPPFLAGS - CPPFLAGS to compile perl extensions - PERL_EXT_LDFLAGS - LDFLAGS to build perl extensions - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -jellyfish configure 2.2.5 -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_cxx_try_cpp LINENO -# ------------------------ -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_cpp - -# ac_fn_cxx_try_link LINENO -# ------------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_link - -# ac_fn_cxx_check_type LINENO TYPE VAR INCLUDES -# --------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_cxx_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_cxx_check_type - -# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES -# --------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_cxx_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_cxx_check_header_compile - -# ac_fn_cxx_check_member LINENO AGGR MEMBER VAR INCLUDES -# ------------------------------------------------------ -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_cxx_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_cxx_check_member -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by jellyfish $as_me 2.2.5, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -as_fn_append ac_header_list " execinfo.h" -as_fn_append ac_header_list " ext/stdio_filebuf.h" -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - -am__api_version='1.14' - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=1;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='jellyfish' - VERSION='2.2.5' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -mkdir_p='$(MKDIR_P)' - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar pax cpio none' - -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - - - - - - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi -fi - -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=0;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - - -ac_config_headers="$ac_config_headers config.h" - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.4.2' -macro_revision='1.3337' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case "$ECHO" in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_FGREP" || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - -fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then - reload_cmds=false - fi - ;; - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} -: ${AR_FLAGS=cru} - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi - - -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 -$as_echo "${with_sysroot}" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - case `/usr/bin/file conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac - ;; - powerpc64le-*) - LD="${LD-ld} -m elf32lppclinux" - ;; - powerpc64-*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - powerpcle-*) - LD="${LD-ld} -m elf64lppc" - ;; - powerpc-*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD="${LD-ld}_sol2" - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL - fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" -fi - -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi - - - - - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&5 - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test $_lt_result -eq 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&5 - elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for lt_pkg in $withval; do - IFS="$lt_save_ifs" - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - if test -n "$lt_prog_compiler_pic"; then - lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ F* | *Sun*Fortran*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Intel*\ [CF]*Compiler*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - *Portland\ Group*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs=no - ;; - esac - - ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - link_all_deplibs=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - enable_shared_with_static_runtimes=yes - ;; - esac - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test "$lt_cv_irix_exported_symbol" = yes; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[23].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - -# Change default compilation flags -ALL_CXXFLAGS=-std=c++0x - -CXXFLAGS="-std=c++0x $CXXFLAGS" -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - - - -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf - - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -$as_echo_n "checking how to run the C++ preprocessor... " >&6; } -if test -z "$CXXCPP"; then - if ${ac_cv_prog_CXXCPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -$as_echo "$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -else - _lt_caught_CXX_error=yes -fi - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -compiler_needs_object_CXX=no -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_direct_absolute_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_shlibpath_var_CXX=unsupported -hardcode_automatic_CXX=no -inherit_rpath_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -reload_flag_CXX=$reload_flag -reload_cmds_CXX=$reload_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - - # save warnings/boilerplate of simple test code - ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - - ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - compiler_CXX=$CC - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' - else - lt_prog_compiler_no_builtin_flag_CXX= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - ld_shlibs_CXX=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - file_list_spec_CXX='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec_CXX='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath__CXX -fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath__CXX -fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX='$convenience' - fi - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_CXX=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_CXX=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_CXX=' ' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=yes - file_list_spec_CXX='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' - enable_shared_with_static_runtimes_CXX=yes - # Don't use ranlib - old_postinstall_cmds_CXX='chmod 644 $oldlib' - postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_CXX=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - - - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - - else - whole_archive_flag_spec_CXX='' - fi - link_all_deplibs_CXX=yes - allow_undefined_flag_CXX="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi - - else - ld_shlibs_CXX=no - fi - - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - freebsd2.*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - ld_shlibs_CXX=no - ;; - - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - - haiku*) - archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs_CXX=yes - ;; - - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - *) - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - interix[3-9]*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - inherit_rpath_CXX=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [1-5].* | *pgcpp\ [1-5].*) - prelink_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - old_archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - hardcode_libdir_flag_spec_CXX='-R$libdir' - whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object_CXX=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - ld_shlibs_CXX=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - hardcode_direct_absolute_CXX=yes - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - ld_shlibs_CXX=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx*) - case $host in - osf3*) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - ;; - *) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - ;; - esac - - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - archive_cmds_need_lc_CXX=yes - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_CXX='${wl}-z,text' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag_CXX='${wl}-z,text' - allow_undefined_flag_CXX='${wl}-z,nodefs' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - export_dynamic_flag_spec_CXX='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ - '"$old_archive_cmds_CXX" - reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ - '"$reload_cmds_CXX" - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } - test "$ld_shlibs_CXX" = no && can_build_shared=no - - GCC_CXX="$GXX" - LD_CXX="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - # Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF - - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; -esac - -if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -case $host_os in -interix[3-9]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - predep_objects_CXX= - postdep_objects_CXX= - postdeps_CXX= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac - - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - compiler_lib_search_dirs_CXX= -if test -n "${compiler_lib_search_path_CXX}"; then - compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic_CXX='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static_CXX= - ;; - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix[4-9]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - dgux*) - case $cc_basename in - ec++*) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - lt_prog_compiler_static_CXX='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-qpic' - lt_prog_compiler_static_CXX='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx*) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc*) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } -lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } -if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works_CXX=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works_CXX=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works_CXX=yes - fi - else - lt_cv_prog_compiler_static_works_CXX=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } - -if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then - : -else - lt_prog_compiler_static_CXX= -fi - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - case $host_os in - aix[4-9]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) - exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs_CXX=no - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } -test "$ld_shlibs_CXX" = no && can_build_shared=no - -with_gnu_ld_CXX=$with_gnu_ld - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - pic_flag=$lt_prog_compiler_pic_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc_CXX=no - else - lt_cv_archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } - archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[23].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || - test -n "$runpath_var_CXX" || - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 -$as_echo "$hardcode_action_CXX" >&6; } - -if test "$hardcode_action_CXX" = relink || - test "$inherit_rpath_CXX" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - -# Major version of the library -PACKAGE_LIB=2.0 - - -# Check for md5 or md5sum - -if test "x$MD5" = "x"; then : - # Extract the first word of "md5sum", so it can be a program name with args. -set dummy md5sum; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MD5+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MD5"; then - ac_cv_prog_MD5="$MD5" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_MD5="md5sum" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MD5=$ac_cv_prog_MD5 -if test -n "$MD5"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MD5" >&5 -$as_echo "$MD5" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test "x$MD5" = "x"; then : - # Extract the first word of "md5", so it can be a program name with args. -set dummy md5; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MD5+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MD5"; then - ac_cv_prog_MD5="$MD5" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_MD5="md5 -r" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MD5=$ac_cv_prog_MD5 -if test -n "$MD5"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MD5" >&5 -$as_echo "$MD5" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test "x$MD5" = "x"; then : - as_fn_error $? "Could not find md5 hashing program in your path" "$LINENO" 5 -fi - -# Check for yaggo - -if test "x$YAGGO" = "x"; then : - # Extract the first word of "yaggo", so it can be a program name with args. -set dummy yaggo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_YAGGO+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $YAGGO in - [\\/]* | ?:[\\/]*) - ac_cv_path_YAGGO="$YAGGO" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_YAGGO="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_YAGGO" && ac_cv_path_YAGGO="false" - ;; -esac -fi -YAGGO=$ac_cv_path_YAGGO -if test -n "$YAGGO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YAGGO" >&5 -$as_echo "$YAGGO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi - - -ac_config_files="$ac_config_files Makefile tests/compat.sh jellyfish-2.0.pc" - - - - -# Check whether --with-sse was given. -if test "${with_sse+set}" = set; then : - withval=$with_sse; -else - with_sse=yes -fi - -if test "x$with_sse" != xno; then : - -$as_echo "#define HAVE_SSE 1" >>confdefs.h - -fi - -# Use valgrind to check memory allocation with mmap -# Check whether --enable-valgrind was given. -if test "${enable_valgrind+set}" = set; then : - enableval=$enable_valgrind; -fi - - - - - - - - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG="" - fi -fi -if test "x$enable_valgrind" = xyes; then : - -$as_echo "#define HAVE_VALGRIND 1" >>confdefs.h - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for VALGRIND" >&5 -$as_echo_n "checking for VALGRIND... " >&6; } - -if test -n "$VALGRIND_CFLAGS"; then - pkg_cv_VALGRIND_CFLAGS="$VALGRIND_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"valgrind >= 1.8.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "valgrind >= 1.8.0") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_VALGRIND_CFLAGS=`$PKG_CONFIG --cflags "valgrind >= 1.8.0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$VALGRIND_LIBS"; then - pkg_cv_VALGRIND_LIBS="$VALGRIND_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"valgrind >= 1.8.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "valgrind >= 1.8.0") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_VALGRIND_LIBS=`$PKG_CONFIG --libs "valgrind >= 1.8.0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - VALGRIND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "valgrind >= 1.8.0" 2>&1` - else - VALGRIND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "valgrind >= 1.8.0" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$VALGRIND_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (valgrind >= 1.8.0) were not met: - -$VALGRIND_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables VALGRIND_CFLAGS -and VALGRIND_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables VALGRIND_CFLAGS -and VALGRIND_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - VALGRIND_CFLAGS=$pkg_cv_VALGRIND_CFLAGS - VALGRIND_LIBS=$pkg_cv_VALGRIND_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi -fi - -# Check that type __int128 is supported and if the -# std::numeric_limits<__int128> specialization exists - -# Check whether --with-int128 was given. -if test "${with_int128+set}" = set; then : - withval=$with_int128; -else - with_int128=yes -fi - -if test "x$with_int128" != xno; then : - ac_fn_cxx_check_type "$LINENO" "__int128" "ac_cv_type___int128" "$ac_includes_default" -if test "x$ac_cv_type___int128" = xyes; then : - -$as_echo "#define HAVE_INT128 1" >>confdefs.h - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::numeric_limits<__int128>" >&5 -$as_echo_n "checking for std::numeric_limits<__int128>... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - template struct StaticAssert; template<> struct StaticAssert { static void assert() { } }; -int -main () -{ -StaticAssert::is_specialized>::assert(); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_NUMERIC_LIMITS128 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -# On MacOS X, use _NSGetExecutablePath to find path to own executable -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _NSGetExecutablePath" >&5 -$as_echo_n "checking for _NSGetExecutablePath... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -_NSGetExecutablePath(0, 0); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_NSGETEXECUTABLEPATH 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -# Check the version of strerror_r - - - - for ac_header in $ac_header_list -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - - -ac_fn_cxx_check_member "$LINENO" "siginfo_t" "si_int" "ac_cv_member_siginfo_t_si_int" "#include -" -if test "x$ac_cv_member_siginfo_t_si_int" = xyes; then : - -$as_echo "#define HAVE_SI_INT 1" >>confdefs.h - -fi - - -# --enable-all-static -# Do not use libtool if building all static -# Check whether --enable-all-static was given. -if test "${enable_all_static+set}" = set; then : - enableval=$enable_all_static; -fi - -STATIC_FLAGS= -if test x$enable_all_static = xyes; then : - STATIC_FLAGS=-all-static - -fi - -# -# SWIG and bindings -# -maybe_swig= -# --enable-python-binding -# Check whether --enable-python-binding was given. -if test "${enable_python_binding+set}" = set; then : - enableval=$enable_python_binding; -fi - -# --enable-ruby-binding -# Check whether --enable-ruby-binding was given. -if test "${enable_ruby_binding+set}" = set; then : - enableval=$enable_ruby_binding; -fi - -# --enable-perl-binding -# Check whether --enable-perl-binding was given. -if test "${enable_perl_binding+set}" = set; then : - enableval=$enable_perl_binding; -fi - - -# --enable-swig -# Check whether --enable-swig was given. -if test "${enable_swig+set}" = set; then : - enableval=$enable_swig; -fi - -if test x$enable_swig = xyes; then : - - # Ubuntu has swig 2.0 as /usr/bin/swig2.0 - for ac_prog in swig swig2.0 -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_SWIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $SWIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -SWIG=$ac_cv_path_SWIG -if test -n "$SWIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5 -$as_echo "$SWIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$SWIG" && break -done - - if test -z "$SWIG" ; then - as_fn_error $? "SWIG version 3 is required" "$LINENO" 5 - elif test -n "3.0.0" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5 -$as_echo_n "checking SWIG version... " >&6; } - swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5 -$as_echo "$swig_version" >&6; } - if test -n "$swig_version" ; then - # Calculate the required version number components - required=3.0.0 - required_major=`echo $required | sed 's/[^0-9].*//'` - if test -z "$required_major" ; then - required_major=0 - fi - required=`echo $required | sed 's/[0-9]*[^0-9]//'` - required_minor=`echo $required | sed 's/[^0-9].*//'` - if test -z "$required_minor" ; then - required_minor=0 - fi - required=`echo $required | sed 's/[0-9]*[^0-9]//'` - required_patch=`echo $required | sed 's/[^0-9].*//'` - if test -z "$required_patch" ; then - required_patch=0 - fi - # Calculate the available version number components - available=$swig_version - available_major=`echo $available | sed 's/[^0-9].*//'` - if test -z "$available_major" ; then - available_major=0 - fi - available=`echo $available | sed 's/[0-9]*[^0-9]//'` - available_minor=`echo $available | sed 's/[^0-9].*//'` - if test -z "$available_minor" ; then - available_minor=0 - fi - available=`echo $available | sed 's/[0-9]*[^0-9]//'` - available_patch=`echo $available | sed 's/[^0-9].*//'` - if test -z "$available_patch" ; then - available_patch=0 - fi - # Convert the version tuple into a single number for easier comparison. - # Using base 100 should be safe since SWIG internally uses BCD values - # to encode its version number. - required_swig_vernum=`expr $required_major \* 10000 \ - \+ $required_minor \* 100 \+ $required_patch` - available_swig_vernum=`expr $available_major \* 10000 \ - \+ $available_minor \* 100 \+ $available_patch` - - if test $available_swig_vernum -lt $required_swig_vernum; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >= 3.0.0 is required. You have $swig_version." >&5 -$as_echo "$as_me: WARNING: SWIG version >= 3.0.0 is required. You have $swig_version." >&2;} - SWIG='' - as_fn_error $? "SWIG version 3 is required" "$LINENO" 5 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5 -$as_echo_n "checking for SWIG library... " >&6; } - SWIG_LIB=`$SWIG -swiglib` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5 -$as_echo "$SWIG_LIB" >&6; } - - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5 -$as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;} - SWIG='' - as_fn_error $? "SWIG version 3 is required" "$LINENO" 5 - fi - fi - - -fi -if test -n "$SWIG"; then : - - - - SWIG="$SWIG -c++" - -fi - if test -n "$SWIG"; then - HAVE_SWIG_TRUE= - HAVE_SWIG_FALSE='#' -else - HAVE_SWIG_TRUE='#' - HAVE_SWIG_FALSE= -fi - - -# Python binding setup - if test -n "$enable_python_binding" -a x$enable_python_binding != xno; then - PYTHON_BINDING_TRUE= - PYTHON_BINDING_FALSE='#' -else - PYTHON_BINDING_TRUE='#' - PYTHON_BINDING_FALSE= -fi - -if test -z "$PYTHON_BINDING_TRUE"; then : - if test x$enable_python_binding != xyes; then : - PYTHON_SITE_PKG=$enable_python_binding -fi - - # - # Allow the use of a (user set) custom python version - # - - - # Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args. -set dummy python$PYTHON_VERSION; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PYTHON in - [\\/]* | ?:[\\/]*) - ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PYTHON=$ac_cv_path_PYTHON -if test -n "$PYTHON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 -$as_echo "$PYTHON" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test -z "$PYTHON"; then - as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5 - PYTHON_VERSION="" - fi - - # - # Check for a version of Python >= 2.1.0 - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5 -$as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; } - ac_supports_python_ver=`$PYTHON -c "import sys; \ - ver = sys.version.split ()[0]; \ - print (ver >= '2.1.0')"` - if test "$ac_supports_python_ver" != "True"; then - if test -z "$PYTHON_NOVERSIONCHECK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? " -This version of the AC_PYTHON_DEVEL macro -doesn't work properly with versions of Python before -2.1.0. You may need to re-run configure, setting the -variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, -PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. -Moreover, to disable this check, set PYTHON_NOVERSIONCHECK -to something else than an empty string. - -See \`config.log' for more details" "$LINENO" 5; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5 -$as_echo "skip at user request" >&6; } - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - fi - - # - # if the macro parameter ``version'' is set, honour it - # - if test -n ""; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python " >&5 -$as_echo_n "checking for a version of Python ... " >&6; } - ac_supports_python_ver=`$PYTHON -c "import sys; \ - ver = sys.version.split ()[0]; \ - print (ver )"` - if test "$ac_supports_python_ver" = "True"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "this package requires Python . -If you have it installed, but it isn't the default Python -interpreter in your system path, please pass the PYTHON_VERSION -variable to configure. See \`\`configure --help'' for reference. -" "$LINENO" 5 - PYTHON_VERSION="" - fi - fi - - if test -n "$prefix" -a "x$prefix" != xNONE; then - prefix=$prefix - else - prefix= - fi - - # - # Check if you have distutils, else fail - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 -$as_echo_n "checking for the distutils Python package... " >&6; } - ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` - if test -z "$ac_distutils_result"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "cannot import Python module \"distutils\". -Please check your Python installation. The error was: -$ac_distutils_result" "$LINENO" 5 - PYTHON_VERSION="" - fi - - # - # Check for Python include path - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5 -$as_echo_n "checking for Python include path... " >&6; } - if test -z "$PYTHON_CPPFLAGS"; then - python_path=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_inc ());"` - plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_inc (plat_specific=1));"` - if test -n "${python_path}"; then - if test "${plat_python_path}" != "${python_path}"; then - python_path="-I$python_path -I$plat_python_path" - else - python_path="-I$python_path" - fi - fi - PYTHON_CPPFLAGS=$python_path - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5 -$as_echo "$PYTHON_CPPFLAGS" >&6; } - - - # - # Check for Python library path - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5 -$as_echo_n "checking for Python library path... " >&6; } - if test -z "$PYTHON_LDFLAGS"; then - # (makes two attempts to ensure we've got a version number - # from the interpreter) - ac_python_version=`cat<>confdefs.h <<_ACEOF -#define HAVE_PYTHON "$ac_python_version" -_ACEOF - - - # First, the library directory: - ac_python_libdir=`cat<&5 -$as_echo "$PYTHON_LDFLAGS" >&6; } - - - # - # Check for site packages - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5 -$as_echo_n "checking for Python site-packages path... " >&6; } - if test -z "$PYTHON_SITE_PKG"; then - PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ - import sys; \ - pref=sys.argv.pop(); \ - pref=pref if 4 > 0 and pref != '-c' else None; \ - print(distutils.sysconfig.get_python_lib(0,0,pref));" $prefix` - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5 -$as_echo "$PYTHON_SITE_PKG" >&6; } - - - # - # libraries which must be linked in when embedding - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5 -$as_echo_n "checking python extra libraries... " >&6; } - if test -z "$PYTHON_EXTRA_LIBS"; then - PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ - print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5 -$as_echo "$PYTHON_EXTRA_LIBS" >&6; } - - - # - # linking flags needed when embedding - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5 -$as_echo_n "checking python extra linking flags... " >&6; } - if test -z "$PYTHON_EXTRA_LDFLAGS"; then - PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ - print (conf('LINKFORSHARED'))"` - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5 -$as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; } - - - # - # final check to see if everything compiles alright - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5 -$as_echo_n "checking consistency of all components of python development environment... " >&6; } - # save current global flags - ac_save_LIBS="$LIBS" - ac_save_CPPFLAGS="$CPPFLAGS" - LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS" - CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include -int -main () -{ -Py_Initialize(); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - pythonexists=yes -else - pythonexists=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - # turn back to default flags - CPPFLAGS="$ac_save_CPPFLAGS" - LIBS="$ac_save_LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5 -$as_echo "$pythonexists" >&6; } - - if test ! "x$pythonexists" = "xyes"; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? " - Could not link test program to Python. Maybe the main Python library has been - installed in some non-standard library path. If so, pass it to configure, - via the LDFLAGS environment variable. - Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\" - ============================================================================ - ERROR! - You probably have to install the development version of the Python package - for your distribution. The exact name of this package varies among them. - ============================================================================ - -See \`config.log' for more details" "$LINENO" 5; } - PYTHON_VERSION="" - fi - - # - # all done! - # - -fi - -# Ruby binding setup - if test -n "$enable_ruby_binding" -a x$enable_ruby_binding != xno; then - RUBY_BINDING_TRUE= - RUBY_BINDING_FALSE='#' -else - RUBY_BINDING_TRUE='#' - RUBY_BINDING_FALSE= -fi - -if test -z "$RUBY_BINDING_TRUE"; then : - if test x$enable_ruby_binding != xyes; then : - RUBY_EXT_LIB=$enable_ruby_binding -fi - - # - # Check if ruby executable exists. - # - - for ac_prog in "${RUBY-ruby}" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_RUBY+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $RUBY in - [\\/]* | ?:[\\/]*) - ac_cv_path_RUBY="$RUBY" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_RUBY="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -RUBY=$ac_cv_path_RUBY -if test -n "$RUBY"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY" >&5 -$as_echo "$RUBY" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$RUBY" && break -done - - - if test -n "$RUBY" ; then - # - # Check Ruby version. - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby version" >&5 -$as_echo_n "checking for Ruby version... " >&6; } - RUBY_VERSION=`$RUBY -e 'print RUBY_VERSION'`; - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_VERSION" >&5 -$as_echo "$RUBY_VERSION" >&6; } - - - # - # Check for the extensions target directory. - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby extensions target directory" >&5 -$as_echo_n "checking for Ruby extensions target directory... " >&6; } - if test -z "$RUBY_EXT_LIB"; then : - if test -z "$prefix" -o "x$prefix" = xNONE; then : - RUBY_EXT_LIB=`$RUBY -rrbconfig -e 'print RbConfig::expand(RbConfig::CONFIG.fetch("sitearchdir"))'` -else - RUBY_EXT_LIB=`$RUBY -rrbconfig -e 'print(ARGV.fetch(0), "/lib/ruby/", RbConfig::CONFIG.fetch("ruby_version"))' $prefix` -fi -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_EXT_LIB" >&5 -$as_echo "$RUBY_EXT_LIB" >&6; } - - - # - # Check for include flags - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby include directory" >&5 -$as_echo_n "checking for Ruby include directory... " >&6; } - if test -z "$RUBY_EXT_CFLAGS"; then : - RUBY_EXT_CFLAGS="-I`$RUBY -rrbconfig -e 'print RbConfig::expand(RbConfig::CONFIG.fetch("rubyhdrdir"))'`" - RUBY_EXT_CFLAGS="$RUBY_EXT_CFLAGS -I`$RUBY -rrbconfig -e 'print RbConfig::CONFIG.has_key?("rubyarchhdrdir") ? RbConfig::expand(RbConfig::CONFIG.fetch("rubyarchhdrdir")) : File.join(RbConfig::expand(RbConfig::CONFIG.fetch("rubyhdrdir")), RbConfig::CONFIG.fetch("arch"))'`" -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_EXT_CFLAGS" >&5 -$as_echo "$RUBY_EXT_CFLAGS" >&6; } - - - # - # Check for lib flags - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby libs" >&5 -$as_echo_n "checking for Ruby libs... " >&6; } - if test -z "$RUBY_EXT_LIBS"; then : - RUBY_EXT_LIBS="`$RUBY -rrbconfig -e 'print RbConfig::expand(RbConfig::CONFIG.fetch("LIBRUBYARG_SHARED"))'` `$RUBY -rrbconfig -e 'print RbConfig::expand(RbConfig::CONFIG.fetch("LIBS"))'`" -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_EXT_LIBS" >&5 -$as_echo "$RUBY_EXT_LIBS" >&6; } - - - - # Fix LDFLAGS for OS X. We don't want any -arch flags here, otherwise - # linking might fail. We also including the proper flags to create a bundle. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby extra LDFLAGS" >&5 -$as_echo_n "checking for Ruby extra LDFLAGS... " >&6; } - case "$host" in - *darwin*) - RUBY_EXT_LDFLAGS=`echo ${RUBY_EXT_LDFLAGS} | sed -e "s,-arch [^ ]*,,g"` - RUBY_EXT_LDFLAGS="${RUBY_EXT_LDFLAGS} -bundle -undefined dynamic_lookup" - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_EXT_LDFLAGS" >&5 -$as_echo "$RUBY_EXT_LDFLAGS" >&6; } - - fi - -fi - -# Perl binding setup - if test -n "$enable_perl_binding" -a x$enable_perl_binding != xno; then - PERL_BINDING_TRUE= - PERL_BINDING_FALSE='#' -else - PERL_BINDING_TRUE='#' - PERL_BINDING_FALSE= -fi - -if test -z "$PERL_BINDING_TRUE"; then : - if test x$enable_perl_binding != xyes; then : - PERL_EXT_LIB=$enable_perl_binding -fi - - - # - # Check if perl executable exists. - # - for ac_prog in "${PERL-perl}" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PERL+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_PERL="$PERL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PERL=$ac_cv_path_PERL -if test -n "$PERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -$as_echo "$PERL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$PERL" && break -done - - - if test -n "$PERL" ; then - - # - # Check for Perl prefix. - # - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl prefix" >&5 -$as_echo_n "checking for Perl prefix... " >&6; } - if test -z "$PERL_EXT_PREFIX" ; then - PERL_EXT_PREFIX=`$PERL -MConfig -e 'print $Config{prefix};'`; - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL_EXT_PREFIX" >&5 -$as_echo "$PERL_EXT_PREFIX" >&6; } - - - # - # Check for Perl extensions include path. - # - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl extension include path" >&5 -$as_echo_n "checking for Perl extension include path... " >&6; } - if test -z "$PERL_EXT_INC" ; then - PERL_EXT_INC=`$PERL -MConfig -e 'print $Config{archlibexp}, "/CORE";'`; - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL_EXT_INC" >&5 -$as_echo "$PERL_EXT_INC" >&6; } - - - # - # Check for the extensions target directory. - # - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl extension target directory" >&5 -$as_echo_n "checking for Perl extension target directory... " >&6; } - if test -z "$PERL_EXT_LIB" ; then - if test -z "$prefix" -o "x$prefix" = xNONE ; then - PERL_EXT_LIB=`$PERL -MConfig -e 'print $Config{sitearch};'`; - else - PERL_EXT_LIB=`$PERL -MConfig -e 'print $ARGV.shift, "/lib/perl/", $Config{api_versionstring};' $prefix` - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL_EXT_LIB" >&5 -$as_echo "$PERL_EXT_LIB" >&6; } - - - # - # Check for Perl CPP flags. - # - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl extensions C preprocessor flags" >&5 -$as_echo_n "checking for Perl extensions C preprocessor flags... " >&6; } - if test -z "$PERL_EXT_CPPFLAGS" ; then - PERL_EXT_CPPFLAGS=`$PERL -MConfig -e 'print $Config{cppflags};'`; - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL_EXT_CPPFLAGS" >&5 -$as_echo "$PERL_EXT_CPPFLAGS" >&6; } - - - # - # Check for Perl extension link flags. - # - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl extensions linker flags" >&5 -$as_echo_n "checking for Perl extensions linker flags... " >&6; } - if test -z "$PERL_EXT_LDFLAGS" ; then - PERL_EXT_LDFLAGS=`$PERL -MConfig -e 'print $Config{lddlflags};'`; - fi - # Fix LDFLAGS for OS X. We don't want any -arch flags here, otherwise - # linking will fail. Also, OS X Perl LDFLAGS contains "-arch ppc" which - # is not supported by XCode anymore. - case "${host}" in - *darwin*) - PERL_EXT_LDFLAGS=`echo ${PERL_EXT_LDFLAGS} | sed -e "s,-arch [^ ]*,,g"` - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL_EXT_LDFLAGS" >&5 -$as_echo "$PERL_EXT_LDFLAGS" >&6; } - - - fi - -fi - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_SWIG_TRUE}" && test -z "${HAVE_SWIG_FALSE}"; then - as_fn_error $? "conditional \"HAVE_SWIG\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${PYTHON_BINDING_TRUE}" && test -z "${PYTHON_BINDING_FALSE}"; then - as_fn_error $? "conditional \"PYTHON_BINDING\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${RUBY_BINDING_TRUE}" && test -z "${RUBY_BINDING_FALSE}"; then - as_fn_error $? "conditional \"RUBY_BINDING\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${PERL_BINDING_TRUE}" && test -z "${PERL_BINDING_FALSE}"; then - as_fn_error $? "conditional \"PERL_BINDING\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by jellyfish $as_me 2.2.5, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -jellyfish config.status 2.2.5 -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' -lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' -want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' -DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' -sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' -lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' -predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' -postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' -predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' -postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' -LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' -reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' -reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' -compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' -GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' -archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' -module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' -with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' -no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' -inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' -link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' -always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' -exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' -include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' -prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' -postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' -file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' -predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' -postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' -predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' -postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in SHELL \ -ECHO \ -PATH_SEPARATOR \ -SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -OBJDUMP \ -deplibs_check_method \ -file_magic_cmd \ -file_magic_glob \ -want_nocaseglob \ -DLLTOOL \ -sharedlib_from_linklib_cmd \ -AR \ -AR_FLAGS \ -archiver_list_spec \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -nm_file_list_spec \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_pic \ -lt_prog_compiler_wl \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -MANIFEST_TOOL \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_separator \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -install_override_mode \ -finish_eval \ -old_striplib \ -striplib \ -compiler_lib_search_dirs \ -predep_objects \ -postdep_objects \ -predeps \ -postdeps \ -compiler_lib_search_path \ -LD_CXX \ -reload_flag_CXX \ -compiler_CXX \ -lt_prog_compiler_no_builtin_flag_CXX \ -lt_prog_compiler_pic_CXX \ -lt_prog_compiler_wl_CXX \ -lt_prog_compiler_static_CXX \ -lt_cv_prog_compiler_c_o_CXX \ -export_dynamic_flag_spec_CXX \ -whole_archive_flag_spec_CXX \ -compiler_needs_object_CXX \ -with_gnu_ld_CXX \ -allow_undefined_flag_CXX \ -no_undefined_flag_CXX \ -hardcode_libdir_flag_spec_CXX \ -hardcode_libdir_separator_CXX \ -exclude_expsyms_CXX \ -include_expsyms_CXX \ -file_list_spec_CXX \ -compiler_lib_search_dirs_CXX \ -predep_objects_CXX \ -postdep_objects_CXX \ -predeps_CXX \ -postdeps_CXX \ -compiler_lib_search_path_CXX; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postlink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec \ -reload_cmds_CXX \ -old_archive_cmds_CXX \ -old_archive_from_new_cmds_CXX \ -old_archive_from_expsyms_cmds_CXX \ -archive_cmds_CXX \ -archive_expsym_cmds_CXX \ -module_cmds_CXX \ -module_expsym_cmds_CXX \ -export_symbols_cmds_CXX \ -prelink_cmds_CXX \ -postlink_cmds_CXX; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "tests/compat.sh") CONFIG_FILES="$CONFIG_FILES tests/compat.sh" ;; - "jellyfish-2.0.pc") CONFIG_FILES="$CONFIG_FILES jellyfish-2.0.pc" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="CXX " - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# The PATH separator for the build system. -PATH_SEPARATOR=$lt_PATH_SEPARATOR - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# convert \$build file names to \$host format. -to_host_file_cmd=$lt_cv_to_host_file_cmd - -# convert \$build files to toolchain format. -to_tool_file_cmd=$lt_cv_to_tool_file_cmd - -# An object symbol dumper. -OBJDUMP=$lt_OBJDUMP - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method = "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob=$lt_file_magic_glob - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob=$lt_want_nocaseglob - -# DLL creation program. -DLLTOOL=$lt_DLLTOOL - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd - -# The archiver. -AR=$lt_AR - -# Flags to create an archive. -AR_FLAGS=$lt_AR_FLAGS - -# How to feed a file listing to the archiver. -archiver_list_spec=$lt_archiver_list_spec - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# Specify filename containing input files for \$NM. -nm_file_list_spec=$lt_nm_file_list_spec - -# The root where to search for dependent libraries,and in which our libraries should be installed. -lt_sysroot=$lt_sysroot - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Manifest tool. -MANIFEST_TOOL=$lt_MANIFEST_TOOL - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects -postdep_objects=$lt_postdep_objects -predeps=$lt_predeps -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - if test x"$xsi_shell" = xyes; then - sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ -func_dirname ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_basename ()$/,/^} # func_basename /c\ -func_basename ()\ -{\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ -func_dirname_and_basename ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ -func_stripname ()\ -{\ -\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ -\ # positional parameters, so assign one to ordinary parameter first.\ -\ func_stripname_result=${3}\ -\ func_stripname_result=${func_stripname_result#"${1}"}\ -\ func_stripname_result=${func_stripname_result%"${2}"}\ -} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ -func_split_long_opt ()\ -{\ -\ func_split_long_opt_name=${1%%=*}\ -\ func_split_long_opt_arg=${1#*=}\ -} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ -func_split_short_opt ()\ -{\ -\ func_split_short_opt_arg=${1#??}\ -\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ -} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ -func_lo2o ()\ -{\ -\ case ${1} in\ -\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ -\ *) func_lo2o_result=${1} ;;\ -\ esac\ -} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_xform ()$/,/^} # func_xform /c\ -func_xform ()\ -{\ - func_xform_result=${1%.*}.lo\ -} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_arith ()$/,/^} # func_arith /c\ -func_arith ()\ -{\ - func_arith_result=$(( $* ))\ -} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_len ()$/,/^} # func_len /c\ -func_len ()\ -{\ - func_len_result=${#1}\ -} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - -fi - -if test x"$lt_shell_append" = xyes; then - sed -e '/^func_append ()$/,/^} # func_append /c\ -func_append ()\ -{\ - eval "${1}+=\\${2}"\ -} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ -func_append_quoted ()\ -{\ -\ func_quote_for_eval "${2}"\ -\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ -} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 -$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} -fi - - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - - cat <<_LT_EOF >> "$ofile" - -# ### BEGIN LIBTOOL TAG CONFIG: CXX - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# How to create reloadable object files. -reload_flag=$lt_reload_flag_CXX -reload_cmds=$lt_reload_cmds_CXX - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds_CXX - -# A language specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU compiler? -with_gcc=$GCC_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object_CXX - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld_CXX - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute_CXX - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath_CXX - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds_CXX - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds_CXX - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec_CXX - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects_CXX -postdep_objects=$lt_postdep_objects_CXX -predeps=$lt_predeps_CXX -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# ### END LIBTOOL TAG CONFIG: CXX -_LT_EOF - - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - - diff --git a/src/modifiedJellyfish/configure.ac b/src/modifiedJellyfish/configure.ac deleted file mode 100644 index 75158550..00000000 --- a/src/modifiedJellyfish/configure.ac +++ /dev/null @@ -1,134 +0,0 @@ -AC_INIT([jellyfish], [2.2.5], [gmarcais@umd.edu]) -AC_CANONICAL_HOST -AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([subdir-objects foreign parallel-tests color-tests]) -AM_SILENT_RULES([yes]) -AC_CONFIG_SRCDIR([jellyfish]) -AC_CONFIG_HEADERS([config.h]) -AC_PROG_LIBTOOL - -# Change default compilation flags -AC_SUBST([ALL_CXXFLAGS], [-std=c++0x]) -CXXFLAGS="-std=c++0x $CXXFLAGS" -AC_LANG(C++) -AC_PROG_CXX - -# Major version of the library -AC_SUBST([PACKAGE_LIB], [2.0]) - -# Check for md5 or md5sum -AC_ARG_VAR([MD5], [Path to md5 hashing program]) -AS_IF([test "x$MD5" = "x"], AC_CHECK_PROG([MD5], [md5sum], [md5sum]), []) -AS_IF([test "x$MD5" = "x"], AC_CHECK_PROG([MD5], [md5], [md5 -r]), []) -AS_IF([test "x$MD5" = "x"], AC_MSG_ERROR([Could not find md5 hashing program in your path]), []) - -# Check for yaggo -AC_ARG_VAR([YAGGO], [Yaggo switch parser generator]) -AS_IF([test "x$YAGGO" = "x"], [AC_PATH_PROG([YAGGO], [yaggo], [false])]) - -dnl define([concat], $1$2$3)dnl -define([PC_FILE], jellyfish-2.0.pc) -AC_CONFIG_FILES([ - Makefile - tests/compat.sh -] - PC_FILE -) - - -AC_ARG_WITH([sse], - [AS_HELP_STRING([--with-sse], [enable SSE])], - [], [with_sse=yes]) -AS_IF([test "x$with_sse" != xno], - [AC_DEFINE([HAVE_SSE], [1], [Define if you have SSE])], - []) - -# Use valgrind to check memory allocation with mmap -AC_ARG_ENABLE([valgrind], - [AS_HELP_STRING([--enable-valgrind], [Instrument mmap memory allocation with valgrind])]) -AS_IF([test "x$enable_valgrind" = xyes], - [AC_DEFINE([HAVE_VALGRIND], [1], [Define is using Valgrind])] - [PKG_CHECK_MODULES([VALGRIND], [valgrind >= 1.8.0])]) - -# Check that type __int128 is supported and if the -# std::numeric_limits<__int128> specialization exists -AC_ARG_WITH([int128], - [AS_HELP_STRING([--with-int128], [enable int128])], - [], [with_int128=yes]) -AS_IF([test "x$with_int128" != xno], - [AC_CHECK_TYPE([__int128], - [AC_DEFINE([HAVE_INT128], [1], [Define if type __int128 is supported])]) - AC_MSG_CHECKING([for std::numeric_limits<__int128>]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - template struct StaticAssert; template<> struct StaticAssert { static void assert() { } };]], - [[StaticAssert::is_specialized>::assert();]])], - [AC_MSG_RESULT([yes])] - [AC_DEFINE([HAVE_NUMERIC_LIMITS128], [1], [Define if numeric limits specialization exists for __int128])], - [AC_MSG_RESULT([no])])]) - -# On MacOS X, use _NSGetExecutablePath to find path to own executable -AC_MSG_CHECKING([for _NSGetExecutablePath]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[_NSGetExecutablePath(0, 0);]])], - [AC_MSG_RESULT([yes])] - [AC_DEFINE([HAVE_NSGETEXECUTABLEPATH], [1], [Used to find executable path on MacOS X])], - [AC_MSG_RESULT([no])]) - -# Check the version of strerror_r -AC_CHECK_HEADERS_ONCE([execinfo.h ext/stdio_filebuf.h]) -AC_CHECK_MEMBER([siginfo_t.si_int], - [AC_DEFINE([HAVE_SI_INT], [1], [Define if siginfo_t.si_int exists])], - [], [[#include ]]) - -# --enable-all-static -# Do not use libtool if building all static -AC_ARG_ENABLE([all-static], - [AC_HELP_STRING([--enable-all-static], [create statically linked executable])]) -STATIC_FLAGS= -AS_IF([test x$enable_all_static = xyes], - [AC_SUBST([STATIC_FLAGS], [-all-static])]) - -# -# SWIG and bindings -# -maybe_swig= -# --enable-python-binding -AC_ARG_ENABLE([python-binding], - [AC_HELP_STRING([--enable-python-binding@<:@=PATH@:>@], [create SWIG python module and install in PATH])]) -# --enable-ruby-binding -AC_ARG_ENABLE([ruby-binding], - [AC_HELP_STRING([--enable-ruby-binding@<:@=PATH@:>@], [create SWIG ruby module and install in PATH])]) -# --enable-perl-binding -AC_ARG_ENABLE([perl-binding], - [AC_HELP_STRING([--enable-perl-binding@<:@=PATH@:>@], [create SWIG perl module and install in PATH])]) - -# --enable-swig -AC_ARG_ENABLE([swig], - [AC_HELP_STRING([--enable-swig], [enable development of swig binding])]) -AS_IF([test x$enable_swig = xyes], - [AX_PKG_SWIG([3.0.0], [], [AC_MSG_ERROR([SWIG version 3 is required])])]) -AS_IF([test -n "$SWIG"], - [SWIG_ENABLE_CXX]) -AM_CONDITIONAL([HAVE_SWIG], [test -n "$SWIG"]) - -# Python binding setup -AM_CONDITIONAL(PYTHON_BINDING, [test -n "$enable_python_binding" -a x$enable_python_binding != xno]) -AM_COND_IF([PYTHON_BINDING], - [AS_IF([test x$enable_python_binding != xyes], [PYTHON_SITE_PKG=$enable_python_binding])] - [AX_PYTHON_DEVEL([], [$prefix])]) - -# Ruby binding setup -AM_CONDITIONAL([RUBY_BINDING], [test -n "$enable_ruby_binding" -a x$enable_ruby_binding != xno]) -AM_COND_IF([RUBY_BINDING], - [AS_IF([test x$enable_ruby_binding != xyes], [RUBY_EXT_LIB=$enable_ruby_binding])] - [AX_RUBY_EXT([$prefix])]) - -# Perl binding setup -AM_CONDITIONAL([PERL_BINDING], [test -n "$enable_perl_binding" -a x$enable_perl_binding != xno]) -AM_COND_IF([PERL_BINDING], - [AS_IF([test x$enable_perl_binding != xyes], [PERL_EXT_LIB=$enable_perl_binding])] - [AX_PERL_EXT([$prefix])]) - -AC_OUTPUT - - diff --git a/src/modifiedJellyfish/depcomp b/src/modifiedJellyfish/depcomp deleted file mode 100755 index 4ebd5b3a..00000000 --- a/src/modifiedJellyfish/depcomp +++ /dev/null @@ -1,791 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2013-05-30.07; # UTC - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. - -# 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 2, 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 . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by 'PROGRAMS ARGS'. - object Object file output by 'PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputting dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -# Get the directory component of the given path, and save it in the -# global variables '$dir'. Note that this directory component will -# be either empty or ending with a '/' character. This is deliberate. -set_dir_from () -{ - case $1 in - */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; - *) dir=;; - esac -} - -# Get the suffix-stripped basename of the given path, and save it the -# global variable '$base'. -set_base_from () -{ - base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` -} - -# If no dependency file was actually created by the compiler invocation, -# we still have to create a dummy depfile, to avoid errors with the -# Makefile "include basename.Plo" scheme. -make_dummy_depfile () -{ - echo "#dummy" > "$depfile" -} - -# Factor out some common post-processing of the generated depfile. -# Requires the auxiliary global variable '$tmpdepfile' to be set. -aix_post_process_depfile () -{ - # If the compiler actually managed to produce a dependency file, - # post-process it. - if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependency.h'. - # Do two passes, one to just change these to - # $object: dependency.h - # and one to simply output - # dependency.h: - # which is needed to avoid the deleted-header problem. - { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" - sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" - } > "$depfile" - rm -f "$tmpdepfile" - else - make_dummy_depfile - fi -} - -# A tabulation character. -tab=' ' -# A newline character. -nl=' -' -# Character ranges might be problematic outside the C locale. -# These definitions help. -upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ -lower=abcdefghijklmnopqrstuvwxyz -digits=0123456789 -alpha=${upper}${lower} - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Avoid interferences from the environment. -gccflag= dashmflag= - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp -fi - -if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 -fi - -if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. - gccflag=-qmakedep=gcc,-MF - depmode=gcc -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. -## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. -## (see the conditional assignment to $gccflag above). -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). Also, it might not be -## supported by the other compilers which use the 'gcc' depmode. -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The second -e expression handles DOS-style file names with drive - # letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the "deleted header file" problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. -## Some versions of gcc put a space before the ':'. On the theory -## that the space means something, we add a space to the output as -## well. hp depmode also adds that space, but also prefixes the VPATH -## to the object. Take care to not repeat it in the output. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like '#:fec' to the end of the - # dependency line. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ - | tr "$nl" ' ' >> "$depfile" - echo >> "$depfile" - # The second pass generates a dummy entry for each header file. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" - ;; - -xlc) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts '$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - aix_post_process_depfile - ;; - -tcc) - # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 - # FIXME: That version still under development at the moment of writing. - # Make that this statement remains true also for stable, released - # versions. - # It will wrap lines (doesn't matter whether long or short) with a - # trailing '\', as in: - # - # foo.o : \ - # foo.c \ - # foo.h \ - # - # It will put a trailing '\' even on the last line, and will use leading - # spaces rather than leading tabs (at least since its commit 0394caf7 - # "Emit spaces for -MD"). - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. - # We have to change lines of the first kind to '$object: \'. - sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" - # And for each line of the second kind, we have to emit a 'dep.h:' - # dummy dependency, to avoid the deleted-header problem. - sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" - rm -f "$tmpdepfile" - ;; - -## The order of this option in the case statement is important, since the -## shell code in configure will try each of these formats in the order -## listed in this file. A plain '-MD' option would be understood by many -## compilers, so we must ensure this comes after the gcc and icc options. -pgcc) - # Portland's C compiler understands '-MD'. - # Will always output deps to 'file.d' where file is the root name of the - # source file under compilation, even if file resides in a subdirectory. - # The object file name does not affect the name of the '.d' file. - # pgcc 10.2 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\' : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - set_dir_from "$object" - # Use the source, not the object, to determine the base name, since - # that's sadly what pgcc will do too. - set_base_from "$source" - tmpdepfile=$base.d - - # For projects that build the same source file twice into different object - # files, the pgcc approach of using the *source* file root name can cause - # problems in parallel builds. Use a locking strategy to avoid stomping on - # the same $tmpdepfile. - lockdir=$base.d-lock - trap " - echo '$0: caught signal, cleaning up...' >&2 - rmdir '$lockdir' - exit 1 - " 1 2 13 15 - numtries=100 - i=$numtries - while test $i -gt 0; do - # mkdir is a portable test-and-set. - if mkdir "$lockdir" 2>/dev/null; then - # This process acquired the lock. - "$@" -MD - stat=$? - # Release the lock. - rmdir "$lockdir" - break - else - # If the lock is being held by a different process, wait - # until the winning process is done or we timeout. - while test -d "$lockdir" && test $i -gt 0; do - sleep 1 - i=`expr $i - 1` - done - fi - i=`expr $i - 1` - done - trap - 1 2 13 15 - if test $i -le 0; then - echo "$0: failed to acquire lock after $numtries attempts" >&2 - echo "$0: check lockdir '$lockdir'" >&2 - exit 1 - fi - - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" - # Add 'dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in 'foo.d' instead, so we check for that too. - # Subdirectories are respected. - set_dir_from "$object" - set_base_from "$object" - - if test "$libtool" = yes; then - # Libtool generates 2 separate objects for the 2 libraries. These - # two compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir$base.o.d # libtool 1.5 - tmpdepfile2=$dir.libs/$base.o.d # Likewise. - tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - # Same post-processing that is required for AIX mode. - aix_post_process_depfile - ;; - -msvc7) - if test "$libtool" = yes; then - showIncludes=-Wc,-showIncludes - else - showIncludes=-showIncludes - fi - "$@" $showIncludes > "$tmpdepfile" - stat=$? - grep -v '^Note: including file: ' "$tmpdepfile" - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The first sed program below extracts the file names and escapes - # backslashes for cygpath. The second sed program outputs the file - # name when reading, but also accumulates all include files in the - # hold buffer in order to output them again at the end. This only - # works with sed implementations that can handle large buffers. - sed < "$tmpdepfile" -n ' -/^Note: including file: *\(.*\)/ { - s//\1/ - s/\\/\\\\/g - p -}' | $cygpath_u | sort -u | sed -n ' -s/ /\\ /g -s/\(.*\)/'"$tab"'\1 \\/p -s/.\(.*\) \\/\1:/ -H -$ { - s/.*/'"$tab"'/ - G - p -}' >> "$depfile" - echo >> "$depfile" # make sure the fragment doesn't end with a backslash - rm -f "$tmpdepfile" - ;; - -msvc7msys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for ':' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. - "$@" $dashmflag | - sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this sed invocation - # correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no eat=no - for arg - do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - if test $eat = yes; then - eat=no - continue - fi - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix=`echo "$object" | sed 's/^.*\././'` - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - # makedepend may prepend the VPATH from the source file name to the object. - # No need to regex-escape $object, excess matching of '.' is harmless. - sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process the last invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed '1,2d' "$tmpdepfile" \ - | tr ' ' "$nl" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E \ - | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - | sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - IFS=" " - for arg - do - case "$arg" in - -o) - shift - ;; - $object) - shift - ;; - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" - echo "$tab" >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/src/modifiedJellyfish/doc/jellyfish.man b/src/modifiedJellyfish/doc/jellyfish.man deleted file mode 100644 index 04eb9f2d..00000000 --- a/src/modifiedJellyfish/doc/jellyfish.man +++ /dev/null @@ -1,647 +0,0 @@ -'\" t -.\" Manual page created with latex2man on Wed Feb 29 10:58:48 EST 2012 -.\" NOTE: This file is generated, DO NOT EDIT. -.de Vb -.ft CW -.nf -.. -.de Ve -.ft R - -.fi -.. -.TH "JELLYFISH" "1" "2010/10/1" "k\-mer counter " "k\-mer counter " -.SH NAME - -.PP -Jellyfish -is a software to count k\-mers in DNA sequences. -.PP -.SH SYNOPSIS - -jellyfish count -[\fB\-o\fP\fIprefix\fP] -[\fB\-m\fP\fImerlength\fP] -[\fB\-t\fP\fIthreads\fP] -[\fB\-s\fP\fIhashsize\fP] -[\fB--both\-strands\fP] -\fIfasta\fP -[\fIfasta \&... -\fP] -.br -jellyfish merge -\fIhash1\fP -\fIhash2\fP -\&... -.br -jellyfish dump -\fIhash\fP -.br -jellyfish stats -\fIhash\fP -.br -jellyfish histo -[\fB\-h\fP\fIhigh\fP] -[\fB\-l\fP\fIlow\fP] -[\fB\-i\fP\fIincrement\fP] -\fIhash\fP -.br -jellyfish query -\fIhash\fP -.br -jellyfish cite -.br -.PP -Plus equivalent version for Quake -mode: qhisto, -qdump -and qmerge\&. -.PP -.SH DESCRIPTION - -.PP -Jellyfish -is a k\-mer counter based on a multi\-threaded hash -table implementation. -.PP -.SS COUNTING AND MERGING -.PP -To count k\-mers, use a command like: -.PP -.Vb -jellyfish count \-m 22 \-o output \-c 3 \-s 10000000 \-t 32 input.fasta -.Ve -.PP -This will count the the 22\-mers in input.fasta with 32 threads. The -counter field in the hash uses only 3 bits and the hash has at least -10 million entries. -.PP -The output files will be named output_0, output_1, etc. (the prefix -is specified with the \fB\-o\fP -switch). If the hash is large enough -(has specified by the \fB\-s\fP -switch) to fit all the k\-mers, there -will be only one output file named output_0. If the hash filled up -before all the mers were read, the hash is dumped to disk, zeroed out -and reading in mers resumes. Multiple intermediary files will be -present on the disks, named output_0, output_1, etc. -.PP -To obtain correct results from the other sub\-commands (such as histo, -stats, etc.), the multiple output files, if any, need to be merged into one -with the merge command. For example with the following command: -.PP -.Vb -jellyfish merge \-o output.jf output\\_* -.Ve -.PP -Should you get many intermediary output files (say hundreds), the size -of the hash table is too small. Rerunning Jellyfish -with a -larger size (option \fB\-s\fP) -is probably faster than merging all the -intermediary files. -.PP -.SS ORIENTATION -When the orientation of the sequences in the input fasta file is not -known, e.g. in sequencing reads, using \fB--both\-strands\fP -(\fB\-C\fP) -makes the most sense. -.PP -For any k\-mer m, its canonical representation is m itself or its -reverse\-complement, whichever comes first lexicographically. With the -option \fB\-C\fP, -only the canonical representation of the mers are -stored in the hash and the count value is the number of occurrences of -both the mer and its reverse\-complement. -.PP -.SS CHOOSING THE HASH SIZE -.PP -To achieve the best performance, a minimum number of intermediary -files should be written to disk. So the parameter \fB\-s\fP -should be -chosen to fit as many k\-mers as possible (ideally all of them) while -still fitting in memory. -.PP -We consider to examples: counting mers in sequencing reads and in a -finished genome. -.PP -First, suppose we count k\-mers in short sequencing reads: -there are n reads and there is an average of 1 error per reads where -each error generates k unique mers. If the genome size is G, the -size of the hash (option \fB\-s\fP) -to fit all k\-mers at once is estimated to: $(G + -k*n)/0.8$. The division by 0.8 compensates for the maximum usage of -approximately $80%$ of the hash table. -.PP -On the other hand, when counting k\-mers in an assembled sequence of -length G, setting \fB\-s\fP -to G is appropriate. -.PP -As a matter of convenience, Jellyfish understands ISO suffixes for the -size of the hash. Hence \&'\-s 10M\&' stands 10 million entries while \&'\-s -50G\&' stands for 50 billion entries. -.PP -The actual memory usage of the hash table can be computed as -follow. The actual size of the hash will be rounded up to the next -power of 2: s=2^l\&. The parameter r is such that the maximum -reprobe value (\fB\-p\fP) -plus one is less than 2^r\&. Then the memory usage per -entry in the hash is (in bits, not bytes) 2k\-l+r+1\&. The total memory -usage of the hash table in bytes is: 2^l*(2k\-l+r+1)/8\&. -.PP -.SS CHOOSING THE COUNTING FIELD SIZE -To save space, the hash table supports variable length counter, i.e. a -k\-mer occurring only a few times will use a small counter, a k\-mer -occurring many times will used multiple entries in the hash. -.PP -Important: the size of the couting field does NOT change the result, -it only impacts the amount of memory used. In particular, there is no -maximum value in the hash. Even if the counting field uses 5 bits, a -k\-mer occuring 2 million times will have a value reported of 2 -million (i.e., it is not capped at 2^5). -.PP -The \fB\-c\fP -specify the length (in bits) of the counting field. The -trade off is as follows: a low value will save space per entry in the -hash but can potentially increase the number of entries used, hence -maybe requiring a larger hash. -.PP -In practice, use a value for \fB\-c\fP -so that most of you k\-mers -require only 1 entry. For example, to count k\-mers in a genome, -where most of the sequence is unique, use \fB\-c\fP\fI1\fP -or -\fB\-c\fP\fI2\fP\&. -For sequencing reads, use a value for \fB\-c\fP -large -enough to counts up to twice the coverage. For example, if the -coverage is 10X, choose a counter length of 5 (\fB\-c\fP\fI5\fP) -as $2^5 > 20$. -.PP -.SH SUBCOMMANDS AND OPTIONS - -.SS COUNT -Usage: jellyfish count [options] file:path+ -.PP -Count k\-mers or qmers in fasta or fastq files -.PP -Options (default value in (), *required): -.TP -\fB\-m\fP, -\fB--mer\-len\fP\fI=uint32\fP - *Length of mer -.TP -\fB\-s\fP, -\fB--size\fP\fI=uint64\fP - *Hash size -.TP -\fB\-t\fP, -\fB--threads\fP\fI=uint32\fP - Number of threads (1) -.TP -\fB\-o\fP, -\fB--output\fP\fI=string\fP - Output prefix (mer_counts) -.TP -\fB\-c\fP, -\fB--counter\-len\fP\fI=Length\fP - in bits Length of counting field (7) -.TP -\fB--out\-counter\-len\fP\fI=Length\fP - in bytes Length of counter field in output (4) -.TP -\fB\-C\fP,\fB--both\-strands\fP - Count both strand, canonical representation (false) -.TP -\fB\-p\fP, -\fB--reprobes\fP\fI=uint32\fP - Maximum number of reprobes (62) -.TP -\fB\-r\fP,\fB--raw\fP - Write raw database (false) -.TP -\fB\-q\fP,\fB--quake\fP - Quake compatibility mode (false) -.TP -\fB--quality\-start\fP\fI=uint32\fP - Starting ASCII for quality values (64) -.TP -\fB--min\-quality\fP\fI=uint32\fP - Minimum quality. A base with lesser quality becomes an N (0) -.TP -\fB\-L\fP, -\fB--lower\-count\fP\fI=uint64\fP - Don\&'t output k\-mer with count < lower\-count -.TP -\fB\-U\fP, -\fB--upper\-count\fP\fI=uint64\fP - Don\&'t output k\-mer with count > upper\-count -.TP -\fB--matrix\fP\fI=Matrix\fP - file Hash function binary matrix -.TP -\fB--timing\fP\fI=Timing\fP - file Print timing information -.TP -\fB--stats\fP\fI=Stats\fP - file Print stats -.TP -\fB--usage\fP - Usage -.TP -\fB\-h\fP,\fB--help\fP - This message -.TP -\fB--full\-help\fP - Detailed help -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SS STATS -Usage: jellyfish stats [options] db:path -.PP -Statistics -.PP -Display some statistics about the k\-mers in the hash: -.PP -Unique: Number of k\-mers which occur only once. -Distinct: Number of k\-mers, not counting multiplicity. -Total: Number of k\-mers, including multiplicity. -Max_count: Maximum number of occurrence of a k\-mer. -.PP -Options (default value in (), *required): -.TP -\fB\-L\fP, -\fB--lower\-count\fP\fI=uint64\fP - Don\&'t consider k\-mer with count < lower\-count -.TP -\fB\-U\fP, -\fB--upper\-count\fP\fI=uint64\fP - Don\&'t consider k\-mer with count > upper\-count -.TP -\fB\-v\fP,\fB--verbose\fP - Verbose (false) -.TP -\fB\-o\fP, -\fB--output\fP\fI=string\fP - Output file -.TP -\fB--usage\fP - Usage -.TP -\fB\-h\fP,\fB--help\fP - This message -.TP -\fB--full\-help\fP - Detailed help -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SS HISTO -Usage: jellyfish histo [options] db:path -.PP -Create an histogram of k\-mer occurrences -.PP -Create an histogram with the number of k\-mers having a given -count. In bucket \&'i\&' are tallied the k\-mers which have a count \&'c\&' -satisfying \&'low+i*inc <= c < low+(i+1)*inc\&'\&. Buckets in the output are -labeled by the low end point (low+i*inc). -.PP -The last bucket in the output behaves as a catchall: it tallies all -k\-mers with a count greater or equal to the low end point of this -bucket. -.PP -Options (default value in (), *required): -.TP -\fB\-l\fP, -\fB--low\fP\fI=uint64\fP - Low count value of histogram (1) -.TP -\fB\-h\fP, -\fB--high\fP\fI=uint64\fP - High count value of histogram (10000) -.TP -\fB\-i\fP, -\fB--increment\fP\fI=uint64\fP - Increment value for buckets (1) -.TP -\fB\-t\fP, -\fB--threads\fP\fI=uint32\fP - Number of threads (1) -.TP -\fB\-f\fP,\fB--full\fP - Full histo. Don\&'t skip count 0. (false) -.TP -\fB\-o\fP, -\fB--output\fP\fI=string\fP - Output file -.TP -\fB\-v\fP,\fB--verbose\fP - Output information (false) -.TP -\fB--usage\fP - Usage -.TP -\fB--help\fP - This message -.TP -\fB--full\-help\fP - Detailed help -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SS DUMP -Usage: jellyfish dump [options] db:path -.PP -Dump k\-mer counts -.PP -By default, dump in a fasta format where the header is the count and -the sequence is the sequence of the k\-mer. The column format is a 2 -column output: k\-mer count. -.PP -Options (default value in (), *required): -.TP -\fB\-c\fP,\fB--column\fP - Column format (false) -.TP -\fB\-t\fP,\fB--tab\fP - Tab separator (false) -.TP -\fB\-L\fP, -\fB--lower\-count\fP\fI=uint64\fP - Don\&'t output k\-mer with count < lower\-count -.TP -\fB\-U\fP, -\fB--upper\-count\fP\fI=uint64\fP - Don\&'t output k\-mer with count > upper\-count -.TP -\fB\-o\fP, -\fB--output\fP\fI=string\fP - Output file -.TP -\fB--usage\fP - Usage -.TP -\fB\-h\fP,\fB--help\fP - This message -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SS MERGE -Usage: jellyfish merge [options] input:string+ -.PP -Merge jellyfish databases -.PP -Options (default value in (), *required): -.TP -\fB\-s\fP, -\fB--buffer\-size\fP\fI=Buffer\fP - length Length in bytes of input buffer (10000000) -.TP -\fB\-o\fP, -\fB--output\fP\fI=string\fP - Output file (mer_counts_merged.jf) -.TP -\fB--out\-counter\-len\fP\fI=uint32\fP - Length (in bytes) of counting field in output (4) -.TP -\fB--out\-buffer\-size\fP\fI=uint64\fP - Size of output buffer per thread (10000000) -.TP -\fB\-v\fP,\fB--verbose\fP - Be verbose (false) -.TP -\fB--usage\fP - Usage -.TP -\fB\-h\fP,\fB--help\fP - This message -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SS QUERY -Usage: jellyfish query [options] db:path -.PP -Query from a compacted database -.PP -Query a hash. It reads k\-mers from the standard input and write the counts on the standard output. -.PP -Options (default value in (), *required): -.TP -\fB\-C\fP,\fB--both\-strands\fP - Both strands (false) -.TP -\fB\-c\fP,\fB--cary\-bit\fP - Value field as the cary bit information (false) -.TP -\fB\-i\fP, -\fB--input\fP\fI=file\fP - Input file -.TP -\fB\-o\fP, -\fB--output\fP\fI=file\fP - Output file -.TP -\fB--usage\fP - Usage -.TP -\fB\-h\fP,\fB--help\fP - This message -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SS QHISTO -Usage: jellyfish qhisto [options] db:string -.PP -Create an histogram of k\-mer occurences -.PP -Options (default value in (), *required): -.TP -\fB\-l\fP, -\fB--low\fP\fI=double\fP - Low count value of histogram (0.0) -.TP -\fB\-h\fP, -\fB--high\fP\fI=double\fP - High count value of histogram (10000.0) -.TP -\fB\-i\fP, -\fB--increment\fP\fI=double\fP - Increment value for buckets (1.0) -.TP -\fB\-f\fP,\fB--full\fP - Full histo. Don\&'t skip count 0. (false) -.TP -\fB--usage\fP - Usage -.TP -\fB--help\fP - This message -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SS QDUMP -Usage: jellyfish qdump [options] db:path -.PP -Dump k\-mer from a qmer database -.PP -By default, dump in a fasta format where the header is the count and -the sequence is the sequence of the k\-mer. The column format is a 2 -column output: k\-mer count. -.PP -Options (default value in (), *required): -.TP -\fB\-c\fP,\fB--column\fP - Column format (false) -.TP -\fB\-t\fP,\fB--tab\fP - Tab separator (false) -.TP -\fB\-L\fP, -\fB--lower\-count\fP\fI=double\fP - Don\&'t output k\-mer with count < lower\-count -.TP -\fB\-U\fP, -\fB--upper\-count\fP\fI=double\fP - Don\&'t output k\-mer with count > upper\-count -.TP -\fB\-v\fP,\fB--verbose\fP - Be verbose (false) -.TP -\fB\-o\fP, -\fB--output\fP\fI=string\fP - Output file -.TP -\fB--usage\fP - Usage -.TP -\fB\-h\fP,\fB--help\fP - This message -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SS QMERGE -Usage: jellyfish merge [options] db:string+ -.PP -Merge quake databases -.PP -Options (default value in (), *required): -.TP -\fB\-s\fP, -\fB--size\fP\fI=uint64\fP - *Merged hash table size -.TP -\fB\-m\fP, -\fB--mer\-len\fP\fI=uint32\fP - *Mer length -.TP -\fB\-o\fP, -\fB--output\fP\fI=string\fP - Output file (merged.jf) -.TP -\fB\-p\fP, -\fB--reprobes\fP\fI=uint32\fP - Maximum number of reprobes (62) -.TP -\fB--usage\fP - Usage -.TP -\fB\-h\fP,\fB--help\fP - This message -.TP -\fB--full\-help\fP - Detailed help -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SS CITE -Usage: jellyfish cite [options] -.PP -How to cite Jellyfish\&'s paper -.PP -Citation of paper -.PP -Options (default value in (), *required): -.TP -\fB\-b\fP,\fB--bibtex\fP - Bibtex format (false) -.TP -\fB\-o\fP, -\fB--output\fP\fI=string\fP - Output file -.TP -\fB--usage\fP - Usage -.TP -\fB\-h\fP,\fB--help\fP - This message -.TP -\fB\-V\fP,\fB--version\fP - Version -.PP -.SH VERSION - -.PP -Version: 1.1.4 of 2010/10/1 -.PP -.SH BUGS - -.PP -.TP -.B * -jellyfish merge has not been parallelized and is -relatively slow. -.TP -.B * -The hash table does not grow in memory automatically and -jellyfish merge -is not called automatically on the -intermediary files (if any). -.PP -.SH COPYRIGHT & LICENSE - -.TP -Copyright -(C)2010, Guillaume Marcais \fBguillaume@marcais.net\fP -and Carl Kingsford \fBcarlk@umiacs.umd.edu\fP\&. -.PP -.TP -License -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. -.br -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. -.br -You should have received a copy of the GNU General Public License -along with this program. If not, see -\fBhttp://www.gnu.org/licenses/\fP\&. -.PP -.SH AUTHORS - -Guillaume Marcais -.br -University of Maryland -.br -\fBgmarcais@umd.edu\fP -.PP -Carl Kingsford -.br -University of Maryland -.br -\fBcarlk@umiacs.umd.edu\fP -.PP -.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/src/modifiedJellyfish/doc/jellyfish.pdf b/src/modifiedJellyfish/doc/jellyfish.pdf deleted file mode 100644 index b433f775..00000000 Binary files a/src/modifiedJellyfish/doc/jellyfish.pdf and /dev/null differ diff --git a/src/modifiedJellyfish/include/jellyfish/allocators_mmap.hpp b/src/modifiedJellyfish/include/jellyfish/allocators_mmap.hpp deleted file mode 100644 index 041e9fd0..00000000 --- a/src/modifiedJellyfish/include/jellyfish/allocators_mmap.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_ALLOCATORS_MMAP_HPP__ -#define __JELLYFISH_ALLOCATORS_MMAP_HPP__ - -#include -#include -#include -#include -#include - -#include - -namespace allocators { -class mmap { - void *ptr_; - size_t size_; - -public: - mmap() : ptr_(MAP_FAILED), size_(0) {} - explicit mmap(size_t _size) : ptr_(MAP_FAILED), size_(0) { - realloc(_size); - } - mmap(mmap&& rhs) : ptr_(rhs.ptr_), size_(rhs.size_) { - rhs.ptr_ = MAP_FAILED; - rhs.size_ = 0; - } - ~mmap() { free(); } - - mmap& operator=(mmap&& rhs) { - swap(rhs); - return *this; - } - - void swap(mmap& rhs) { - std::swap(ptr_, rhs.ptr_); - std::swap(size_, rhs.size_); - } - - void *get_ptr() const { return ptr_ != MAP_FAILED ? ptr_ : NULL; } - size_t get_size() const { return size_; } - void free(); - void *realloc(size_t new_size); - int lock() { return mlock(ptr_, size_); } - int unlock() { return munlock(ptr_, size_); } - - // Return a a number of bytes which is a number of whole pages at - // least as large as size. - static size_t round_to_page(size_t _size); - -private: - static const int nb_threads = 4; - struct tinfo { - pthread_t thid; - char *start, *end; - size_t pgsize; - }; - void fast_zero(); - static void * _fast_zero(void *_info); -}; -inline void swap(mmap& a, mmap& b) { a.swap(b); } -} - -#endif diff --git a/src/modifiedJellyfish/include/jellyfish/atomic_bits_array.hpp b/src/modifiedJellyfish/include/jellyfish/atomic_bits_array.hpp deleted file mode 100644 index 9b271657..00000000 --- a/src/modifiedJellyfish/include/jellyfish/atomic_bits_array.hpp +++ /dev/null @@ -1,202 +0,0 @@ -/* Quorum - * Copyright (C) 2012 Genome group at University of Maryland. - * - * 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 . - */ - -#ifndef __JELLYFISH_ATOMIC_BITS_ARRAY_HPP__ -#define __JELLYFISH_ATOMIC_BITS_ARRAY_HPP__ - -#include -#include - -#include -#include -#include - -namespace jellyfish { -template -class atomic_bits_array_base { - static const int w_ = sizeof(T) * 8; - const int bits_; - const size_t size_; - const T mask_; - const jflib::divisor64 d_; - size_t size_bytes_; - T* data_; - static atomic::gcc atomic_; - - friend class iterator; - class iterator : public std::iterator { - friend class atomic_bits_array_base; - const atomic_bits_array_base& ary_; - T* word_; - T mask_; - int off_; - - iterator(const atomic_bits_array_base& a, T* w, T m, int o) : ary_(a), word_(w), mask_(m), off_(o) { } - public: - bool operator==(const iterator& rhs) const { return word_ == rhs.word_ && off_ == rhs.off_; } - bool operator!=(const iterator& rhs) const { return word_ != rhs.word_ || off_ != rhs.off_; } - Value operator*() const { return static_cast((*word_ & mask_) >> off_); } - Value* operator->() const { return 0; } - iterator& operator++() { - off_ += ary_.bits_; - if(off_ + ary_.bits_ < w_) { - mask_ <<= ary_.bits_; - } else { - ++word_; - mask_ = ary_.mask_; - off_ = 0; - } - return *this; - } - iterator operator++(int) { - iterator res(*this); - ++*this; - return res; - } - }; - - class element_proxy { - T* word_; - const T mask_; - const int off_; - T prev_word_; - - Value get_val(T v) const { - return static_cast((v & mask_) >> off_); - } - - public: - element_proxy(T* word, T mask, int off) : - word_(word), mask_(mask), off_(off) - { } - - operator Value() const { return get_val(*word_); } - Value get() { - prev_word_ = *word_; - return get_val(prev_word_); - } - - bool set(Value& nval) { - Value pval; - Value cval = get_val(prev_word_); - do { - pval = cval; - const T new_word = (prev_word_ & ~mask_) | ((static_cast(nval) << off_) & mask_); - const T actual_word = atomic_.cas(word_, prev_word_, new_word); - if(__builtin_expect(actual_word == prev_word_, 1)) - return true; - prev_word_ = actual_word; - cval = get_val(prev_word_); - } while(pval == cval); - nval = cval; - return false; - } - }; - -public: - atomic_bits_array_base(int bits, // Number of bits per entry - size_t size) : // Number of entries - bits_(bits), - size_(size), - mask_((T)-1 >> (w_ - bits)), // mask of one entry at the LSB of a word - d_(w_ / bits), // divisor of the number of entries per word - size_bytes_((size / d_ + (size % d_ != 0)) * sizeof(T)), - data_(static_cast(this)->alloc_data(size_bytes_)) - { - static_assert(sizeof(T) >= sizeof(Value), "Container type T must have at least as many bits as value type"); - if((size_t)bits > sizeof(Value) * 8) - throw std::runtime_error("The number of bits per entry must be less than the number of bits in the value type"); - if(!data_) - throw std::runtime_error("Can't allocate memory for atomic_bits_array"); - } - - // Return the element at position pos. No check for out of bounds. - element_proxy operator[](size_t pos) { - uint64_t q, r; - d_.division(pos, q, r); - const int off = r * bits_; - return element_proxy(data_ + q, mask_ << off, off); - } - const element_proxy operator[](size_t pos) const { - uint64_t q, r; - d_.division(pos, q, r); - const int off = r * bits_; - return element_proxy(data_ + q, mask_ << off, off); - } - void write(std::ostream& os) const { - os.write((const char*)data_, size_bytes_); - } - size_t size_bytes() const { return size_bytes_; } - int bits() const { return bits_; } - - iterator begin() const { return iterator(*this, data_, mask_, 0); } - iterator end() const { - uint64_t q, r; - d_.division(size_, q, r); - const int off = r * bits_; - return iterator(*this, data_ + q, mask_ << off, off); - } -}; - -template -class atomic_bits_array : - protected allocators::mmap, - public atomic_bits_array_base > -{ - typedef atomic_bits_array_base > super; - friend class atomic_bits_array_base >; -public: - atomic_bits_array(int bits, size_t size) : - allocators::mmap(), - super(bits, size) - { } - -protected: - T* alloc_data(size_t s) { - allocators::mmap::realloc(s); - return (T*)allocators::mmap::get_ptr(); - } -}; - -struct mem_info { - void* ptr_; - size_t bytes_; - mem_info(void* ptr, size_t bytes) : ptr_(ptr), bytes_(bytes) { } -}; -template -class atomic_bits_array_raw : - protected mem_info, - public atomic_bits_array_base > -{ - typedef atomic_bits_array_base > super; - friend class atomic_bits_array_base >; -public: - atomic_bits_array_raw(void* ptr, size_t bytes, int bits, size_t size) : - mem_info(ptr, bytes), - super(bits, size) - { } - -protected: - T* alloc_data(size_t s) { - assert(bytes_ == s); - return (T*)ptr_; - } -}; - -} // namespace jellyfish - -#endif /* __JELLYFISH_ATOMIC_BITS_ARRAY_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/atomic_field.hpp b/src/modifiedJellyfish/include/jellyfish/atomic_field.hpp deleted file mode 100644 index 5fcc2975..00000000 --- a/src/modifiedJellyfish/include/jellyfish/atomic_field.hpp +++ /dev/null @@ -1,157 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#ifndef __JELLYFISH_ATOMIC_FIELD_HPP__ -#define __JELLYFISH_ATOMIC_FIELD_HPP__ - -#include - -namespace jflib { - /* Define a_get, a_set and a_update - */ - template - T a_load(T *x) { return *(volatile T*)x; } - template - T a_store(T* lhs, const U& rhs) { - return (*(volatile T*)lhs = rhs); - } - template - T* a_load_ptr(T* x) { return a_load((T**)&x); } - template - T* a_store_ptr(T* x, const U& rhs) { return a_store((T**)&x, rhs); } - - /** Set value to f(value). - * @return f(value) - * - * The function f may be called more than once. Be careful about - * side effects (probably better if f has no side effects). - */ - template - T a_update(T* x, T (*f)(T)) { - T ov(a_load(x)); - T nv(f(ov)); - while(!cas(x, ov, nv, &ov)) { nv = f(ov); } - return nv; - } - template - T a_load(T &x) { return a_load(&x); } - template - T a_store(T &lhs, const U& rhs) { return a_store(&lhs, rhs); } - - /* POD with atomic operators. - */ - template - struct atomic_pod { - typedef T type; - T x; - }; - -#define AF_COMPOUND_ASSIGN(op) \ - template \ - T operator op ## = (atomic_pod &x, const U &rhs) { \ - T ov(a_load(&x.x)); \ - T nv(ov op rhs); \ - while(!cas(&x.x, ov, nv, &ov)) { nv = ov op rhs; } \ - return nv; \ - } - AF_COMPOUND_ASSIGN(+); - AF_COMPOUND_ASSIGN(-); - AF_COMPOUND_ASSIGN(*); - AF_COMPOUND_ASSIGN(/); - AF_COMPOUND_ASSIGN(%); - AF_COMPOUND_ASSIGN(>>); - AF_COMPOUND_ASSIGN(<<); - AF_COMPOUND_ASSIGN(&); - AF_COMPOUND_ASSIGN(|); - AF_COMPOUND_ASSIGN(^); - - /** Set value to f(value). - * @return f(value) - * - * The function f may be called more than once. Be careful about - * side effects (probably better if f has no side effects). - */ - template - T a_load(atomic_pod &x) { return a_load(&x.x); } - template - T a_store(atomic_pod &lhs, const U &rhs) { - return a_store(&lhs.x, rhs); - } - template - T a_update(atomic_pod &x, T (*f)(T)) { - return a_update(&x.x, f); - } - - /* Similar to an atomic_pod, but not a POD, because of its - constructor and other member functions. Easier to use. - */ - template - class atomic_field : public atomic_pod { - public: - typedef typename atomic_pod::type type; - explicit atomic_field() { } - explicit atomic_field(const T& v) { a_store(&this->x, v); } - atomic_field& operator=(const atomic_pod& rhs) { a_store(&this->x, rhs.x); return *this; } - atomic_field& operator=(const T& v) { a_store(&this->x, v); return *this; } - operator T() const { return a_load(&this->x); } - T update(T (*f)(T)) { return a_update(&this->x, f); } - }; - - template - T a_load(atomic_field &x) { return a_load((atomic_pod&)x); } - template - atomic_field& a_store(atomic_field& lhs, const U& rhs) { a_store((atomic_pod&)lhs, rhs); return lhs; } - template - T a_update(atomic_field& x, T (*f)(T)) { return a_update((atomic_pod&)x, f); } - - - /* Allows atomic operation on any (already allocated) data. - */ - template - class atomic_ref { - T *ptr; - public: - typedef T type; - explicit atomic_ref(T& x) : ptr(&x) { } - explicit atomic_ref(T* x) : ptr(x) { } - atomic_ref& operator=(const T& v) { a_store(ptr, v); return *this; } - operator T() const { assert(ptr != 0); return a_load(ptr); } - T* operator&() const { return ptr; } - }; - -#define AR_COMPOUND_ASSIGN(op) \ - template \ - T operator op ## = (atomic_ref &x, const U &rhs) { \ - T ov(x); \ - T nv(ov op rhs); \ - while(!cas(&x, ov, nv, &ov)) { nv = ov op rhs; } \ - return nv; \ - } - AR_COMPOUND_ASSIGN(+); - AR_COMPOUND_ASSIGN(-); - AR_COMPOUND_ASSIGN(*); - AR_COMPOUND_ASSIGN(/); - AR_COMPOUND_ASSIGN(%); - AR_COMPOUND_ASSIGN(>>); - AR_COMPOUND_ASSIGN(<<); - AR_COMPOUND_ASSIGN(&); - AR_COMPOUND_ASSIGN(|); - AR_COMPOUND_ASSIGN(^); -} - - -#endif /* __JELLYFISH_ATOMIC_FIELD_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/atomic_gcc.hpp b/src/modifiedJellyfish/include/jellyfish/atomic_gcc.hpp deleted file mode 100644 index f888dd58..00000000 --- a/src/modifiedJellyfish/include/jellyfish/atomic_gcc.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_ATOMIC_GCC_HPP__ -#define __JELLYFISH_ATOMIC_GCC_HPP__ - -namespace atomic -{ - class gcc - { - public: - template - static inline T cas(volatile T *ptr, T oval, T nval) { - return __sync_val_compare_and_swap(ptr, oval, nval); - } - - template - static inline T set(T *ptr, T nval) { - return __sync_lock_test_and_set(ptr, nval); - } - - template - static inline T add_fetch(volatile T *ptr, T x) { - T ncount = *ptr, count; - do { - count = ncount; - ncount = cas((T *)ptr, count, count + x); - } while(ncount != count); - return count + x; - } - - template - static inline T fetch_add(volatile T *ptr, T x) { - T ncount = *ptr, count; - do { - count = ncount; - ncount = cas((T *)ptr, count, (T)(count + x)); - } while(ncount != count); - return count; - } - - template - static inline T set_to_max(volatile T *ptr, T x) { - T count = *ptr; - while(x > count) { - T ncount = cas(ptr, count, x); - if(ncount == count) - return x; - count = ncount; - } - return count; - } - }; -} -#endif diff --git a/src/modifiedJellyfish/include/jellyfish/backtrace.hpp b/src/modifiedJellyfish/include/jellyfish/backtrace.hpp deleted file mode 100644 index a91faa0c..00000000 --- a/src/modifiedJellyfish/include/jellyfish/backtrace.hpp +++ /dev/null @@ -1,18 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -void print_backtrace(); -void show_backtrace(); diff --git a/src/modifiedJellyfish/include/jellyfish/binary_dumper.hpp b/src/modifiedJellyfish/include/jellyfish/binary_dumper.hpp deleted file mode 100644 index 09cb6109..00000000 --- a/src/modifiedJellyfish/include/jellyfish/binary_dumper.hpp +++ /dev/null @@ -1,224 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_BINARY_DUMPER_HPP__ -#define __JELLYFISH_BINARY_DUMPER_HPP__ - -#include -#include - -#include - -namespace jellyfish { -template -class binary_writer { - int val_len_; - Val max_val_; - int key_len_; // length of output key field in bytes - -public: - binary_writer(int val_len, // length of value field in bytes - int key_len) : // length of key field in bits - val_len_(val_len), - max_val_(((Val)1 << (8 * val_len)) - 1), - key_len_(key_len / 8 + (key_len % 8 != 0)) - { } - - int val_len() const { return val_len_; } - Val max_val() const { return max_val_; } - int key_len() const { return key_len_; } - - void write(std::ostream& out, const Key& key, const Val val) { - out.write((const char*)key.data(), key_len_); - Val v = std::min(max_val_, val); - out.write((const char*)&v, val_len_); - } -}; - -/// Dump a hash array in sorted binary format. The key/value pairs are -/// written in a sorted list according to the hash function order. The -/// k-mer and count are written in binary, byte aligned. -template -class binary_dumper : public sorted_dumper, storage_t> { - typedef sorted_dumper, storage_t> super; - binary_writer writer; - -public: - static const char* format; - - binary_dumper(int val_len, // length of value field in bytes - int key_len, // length of key field in bits - int nb_threads, const char* file_prefix, - file_header* header = 0) : - super(nb_threads, file_prefix, header), - writer(val_len, key_len) - { } - - virtual void _dump(storage_t* ary) { - if(super::header_) { - super::header_->update_from_ary(*ary); - super::header_->format(format); - super::header_->counter_len(writer.val_len()); - } - super::_dump(ary); - } - - void write_key_value_pair(std::ostream& out, typename super::heap_item item) { - writer.write(out, item->key_, item->val_); - } -}; -template -const char* jellyfish::binary_dumper::format = "binary/sorted"; - -/// Reader of the format written by binary_dumper. Behaves like an -/// iterator (has next() method which behaves similarly to the next() -/// method of the hash array). -/// The header should be of format binary/sorted, but no check is made. -template -class binary_reader { - std::istream& is_; - const int val_len_; - Key key_; - Val val_; - const RectangularBinaryMatrix m_; - const size_t size_mask_; - -public: - binary_reader(std::istream& is, // stream containing data (past any header) - file_header* header) : // header which contains counter_len, matrix, size and key_len - is_(is), val_len_(header->counter_len()), key_(header->key_len() / 2), - m_(header->matrix()), - size_mask_(header->size() - 1) - { } - - const Key& key() const { return key_; } - const Val& val() const { return val_; } - size_t pos() const { return m_.times(key_) & size_mask_; } - - bool next() { - key_.template read<1>(is_); - val_ = 0; - is_.read((char*)&val_, val_len_); - return is_.good(); - } -}; - -template -class binary_query_base { - const char* const data_; - const unsigned int val_len_; // In bytes - const unsigned int key_len_; // In bytes - const RectangularBinaryMatrix m_; - const size_t mask_; - const size_t record_len_; - const size_t last_id_; - Key first_key_, last_key_; - mutable Key mid_key_; - uint64_t first_pos_, last_pos_; - -public: - // key_len passed in bits - binary_query_base(const char* data, unsigned int key_len, unsigned int val_len, const RectangularBinaryMatrix& m, size_t mask, - size_t size) : - data_(data), - val_len_(val_len), - key_len_(key_len / 8 + (key_len % 8 != 0)), - m_(m), - mask_(mask), - record_len_(val_len + key_len_), - last_id_(size / record_len_), - first_key_(key_len / 2), - last_key_(key_len / 2), - mid_key_(key_len / 2) - { - if(size % record_len_ != 0) - throw std::length_error(err::msg() << "Size of database (" << size << ") must be a multiple of the length of a record (" - << record_len_ << ")"); - key_at(0, first_key_); - first_pos_ = key_pos(first_key_); - key_at(last_id_ - 1, last_key_); - last_pos_ = key_pos(last_key_); - } - - bool val_id(const Key& key, Val* res, uint64_t* id) const { - if(last_id_ == 0) return false; - uint64_t first = 0; - uint64_t last = last_id_; - uint64_t first_pos = first_pos_; - uint64_t last_pos = last_pos_; - const uint64_t pos = key_pos(key); - uint64_t cid = 0; - if(key == first_key_) goto found; - cid = last_id_ - 1; - if(key == last_key_) goto found; - if(pos < first_pos_ || pos > last_pos_) return false; - - // First a guided binary search - for(uint64_t diff = last - first; diff >= 8; diff = last - first) { - cid = first + lrint(diff * ((double)(pos - first_pos) / (double)(last_pos - first_pos))); - cid = std::max(first + 1, cid); - cid = std::min(cid, last - 1); - key_at(cid, mid_key_); - if(key == mid_key_) goto found; - uint64_t mid_pos = key_pos(mid_key_); - if(mid_pos > pos || (mid_pos == pos && mid_key_ > key)) { - last = cid; - last_pos = mid_pos; - } else { - first = cid; - first_pos = mid_pos; - } - } - - // Then a linear search (avoids matrix computation) - for(cid = first + 1; cid < last; ++cid) { - key_at(cid, mid_key_); - if(key == mid_key_) goto found; - } - return false; - - found: - val_at(cid, res); - *id = cid; - return true; - } - - Val operator[](const Key& key) const { - Val res; - uint64_t id; - if(!val_id(key, &res, &id)) - return 0; - return res; - } - - inline Val check(const Key& key) const { return (*this)[key]; } - -protected: - void key_at(size_t id, Key& key) const { - memcpy(key.data__(), data_ + id * record_len_, key_len_); - key.clean_msw(); - } - void val_at(size_t id, Val* val) const { - *val = 0; - memcpy(val, data_ + id * record_len_ + key_len_, val_len_); - } - uint64_t key_pos(const Key& key) const { - return m_.times(key) & mask_; - } -}; -} - -#endif /* __JELLYFISH_BINARY_DUMPER_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/bloom_common.hpp b/src/modifiedJellyfish/include/jellyfish/bloom_common.hpp deleted file mode 100644 index cc3804a4..00000000 --- a/src/modifiedJellyfish/include/jellyfish/bloom_common.hpp +++ /dev/null @@ -1,129 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_BLOOM_COMMON_HPP__ -#define __JELLYFISH_BLOOM_COMMON_HPP__ - -#include -#include -#include - -namespace jellyfish { -template -struct hash_pair { }; - -template > -class bloom_base { -protected: - struct prefetch_info { - size_t boff; - unsigned char* pos; - }; - - // The number of bits in the structure, previously known as m_, is - // know stored as d_.d() - const jflib::divisor64 d_; - const unsigned long k_; - unsigned char * const data_; - HashPair hash_fns_; - -public: - typedef Key key_type; - - bloom_base(size_t m, unsigned long k, unsigned char* ptr, const HashPair& fns = HashPair()) : - d_(m), k_(k), data_(ptr), hash_fns_(fns) - { } - - bloom_base(const bloom_base& rhs) = delete; - bloom_base(bloom_base&& rhs) : - d_(rhs.d_), k_(rhs.k_), data_(rhs.data_), hash_fns_(std::move(rhs.hash_fns_)) - { } - - - void write_bits(std::ostream& out) { - out.write((char*)data_, static_cast(this)->nb_bytes()); - } - - // Number of hash functions - unsigned long k() const { return k_; } - // Size of bit vector - size_t m() const { return d_.d(); } - const HashPair& hash_functions() const { return hash_fns_; } - - static const double LOG2; - static const double LOG2_SQ; - - static size_t opt_m(const double fp, const size_t n) { - return n * (size_t)lrint(-log(fp) / LOG2_SQ); - } - static unsigned long opt_k(const double fp) { - return lrint(-log(fp) / LOG2); - } - - // Insert key k. Returns previous value of k - unsigned int insert(const Key &k) { - uint64_t hashes[2]; - hash_fns_(k, hashes); - return static_cast(this)->insert__(hashes); - } - - unsigned int check(const Key &k) const { - uint64_t hashes[2]; - hash_fns_(k, hashes); - return static_cast(this)->check__(hashes); - } - - - - // Limited std::map interface compatibility - class element_proxy { - Derived& bc_; - const Key& k_; - - public: - element_proxy(Derived& bc, const Key& k) : bc_(bc), k_(k) { } - - unsigned int operator++() { - unsigned int res = bc_.insert(k_); - return res == 0 ? 1 : 2; - } - - unsigned int operator++(int) { return bc_.insert(k_); } - unsigned int operator*() const { return bc_.check(k_); } - operator unsigned int() const { return bc_.check(k_); } - }; - - class const_element_proxy { - const Derived& bc_; - const Key& k_; - - public: - const_element_proxy(const Derived& bc, const Key& k) : bc_(bc), k_(k) { } - - unsigned int operator*() const { return bc_.check(k_); } - operator unsigned int() const { return bc_.check(k_); } - }; - element_proxy operator[](const Key& k) { return element_proxy(*static_cast(this), k); } - const_element_proxy operator[](const Key& k) const { return const_element_proxy(*static_cast(this), k); } -}; -template -const double bloom_base::LOG2 = 0.6931471805599453; -template -const double bloom_base::LOG2_SQ = 0.4804530139182014; - -} - -#endif /* __JELLYFISH_BLOOM_COMMON_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/bloom_counter2.hpp b/src/modifiedJellyfish/include/jellyfish/bloom_counter2.hpp deleted file mode 100644 index 71a503a3..00000000 --- a/src/modifiedJellyfish/include/jellyfish/bloom_counter2.hpp +++ /dev/null @@ -1,221 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#ifndef __BLOOM_COUNTER2_HPP__ -#define __BLOOM_COUNTER2_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#ifdef HAVE_CONFIG_H -#include -#endif - -namespace jellyfish { -/* Bloom counter with 3 values: 0, 1 or 2. It is thread safe and lock free. - */ -template, typename atomic_t = ::atomic::gcc> -class bloom_counter2_base : public bloom_base, HashPair> { - typedef bloom_base, HashPair> super; - - atomic_t atomic_; - - -protected: - static size_t nb_bytes__(size_t l) { - return l / 5 + (l % 5 != 0); - } - -public: - bloom_counter2_base(size_t m, unsigned long k, unsigned char* ptr, const HashPair& fns = HashPair()) : - super(m, k, ptr, fns) - { } - bloom_counter2_base(bloom_counter2_base&& rhs) : - super(std::move(rhs)) - { } - size_t nb_bytes() const { - return nb_bytes__(super::d_.d()); - } - - // Insert key with given hashes - unsigned int insert__(const uint64_t* hashes) { - // Prefetch memory locations - static_assert(std::is_pod::value, "prefetch_info must be a POD"); - typename super::prefetch_info pinfo[super::k_]; - const size_t base = super::d_.remainder(hashes[0]); - const size_t inc = super::d_.remainder(hashes[1]); - for(unsigned long i = 0; i < super::k_; ++i) { - const size_t p = super::d_.remainder(base + i * inc); - const size_t off = p / 5; - pinfo[i].boff = p % 5; - pinfo[i].pos = super::data_ + off; - // prefetch_write_no(pinfo[i].pos); - __builtin_prefetch(pinfo[i].pos, 1, 0); - } - - // Insert element - unsigned char res = 2; - for(unsigned long i = 0; i < super::k_; ++i) { - size_t boff = pinfo[i].boff; - unsigned char v = jflib::a_load(pinfo[i].pos); - - while(true) { - unsigned char w = v; - switch(boff) { - case 0: break; - case 1: w /= 3; break; - case 2: w /= 9; break; - case 3: w /= 27; break; - case 4: w /= 81; break; - } - w = w % 3; - if(w == 2) break; - unsigned char nv = v; - - switch(boff) { - case 0: nv += 1; break; - case 1: nv += 3; break; - case 2: nv += 9; break; - case 3: nv += 27; break; - case 4: nv += 81; break; - } - unsigned char cv = atomic_.cas(pinfo[i].pos, v, nv); - if(cv == v) { - if(w < res) - res = w; - break; - } - v = cv; - } - } - return res; - } - - unsigned int check__(uint64_t *hashes) const { - // Prefetch memory locations - static_assert(std::is_pod::value, "prefetch_info must be a POD"); - typename super::prefetch_info pinfo[super::k_]; - const size_t base = super::d_.remainder(hashes[0]); - const size_t inc = super::d_.remainder(hashes[1]); - for(unsigned long i = 0; i < super::k_; ++i) { - const size_t p = super::d_.remainder(base + i * inc); - const size_t off = p / 5; - pinfo[i].boff = p % 5; - pinfo[i].pos = super::data_ + off; - // prefetch_read_no(pinfo[i].pos); - __builtin_prefetch(pinfo[i].pos, 0, 0); - } - - // Check element - unsigned char res = 2; - for(unsigned long i = 0; i < super::k_; ++i) { - size_t boff = pinfo[i].boff; - unsigned char w = jflib::a_load(pinfo[i].pos); - - switch(boff) { - case 0: break; - case 1: w /= 3; break; - case 2: w /= 9; break; - case 3: w /= 27; break; - case 4: w /= 81; break; - } - w = w % 3; - if(w < res) - res = w; - } - return res; - } -}; - -template, typename atomic_t = ::atomic::gcc, - typename mem_block_t = allocators::mmap> -class bloom_counter2: - protected mem_block_t, - public bloom_counter2_base -{ - typedef bloom_counter2_base super; - -public: - typedef typename super::key_type key_type; - - bloom_counter2(const double fp, const size_t n, const HashPair& fns = HashPair()) : - mem_block_t(super::nb_bytes__(super::opt_m(fp, n))), - super(super::opt_m(fp, n), super::opt_k(fp), (unsigned char*)mem_block_t::get_ptr(), fns) - { - if(!mem_block_t::get_ptr()) - throw std::runtime_error(err::msg() << "Failed to allocate " << super::nb_bytes__(super::opt_m(fp, n)) - << " bytes of memory for bloom_counter"); - } - - bloom_counter2(size_t m, unsigned long k, const HashPair& fns = HashPair()) : - mem_block_t(super::nb_bytes__(m)), - super(m, k, (unsigned char*)mem_block_t::get_ptr(), fns) - { - if(!mem_block_t::get_ptr()) - throw std::runtime_error(err::msg() << "Failed to allocate " << super::nb_bytes__(m) << " bytes of memory for bloom_counter"); - } - - bloom_counter2(size_t m, unsigned long k, std::istream& is, const HashPair& fns = HashPair()) : - mem_block_t(super::nb_bytes__(m)), - super(m, k, (unsigned char*)mem_block_t::get_ptr(), fns) - { - if(!mem_block_t::get_ptr()) - throw std::runtime_error(err::msg() << "Failed to allocate " << super::nb_bytes__(m) << " bytes of memory for bloom_counter"); - - is.read((char*)mem_block_t::get_ptr(), mem_block_t::get_size()); - } - - bloom_counter2(const bloom_counter2& rhs) = delete; - bloom_counter2(bloom_counter2&& rhs) : - mem_block_t(std::move(rhs)), - super(std::move(rhs)) - { } -}; - -template, typename atomic_t = ::atomic::gcc> -class bloom_counter2_file : - protected mapped_file, - public bloom_counter2_base -{ - typedef bloom_counter2_base super; -public: - typedef typename super::key_type key_type; - - bloom_counter2_file(size_t m, unsigned long k, const char* path, const HashPair& fns = HashPair(), off_t offset = 0) : - mapped_file(path), - super(m, k, (unsigned char*)mapped_file::base() + offset, fns) - { } - - bloom_counter2_file(const bloom_counter2_file& rhs) = delete; - bloom_counter2_file(bloom_counter2_file&& rhs) : - mapped_file(std::move(rhs)), - super(std::move(rhs)) - { } -}; - -} // namespace jellyfish { - -#endif // __BLOOM_COUNTER2_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/bloom_filter.hpp b/src/modifiedJellyfish/include/jellyfish/bloom_filter.hpp deleted file mode 100644 index b3c28656..00000000 --- a/src/modifiedJellyfish/include/jellyfish/bloom_filter.hpp +++ /dev/null @@ -1,165 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_BLOOM_FILTER_HPP__ -#define __JELLYFISH_BLOOM_FILTER_HPP__ - -#include -#include -#include - -namespace jellyfish { -template, typename atomic_t = ::atomic::gcc> -class bloom_filter_base : - public bloom_base, HashPair> -{ - typedef bloom_base, HashPair> super; - -protected: - static size_t nb_bytes__(size_t l) { - return l / 8 + (l % 8 != 0); - } - -public: - bloom_filter_base(size_t m, unsigned long k, unsigned char* ptr, const HashPair& fns = HashPair()) : - super(m, k, ptr, fns) - { } - - bloom_filter_base(bloom_filter_base&& rhs) : - super(std::move(rhs)) - { } - - size_t nb_bytes() const { - return nb_bytes__(super::d_.d()); - } - - // Insert key with given hashes - unsigned int insert__(const uint64_t *hashes) { - // Prefetch memory locations - // This static_assert make clang++ happy... - static_assert(std::is_pod::value, "prefetch_info must be a POD"); - - typename super::prefetch_info pinfo[super::k_]; - const size_t base = super::d_.remainder(hashes[0]); - const size_t inc = super::d_.remainder(hashes[1]); - for(unsigned long i = 0; i < super::k_; ++i) { - const size_t pos = super::d_.remainder(base + i * inc); - const size_t elt_i = pos / 8; - pinfo[i].boff = pos % 8; - pinfo[i].pos = super::data_ + elt_i; - __builtin_prefetch(pinfo[i].pos, 1, 0); - } - - // Check if element present - bool present = true; - for(unsigned long i = 0; i < super::k_; ++i) { - const char mask = (char)1 << pinfo[i].boff; - const char prev = __sync_fetch_and_or(pinfo[i].pos, mask); - present = present && (prev & mask); - } - - return present; - } - - // Compute hashes of key k - void hash(const Key &k, uint64_t *hashes) const { hash_fns_(k, hashes); } - - unsigned int check__(const uint64_t *hashes) const { - // Prefetch memory locations - static_assert(std::is_pod::value, "prefetch_info must be a POD"); - typename super::prefetch_info pinfo[super::k_]; - const size_t base = super::d_.remainder(hashes[0]); - const size_t inc = super::d_.remainder(hashes[1]); - for(unsigned long i = 0; i < super::k_; ++i) { - const size_t pos = super::d_.remainder(base + i * inc); - const size_t elt_i = pos / 8; - pinfo[i].boff = pos % 8; - pinfo[i].pos = super::data_ + elt_i; - __builtin_prefetch(pinfo[i].pos, 0, 0); - } - - for(unsigned long i = 0; i < super::k_; ++i) - if(!(jflib::a_load(pinfo[i].pos) & ((char)1 << pinfo[i].boff))) - return 0; - return 1; - } -}; - -template, typename atomic_t = ::atomic::gcc, - typename mem_block_t = allocators::mmap> -class bloom_filter : - protected mem_block_t, - public bloom_filter_base -{ - typedef bloom_filter_base super; -public: - bloom_filter(double fp, size_t n, const HashPair& fns = HashPair()) : - mem_block_t(super::nb_bytes__(super::opt_m(fp, n))), - super(super::opt_m(fp, n), super::opt_k(fp), (unsigned char*)mem_block_t::get_ptr(), fns) - { - if(!mem_block_t::get_ptr()) - throw std::runtime_error(err::msg() << "Failed to allocate " << super::nb_bytes__(super::opt_m(fp, n)) - << " bytes of memory for bloom_filter"); - } - - bloom_filter(size_t m, unsigned long k, const HashPair& fns = HashPair()) : - mem_block_t(super::nb_bytes__(m)), - super(m, k, (unsigned char*)mem_block_t::get_ptr(), fns) - { - if(!mem_block_t::get_ptr()) - throw std::runtime_error(err::msg() << "Failed to allocate " << super::nb_bytes__(m) << " bytes of memory for bloom_filter"); - } - - bloom_filter(size_t m, unsigned long k, std::istream& is, const HashPair& fns = HashPair()) : - mem_block_t(super::nb_bytes__(m)), - super(m, k, (unsigned char*)mem_block_t::get_ptr(), fns) - { - if(!mem_block_t::get_ptr()) - throw std::runtime_error(err::msg() << "Failed to allocate " << super::nb_bytes__(m) << " bytes of memory for bloom_filter"); - - is.read((char*)mem_block_t::get_ptr(), mem_block_t::get_size()); - } - - bloom_filter(bloom_filter&& rhs) : - mem_block_t(std::move(rhs)), - super(std::move(rhs)) - { } -}; - -template, typename atomic_t = ::atomic::gcc> -class bloom_filter_file : - protected mapped_file, - public bloom_filter_base -{ - typedef bloom_filter_base super; -public: - typedef typename super::key_type key_type; - - bloom_filter_file(size_t m, unsigned long k, const char* path, const HashPair& fns = HashPair(), off_t offset = 0) : - mapped_file(path), - super(m, k, (unsigned char*)mapped_file::base() + offset, fns) - { } - - bloom_filter_file(const bloom_filter_file& rhs) = delete; - bloom_filter_file(bloom_filter_file&& rhs) : - mapped_file(std::move(rhs)), - super(std::move(rhs)) - { } -}; - -} - -#endif /* __JELLYFISH_BLOOM_FILTER_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/circular_buffer.hpp b/src/modifiedJellyfish/include/jellyfish/circular_buffer.hpp deleted file mode 100644 index a1fcd3ca..00000000 --- a/src/modifiedJellyfish/include/jellyfish/circular_buffer.hpp +++ /dev/null @@ -1,200 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#ifndef __JELLYFISH_CIRCULAR_BUFFER_HPP__ -#define __JELLYFISH_CIRCULAR_BUFFER_HPP__ - -#include - -#include -#include -#include - -namespace jflib { - template - class basic_circular_buffer { - static const unsigned int m = std::numeric_limits::digits - n; - struct splitT { - T id:m; - T val:n; - }; - union elt { - T binary; - splitT split; - }; - // size_t _size; - divisor64 _size; - T *_buffer; - size_t _head; - size_t _tail; - bool _closed; - - public: - typedef T value_type; - static const T guard = g; - - basic_circular_buffer(size_t size) : - _size(size+1), _buffer(new T[_size.d()]), _head(0), _tail(0), _closed(false) - { - elt init; - init.split.id = 0; - init.split.val = guard; - for(size_t i = 0; i < _size.d(); ++i) - _buffer[i] = init.binary; - } - virtual ~basic_circular_buffer() { - if(_buffer) - delete [] _buffer; - } - - /** Enqueue an element. - * @return false if the FIFO is full. - */ - bool enqueue(const T &v); - /** Enqueue an element, optimization. No check is made that the - * FIFO is full. Undetermined behavior if an element is inserted - * in a full FIFO. - */ - void enqueue_no_check(const T &v); - /** Dequeue an element. - * @return 0 if the FIFO is empty. - */ - T dequeue(); - bool is_closed() const { return a_load(_closed); } - void close() { a_store(_closed, true); } - - /// Return capacity of circular buffer - size_t size() { return _size.d(); } - /// Return the number of element currently in circular buffer - size_t fill() { - size_t head, tail; - size_t nhead = a_load(_head); - do { - head = nhead; - tail = a_load(_tail); - } while(head != (nhead = a_load(_head))); - - return head >= tail ? head - tail : head + _size.d() - tail; - } - }; - - template - class circular_buffer : public basic_circular_buffer::digits, g> { - public: - circular_buffer(size_t size) : - basic_circular_buffer::digits, g>(size) { } - virtual ~circular_buffer() { } - - bool enqueue(const T &v) { - return basic_circular_buffer::digits, g>::enqueue((uint64_t)v); - } - T dequeue() { - return basic_circular_buffer::digits, g>::dequeue(); - } - }; -} - -template -bool jflib::basic_circular_buffer::enqueue(const T &v) { - bool done = false; - - size_t chead = a_load(_head); - while(!done) { - size_t ctail = a_load(_tail); - elt celt; - celt.binary = a_load(_buffer[chead % _size]); - size_t achead = a_load(_head); - if(achead != chead) { - chead = achead; - continue; - } - size_t nhead = chead + 1; - if(nhead % _size == ctail % _size) - return false; - if(celt.split.val == guard) { - // entry is empty - elt nelt; - nelt.split.id = celt.split.id + 1; - nelt.split.val = v; - done = cas(&_buffer[chead % _size], celt.binary, nelt.binary); - // done == true <=> sucessfully written entry - } - cas(&_head, chead, nhead, &chead); - } - - return true; -} - -template -void jflib::basic_circular_buffer::enqueue_no_check(const T &v) { - bool done = false; - - size_t chead = a_load(_head); - while(!done) { - elt celt; - celt.binary = a_load(_buffer[chead % _size]); - size_t achead = a_load(_head); - if(achead != chead) { - chead = achead; - continue; - } - size_t nhead = chead + 1; - if(celt.split.val == guard) { - // entry is empty - elt nelt; - nelt.split.id = celt.split.id + 1; - nelt.split.val = v; - done = cas(&_buffer[chead % _size], celt.binary, nelt.binary); - // done == true <=> sucessfully written entry - } - cas(&_head, chead, nhead, &chead); - } -} - -template -T jflib::basic_circular_buffer::dequeue() { - bool done = false; - elt res; - - size_t ctail = a_load(_tail); - while(!done) { - bool dequeued = false; - do { - if(ctail % _size == a_load(_head) % _size) - return guard; - size_t ntail = ctail + 1; - dequeued = cas(&_tail, ctail, ntail, &ctail); - } while(!dequeued); - - res.binary = a_load(_buffer[ctail % _size]); - elt nres; - nres.split.val = guard; - while(true) { - nres.split.id = res.split.id + 1; - if(res.split.val == guard) { - if(cas(&_buffer[ctail % _size], res.binary, nres.binary, &res.binary)) - break; - } else { - done = cas(&_buffer[ctail % _size], res.binary, nres.binary); - break; - } - } - } - - return res.split.val; -} -#endif /* __JELLYFISH_CIRCULAR_BUFFER_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/compare_and_swap.hpp b/src/modifiedJellyfish/include/jellyfish/compare_and_swap.hpp deleted file mode 100644 index 2defb973..00000000 --- a/src/modifiedJellyfish/include/jellyfish/compare_and_swap.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/* This file is part of Jflib. - - Jflib 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. - - Jflib 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 Jflib. If not, see . -*/ - - -#ifndef _JFLIB_COMPARE_AND_SWAP_H_ -#define _JFLIB_COMPARE_AND_SWAP_H_ - -#include -#include - -namespace jflib { - // // Atomic load (get) and store (set). For now assume that the - // // architecture does this based on the virtual key word (true for - // // x86_64). TODO: improve on other architectures. - // template - // T a_get(const T &x) { return *(volatile T*)&x; } - // template - // T &a_set(T &lhs, const U &rhs) { - // *(volatile T*)&lhs = rhs; - // return lhs; - // } - - // Numeric type of length rounded up to the size of a - // word. Undefined, and raise a compilation error, if the length is - // not a machine word size - template union word_t; - template union word_t { typedef uint8_t w_t; T v; w_t w; }; - template union word_t { typedef uint16_t w_t; T v; w_t w; }; - template union word_t { typedef uint32_t w_t; T v; w_t w; }; - template union word_t { typedef uint64_t w_t; T v; w_t w; }; - - /** Type safe version of CAS. - * @param [in] ptr Memory location. - * @param [in] ov Presumed value at location. - * @param [in] nv Value to write. - * @param [out] cv Value at location at time of call. - * @return true if CAS is successful. - * - * The CAS operation is successful if, at the time of call, ov is - * equal to *ptr, the value at the memory location. In that case, nv - * is written to *ptr, and when the call returns, cv == ov. - * - * If it fails, cv contains *ptr at the time of call. - */ - template - bool cas(T *ptr, const T &ov, const T &nv, T *cv) { - typedef word_t val_t; - val_t _cv, _ov, _nv; - _ov.v = ov; - _nv.v = nv; - _cv.w = __sync_val_compare_and_swap((typename val_t::w_t *)ptr, _ov.w, _nv.w); - *cv = _cv.v; - return _cv.w == _ov.w; - } - - /** Type safe version of CAS. Identical to 4 argument version, - * except does not return the previous value. - */ - template - bool cas(T *ptr, const T &ov, const T &nv) { - T cv; - return cas(ptr, ov, nv, &cv); - } -} - - -#endif /* _JFLIB_COMPARE_AND_SWAP_H_ */ diff --git a/src/modifiedJellyfish/include/jellyfish/cooperative_pool.hpp b/src/modifiedJellyfish/include/jellyfish/cooperative_pool.hpp deleted file mode 100644 index 788aea4d..00000000 --- a/src/modifiedJellyfish/include/jellyfish/cooperative_pool.hpp +++ /dev/null @@ -1,258 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#ifndef __JELLYFISH_COOPERATIVE_POOL_HPP__ -#define __JELLYFISH_COOPERATIVE_POOL_HPP__ - -#include -#include - -#include -#include -#include - -/// Cooperative pool. Provide a link between a producer and many -/// consumers. It is cooperative in the sense that there is no -/// dedicated thread to the producer. When the number of elements in -/// the queue from the producer to the consumer is less than half, -/// then the thread requesting an element attempts to become the -/// producer. It stays a producer until the producer to consumer queue -/// is full. -/// -/// This class must be subclassed using CRTP. `T` is the type of the -/// element passed around in the queues. The derived class must -/// implement the method `bool produce(T& e)`. It is called when a -/// thread has become a producer. It must set in `e` the new element, -/// unless there is nothing more to produce. It returns `true` if -/// there is nothing more to produce (and `e` is not used), `false` -/// otherwise. -/// -/// The following example will produce the integers `[0, 1000000]`: -/// -/// ~~~{.cc} -/// class sequence : public cooperative_bool { -/// int cur_; -/// public: -/// sequence() : cur_(0) { } -/// bool produce(int& e) { -/// if(cur_ <= 1000000) { -/// e = cur_++; -/// return false; -/// } -/// return true; -/// } -/// }; -/// ~~~ -/// -/// To access the elements (or the jobs) of the sequence, instantiate -/// a `sequence::job` object and check that it is not empty. If empty, -/// the sequence is over. -/// -/// ~~~{.cc} -/// sequence seq; // Sequence, instantiated in main thread -/// // In each consumer thread: -/// while(true) { -/// sequence::job j(seq); -/// if(j.is_empty()) -/// break; -/// // Do computation using *j and j-> -/// } -/// ~~~ - -namespace jellyfish { -template -class cooperative_pool { -public: - typedef jflib::circular_buffer cbT; - typedef T element_type; - -private: - uint32_t size_; - element_type* elts_; - cbT cons_prod_; // FIFO from Consumers to Producers - cbT prod_cons_; // FIFO from Producers to Consumers - int has_producer_; // Tell whether a thread is acting as a producer - - // RAII token. - class take_token { - int* const token_; - const bool has_token_; - public: - take_token(int* token) : token_(token), has_token_(jflib::cas(token_, 0, 1)) { } - ~take_token() { - if(has_token_) - // cas(token_, 1, 0); // Guaranteed to succeed. Memory barrier - jflib::a_store(token_, 0); - } - bool has_token() const { return has_token_; } - }; - - explicit cooperative_pool(const cooperative_pool& rhs) : size_(0), elts_(0), cons_prod_(0), prod_cons_(0), has_producer_(0) { } -public: - cooperative_pool(uint32_t size) : - size_(size), - elts_(new element_type[size_]), - cons_prod_(size_ + 100), - prod_cons_(size_ + 100), - has_producer_(0) - { - // Every element is empty and ready to be filled by the producer - for(size_t i = 0; i < size_; ++i) - cons_prod_.enqueue_no_check(i); - } - - ~cooperative_pool() { delete [] elts_; } - - uint32_t size() const { return size_; } - - element_type* element_begin() { return elts_; } - element_type* element_end() { return elts_ + size_; } - - // Contains a filled element or is empty. In which case the producer - // is done and we should stop processing. - class job { - cooperative_pool& cp_; - uint32_t i_; // Index of element - public: - job(cooperative_pool& cp) : cp_(cp), i_(cp_.get_element()) { } - ~job() { release(); } - - void release() { - if(!is_empty()) { - cp_.cons_prod_.enqueue_no_check(i_); - } - } - bool is_empty() const { return i_ == cbT::guard; } - void next() { - release(); - i_ = cp_.get_element(); - } - - element_type& operator*() { return cp_.elts_[i_]; } - element_type* operator->() { return &cp_.elts_[i_]; } - - private: - // Disable copy of job - job(const job& rhs) { } - job& operator=(const job& rhs) { } - }; - friend class job; - - /// STL compliant iterator - class iterator : public std::iterator { - job* j_; - public: - iterator() : j_(0) { } - iterator(cooperative_pool& cp) : j_(new job(cp)) { } - iterator(const iterator& rhs) : j_(rhs.j_) { } - - bool operator==(const iterator& rhs) const { return j_ == rhs.j_; } - bool operator!=(const iterator& rhs) const { return j_ != rhs.j_; } - element_type& operator*() { return j_->operator*(); } - element_type* operator->() { return j_->operator->(); } - - iterator& operator++() { - j_->next(); - if(j_->is_empty()) { - delete j_; - j_ = 0; - } - return *this; - } - - iterator operator++(int) { - iterator res(*this); - ++*this; - return res; - } - }; - iterator begin() { return iterator(*this); } - const iterator begin() const { return iterator(*this); } - const iterator end() const { return iterator(); } - -private: - enum PRODUCER_STATUS { PRODUCER_PRODUCED, PRODUCER_DONE, PRODUCER_EXISTS }; - uint32_t get_element() { - int iteration = 0; - - while(true) { - // If less than half full -> try to fill up producer to consumer - // queue. Disregard return value: in any every case will - // attempt to get an element for ourselves - if(prod_cons_.fill() < prod_cons_.size() / 2) - become_producer(); - - uint32_t i = prod_cons_.dequeue(); - if(i != cbT::guard) - return i; - - // Try to become producer - switch(become_producer()) { - case PRODUCER_PRODUCED: - iteration = 0; // Produced. Attempt anew to get an element - break; - case PRODUCER_DONE: - return prod_cons_.dequeue(); - case PRODUCER_EXISTS: - delay(iteration++); // Already a producer. Wait a bit it adds things to queue - break; - } - } - } - - PRODUCER_STATUS become_producer() { - if(prod_cons_.is_closed()) - return PRODUCER_DONE; - - // Mark that we have a produce (myself). If not, return. Token - // will be release automatically at end of method. - take_token producer_token(&has_producer_); - if(!producer_token.has_token()) - return PRODUCER_EXISTS; - - uint32_t i = cbT::guard; - try { - while(true) { // Only way out is if produce method is done (returns true or throw an exception) - i = cons_prod_.dequeue(); - if(i == cbT::guard) - return PRODUCER_PRODUCED; - - if(static_cast(this)->produce(elts_[i])) // produce returns true if done - break; - - prod_cons_.enqueue_no_check(i); - } - } catch(...) { } // Threw an exception -> same as being done - - // Producing is done - cons_prod_.enqueue_no_check(i); - prod_cons_.close(); - - return PRODUCER_DONE; - } - - // First 16 operations -> no delay. Then exponential back-off up to a second. - void delay(int iteration) { - if(iteration < 16) - return; - int shift = 10 - std::min(iteration - 16, 10); - usleep((1000000 - 1) >> shift); - } -}; - -} // namespace jellyfish { -#endif /* __JELLYFISH_COOPERATIVE_POOL_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/cooperative_pool2.hpp b/src/modifiedJellyfish/include/jellyfish/cooperative_pool2.hpp deleted file mode 100644 index 2872f63f..00000000 --- a/src/modifiedJellyfish/include/jellyfish/cooperative_pool2.hpp +++ /dev/null @@ -1,283 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#ifndef __JELLYFISH_COOPERATIVE_POOL2_HPP__ -#define __JELLYFISH_COOPERATIVE_POOL2_HPP__ - -#include -#include - -#include -#include -#include - -/// Cooperative pool. Provide a link between many producers and many -/// consumers. It is cooperative in the sense that there is no -/// dedicated threads as producer. When the number of elements in the -/// queue from the producer to the consumer is less than half, then -/// the thread requesting an element attempts to become an additional -/// producer. It stays a producer until the producer to consumer queue -/// is full. -/// -/// This class must be subclassed using CRTP. `T` is the type of the -/// element passed around in the queues. The derived class must -/// implement the method `bool produce(uint32_t i, T& e)`. It is -/// called when a thread has become a producer. It must set in `e` the -/// new element, unless there is nothing more to produce. It returns -/// `true` if there is nothing more to produce (and `e` is not used), -/// `false` otherwise. -/// -/// The maximum number of producers is specified to the constructor of -/// the class (`max_producers`). The parameter `i` passed to `produce` -/// is in [0, max_producers) and it is guaranteed that at any given -/// time, no two producers have the same `i`. -/// -/// The following example will produce the integers `[0, 1000 * max)`, -/// with max producers. -/// -/// ~~~{.cc} -/// class sequence : public cooperative_bool { -/// const uint32_t max_; -/// std::vector cur_; -/// uint32_t done_; -/// public: -/// sequence(uint32_t max) : max_(max), cur_(max, 0), done_(0) { } -/// bool produce(uint32_t i, int& e) { -/// int& cur = cur_[i]; -/// if(cur < max_) { -/// e = i * max_ + cur++; -/// return false; -/// } -/// return true; -/// } -/// }; -/// ~~~ -/// -/// To access the elements (or the jobs) of the sequence, instantiate -/// a `sequence::job` object and check that it is not empty. If empty, -/// the sequence is over. -/// -/// ~~~{.cc} -/// sequence seq; // Sequence, instantiated in main thread -/// // In each consumer thread: -/// while(true) { -/// sequence::job j(seq); -/// if(j.is_empty()) -/// break; -/// // Do computation using *j and j-> -/// } -/// ~~~ - -namespace jellyfish { -template -class cooperative_pool2 { -public: - typedef jflib::circular_buffer cbT; - typedef T element_type; - -private: - uint32_t size_; - element_type* elts_; - cbT cons_prod_; // FIFO from Consumers to Producers - cbT prod_cons_; // FIFO from Producers to Consumers - cbT tokens_; // FIFO with producer tokens - const uint32_t max_producers_; - uint32_t done_; // Number of producer that are done - - // RAII token. - struct take_token { - cbT& tokens_; - uint32_t token_; - bool drop_; - - take_token(cbT& tokens) : tokens_(tokens), token_(tokens.dequeue()), drop_(false) { } - ~take_token() { - if(has_token() && !drop_) { - tokens_.enqueue_no_check(token_); - // assert(tokens_.enqueue(token_)); - } - } - bool has_token() const { return token_ != cbT::guard; } - void drop() { drop_ = true; } - }; - - // explicit cooperative_pool2(const cooperative_pool2& rhs) : size_(0), elts_(0), cons_prod_(0), prod_cons_(0) { } -public: - cooperative_pool2(uint32_t max_producers, uint32_t size) : - size_(size), - elts_(new element_type[size_]), - cons_prod_(size_ + 100), - prod_cons_(size_ + 100), - tokens_(max_producers + 1), - max_producers_(max_producers), - done_(0) - { - // Every element is empty and ready to be filled by the producer - for(size_t i = 0; i < size_; ++i) - cons_prod_.enqueue_no_check(i); - - // Every producer token is free - for(uint32_t i = 0; i < max_producers_; ++i) - tokens_.enqueue(i); - // tokens_.enqueue_no_check(i); - } - - ~cooperative_pool2() { delete [] elts_; } - - uint32_t size() const { return size_; } - - element_type* element_begin() { return elts_; } - element_type* element_end() { return elts_ + size_; } - - // Contains a filled element or is empty. In which case the producer - // is done and we should stop processing. - class job { - cooperative_pool2& cp_; - uint32_t i_; // Index of element - public: - job(cooperative_pool2& cp) : cp_(cp), i_(cp_.get_element()) { } - ~job() { release(); } - - void release() { - if(!is_empty()) { - cp_.cons_prod_.enqueue_no_check(i_); - } - } - bool is_empty() const { return i_ == cbT::guard; } - void next() { - release(); - i_ = cp_.get_element(); - } - - element_type& operator*() { return cp_.elts_[i_]; } - element_type* operator->() { return &cp_.elts_[i_]; } - - private: - // Disable copy of job - job(const job& rhs) { } - job& operator=(const job& rhs) { } - }; - friend class job; - - /// STL compliant iterator - class iterator : public std::iterator { - job* j_; - public: - iterator() : j_(0) { } - iterator(cooperative_pool2& cp) : j_(new job(cp)) { } - iterator(const iterator& rhs) : j_(rhs.j_) { } - - bool operator==(const iterator& rhs) const { return j_ == rhs.j_; } - bool operator!=(const iterator& rhs) const { return j_ != rhs.j_; } - element_type& operator*() { return j_->operator*(); } - element_type* operator->() { return j_->operator->(); } - - iterator& operator++() { - j_->next(); - if(j_->is_empty()) { - delete j_; - j_ = 0; - } - return *this; - } - - iterator operator++(int) { - iterator res(*this); - ++*this; - return res; - } - }; - iterator begin() { return iterator(*this); } - const iterator begin() const { return iterator(*this); } - const iterator end() const { return iterator(); } - -private: - enum PRODUCER_STATUS { PRODUCER_PRODUCED, PRODUCER_DONE, PRODUCER_EXISTS }; - uint32_t get_element() { - int iteration = 0; - - while(true) { - // If less than half full -> try to fill up producer to consumer - // queue. Disregard return value: in any every case will - // attempt to get an element for ourselves - if(prod_cons_.fill() < prod_cons_.size() / 2) - become_producer(); - - uint32_t i = prod_cons_.dequeue(); - if(i != cbT::guard) - return i; - - // Try to become producer - switch(become_producer()) { - case PRODUCER_PRODUCED: - iteration = 0; // Produced. Attempt anew to get an element - break; - case PRODUCER_DONE: - return prod_cons_.dequeue(); - case PRODUCER_EXISTS: - delay(iteration++); // Already a producer. Wait a bit it adds things to queue - break; - } - } - } - - PRODUCER_STATUS become_producer() { - if(prod_cons_.is_closed()) - return PRODUCER_DONE; - - // Mark that we have a produce (myself). If not, return. Token - // will be release automatically at end of method. - take_token producer_token(tokens_); - if(!producer_token.has_token()) - return PRODUCER_EXISTS; - - uint32_t i = cbT::guard; - try { - while(true) { // Only way out is if produce method is done (returns true or throw an exception) - i = cons_prod_.dequeue(); - if(i == cbT::guard) - return PRODUCER_PRODUCED; - - if(static_cast(this)->produce(producer_token.token_, elts_[i])) // produce returns true if done - break; - - prod_cons_.enqueue_no_check(i); - } - } catch(...) { } // Threw an exception -> same as being done - - // Producing is done for this producer - cons_prod_.enqueue_no_check(i); - producer_token.drop(); - uint32_t is_done = __sync_add_and_fetch(&done_, (uint32_t)1); - if(is_done < max_producers_) - return PRODUCER_PRODUCED; - - prod_cons_.close(); - return PRODUCER_DONE; - } - - // First 16 operations -> no delay. Then exponential back-off up to a second. - void delay(int iteration) { - if(iteration < 16) - return; - int shift = 10 - std::min(iteration - 16, 10); - usleep((1000000 - 1) >> shift); - } -}; - -} // namespace jellyfish { -#endif /* __JELLYFISH_COOPERATIVE_POOL2_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/cpp_array.hpp b/src/modifiedJellyfish/include/jellyfish/cpp_array.hpp deleted file mode 100644 index 952827aa..00000000 --- a/src/modifiedJellyfish/include/jellyfish/cpp_array.hpp +++ /dev/null @@ -1,156 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_CPP_ARRAY_HPP_ -#define __JELLYFISH_CPP_ARRAY_HPP_ - -#include -#include - -namespace jellyfish { - -/// Fix length array of type T. An element is initialized with the init method. -/// new (this->data() + i) T( -template -class cpp_array { -protected: - std::pair data_; - std::pair init_; - size_t size_; - -public: - cpp_array(size_t size) : - data_(std::get_temporary_buffer(size)), - init_(std::get_temporary_buffer(size)), - size_(size) { - if(data_.first == 0 || init_.first == 0) { - std::return_temporary_buffer(data_.first); - std::return_temporary_buffer(init_.first); - throw std::bad_alloc(); - } - memset(init_.first, '\0', sizeof(bool) * size_); - } - - ~cpp_array() { - clear(); - std::return_temporary_buffer(data_.first); - std::return_temporary_buffer(init_.first); - } - - /// Initialize element i with 0 argument - void init(size_t i) { - release(i); - new (data_.first + i) T(); - init_.first[i] = true; - } - - /// Initialize element i with 1 argument - template - void init(size_t i, A1& a1) { - release(i); - new (data_.first + i) T(a1); - init_.first[i] = true; - } - template - void init(size_t i, A1* a1) { - release(i); - new (data_.first + i) T(a1); - init_.first[i] = true; - } - /// Initialize element i with 2 arguments - template - void init(size_t i, A1& a1, A2& a2) { - release(i); - new (data_.first + i) T(a1, a2); - init_.first[i] = true; - } - template - void init(size_t i, A1* a1, A2& a2) { - release(i); - new (data_.first + i) T(a1, a2); - init_.first[i] = true; - } - template - void init(size_t i, A1& a1, A2* a2) { - release(i); - new (data_.first + i) T(a1, a2); - init_.first[i] = true; - } - template - void init(size_t i, A1* a1, A2* a2) { - release(i); - new (data_.first + i) T(a1, a2); - init_.first[i] = true; - } - - /// Initialize element i with 3 arguments - template - void init(size_t i, A1 a1, A2 a2, A3 a3) { - release(i); - new (data_.first + i) T(a1, a2, a3); - init_.first[i] = true; - } - /// Initialize element i with 4 arguments - template - void init(size_t i, A1 a1, A2 a2, A3 a3, A4 a4) { - release(i); - new (data_.first + i) T(a1, a2, a3, a4); - init_.first[i] = true; - } - /// Initialize element i with 5 arguments - template - void init(size_t i, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - release(i); - new (data_.first + i) T(a1, a2, a3, a4, a5); - init_.first[i] = true; - } - - void release(size_t i) { - if(init_.first[i]) { - data_.first[i].~T(); - init_.first[i] = false; - } - } - - size_t size() const { return size_; } - bool empty() const { return size_ == 0; } - T& operator[](size_t i) { return data_.first[i]; } - const T& operator[](size_t i) const { return data_.first[i]; } - bool initialized(size_t i) const { return init_.first[i]; } - - T* begin() { return data_.first; } - T* end() { return data_.first + size_; } - const T* begin() const { return data_.first; } - const T* end() const { return data_.end + size_; } - const T* cbegin() const { return data_.first; } - const T* cend() const { return data_.end + size_; } - - T* data() { return data_.first; } - const T* data() const { return data_.first; } - - T& front() { return data_.first[0]; } - T& back() { return data_.first[size_ - 1]; } - const T& front() const { return data_.first[0]; } - const T& back() const { return data_.first[size_ - 1]; } - - void clear() { - for(size_t i = 0; i < size_; ++i) - release(i); - } -}; -} // namespace jellyfish - -#endif /* __JELLYFISH_CPP_ARRAY_HPP_ */ diff --git a/src/modifiedJellyfish/include/jellyfish/divisor.hpp b/src/modifiedJellyfish/include/jellyfish/divisor.hpp deleted file mode 100644 index 6c47b312..00000000 --- a/src/modifiedJellyfish/include/jellyfish/divisor.hpp +++ /dev/null @@ -1,150 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - - -#ifndef __JELLYFISH_DIVISOR_HPP__ -#define __JELLYFISH_DIVISOR_HPP__ - -#include -#ifdef HAVE_CONFIG_H -#include -#endif - -namespace jflib { -class divisor64 { - const uint64_t d_; -#ifdef HAVE_INT128 - const uint16_t p_; - const unsigned __int128 m_; -#endif - template - static T div_ceil(T x, T y) { - T q = x / y; - T r = x % y; - return q + (r > 0); - } - - template - static uint16_t ceilLog2(T x, uint16_t r = 0, uint16_t i = 0) { - if(x > 1) - return ceilLog2(x >> 1, r + 1, i | (x & 1)); - return r + i; - } - -public: - explicit divisor64(uint64_t d) : - d_(d) -#ifdef HAVE_INT128 - , p_(ceilLog2(d_)), - m_((div_ceil((unsigned __int128)1 << (64 + p_), (unsigned __int128)d_)) & (uint64_t)-1) -#endif - { } - - divisor64() : - d_(0) -#ifdef HAVE_INT128 - , p_(0), m_(0) -#endif - { } - - explicit divisor64(const divisor64& rhs) : - d_(rhs.d_) -#ifdef HAVE_INT128 - , p_(rhs.p_), - m_(rhs.m_) -#endif - { } - - inline uint64_t divide(const uint64_t n) const { -#ifdef HAVE_INT128 - switch(m_) { - case 0: - return n >> p_; - default: - const unsigned __int128 n_ = (unsigned __int128)n; - return (n_ + ((n_ * m_) >> 64)) >> p_; - } -#else - return n / d_; -#endif - } - - inline uint64_t remainder(uint64_t n) const { -#ifdef HAVE_INT128 - switch(m_) { - case 0: - return n & (((uint64_t)1 << p_) - 1); - default: - return n - divide(n) * d_; - } -#else - return n % d_; -#endif - } - - // Euclidian division: d.division(n, q, r) sets q <- n / d and r - // <- n % d. This is faster than doing each independently. - inline void division(uint64_t n, uint64_t &q, uint64_t &r) const { -#ifdef HAVE_INT128 - switch(m_) { - case 0: - q = n >> p_; - r = n & (((uint64_t)1 << p_) - 1); - break; - default: - q = divide(n); - r = n - q * d_; - break; - } -#else - q = n / d_; - r = n % d_; -#endif - } - - uint64_t d() const { return d_; } - uint64_t p() const { -#ifdef HAVE_INT128 - return p_; -#else - return 0; -#endif - } - uint64_t m() const { -#ifdef HAVE_INT128 - return m_; -#else - return 0; -#endif - } -}; - -inline uint64_t operator/(uint64_t n, const divisor64& d) { - return d.divide(n); -} -inline uint64_t operator%(uint64_t n, const divisor64& d) { - return d.remainder(n); -} - -inline std::ostream& operator<<(std::ostream& os, const divisor64& d) { - return os << "d:" << d.d() << ",p:" << d.p() << ",m:" << d.m(); -} - -} // namespace jflib - -#endif /* __JELLYFISH_DIVISOR_HPP__ */ - diff --git a/src/modifiedJellyfish/include/jellyfish/dumper.hpp b/src/modifiedJellyfish/include/jellyfish/dumper.hpp deleted file mode 100644 index f12d604b..00000000 --- a/src/modifiedJellyfish/include/jellyfish/dumper.hpp +++ /dev/null @@ -1,103 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_DUMPER_HPP__ -#define __JELLYFISH_DUMPER_HPP__ - -#include -#include -#include -#include -#include -#include -#include - -/** - * A dumper is responsible to dump the hash array to permanent storage - * and zero out the array. - **/ -namespace jellyfish { -template -class dumper_t { - Time writing_time_; - int index_; - bool one_file_; - std::vector file_names_; - -protected: - uint64_t min_; - uint64_t max_; - -public: - define_error_class(ErrorWriting); - -protected: - /// Open the next file with given prefix. If one_file is false, - /// append _0, _1, etc. to the prefix for actual file name. If - /// one_file is true, the prefix is the file name. The first time - /// the file is open in trunc mode, the subsequent times in append - /// mode. - void open_next_file(const char *prefix, std::ofstream &out) { - std::ostringstream name; - name << prefix; - std::ios::openmode mode = std::ios::out; - if(one_file_) { - mode |= (index_++ ? std::ios::ate : std::ios::trunc); - } else { - name << index_++; - mode |= std::ios::trunc; - } - file_names_.push_back(name.str()); - - out.open(name.str().c_str()); - if(out.fail()) - throw ErrorWriting(err::msg() << "'" << name.str() << "': " - << "Can't open file for writing" << err::no); - } - -public: - dumper_t() : writing_time_(::Time::zero), index_(0), one_file_(false), - min_(0), max_(std::numeric_limits::max()) - {} - - void dump(storage_t* ary) { - Time start; - _dump(ary); - Time end; - writing_time_ += end - start; - } - - bool one_file() const { return one_file_; } - void one_file(bool v) { one_file_ = v; } - - virtual void _dump(storage_t* ary) = 0; - uint64_t min() const { return min_; } - void min(uint64_t m) { min_ = m; } - uint64_t max() const { return max_; } - void max(uint64_t m) { max_ = m; } - Time get_writing_time() const { return writing_time_; } - int nb_files() const { return index_; } - std::vector file_names() { return file_names_; } - std::vector file_names_cstr() { - std::vector res; - for(size_t i = 0; i < file_names_.size(); ++i) - res.push_back(file_names_[i].c_str()); - return res; - } - virtual ~dumper_t() {}; -}; -} -#endif // __DUMPER_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/err.hpp b/src/modifiedJellyfish/include/jellyfish/err.hpp deleted file mode 100644 index d30c026c..00000000 --- a/src/modifiedJellyfish/include/jellyfish/err.hpp +++ /dev/null @@ -1,99 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_ERR_HPP__ -#define __JELLYFISH_ERR_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace jellyfish { -namespace err { -struct msg { - std::ostringstream msg_; - - msg() { } - explicit msg(const std::exception& e) { *this << e; } - template - explicit msg(const T& x) { *this << x; } - - operator std::string() const { return msg_.str(); } - - template - msg& operator<<(const T& x) { - msg_ << x; - return *this; - } - - msg& operator<<(const std::exception& e) { - msg_ << e.what(); - // try { - // std::rethrow_if_nested(e); - // } catch (const std::exception& nested) { - // msg_ << '\n'; - // return *this << nested; - // } - return *this; - } - - msg& operator<<(msg& (*pf)(msg&)) { return pf(*this); } - -}; - -// Select the correct version (GNU or XSI) version of -// ::strerror_r. err::strerror_ behaves like the GNU version of strerror_r, -// regardless of which version is provided by the system. -inline const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "error"; -} -inline const char* strerror__(char* buf, char* res) { - return res; -} -inline const char* strerror_r(int err, char* buf, size_t buflen) { - return strerror__(buf, ::strerror_r(err, buf, buflen)); -} - -inline std::ostream& no(std::ostream& os) { - char buf[128]; - return os << strerror_r(errno, buf, sizeof(buf)); -} - -inline msg& no(msg& m) { - char buf[128]; - return m << strerror_r(errno, buf, sizeof(buf)); -} - -inline void die(int code, std::string msg) { - std::cerr << msg << '\n'; - exit(code); -} - -inline void die(std::string msg) { die(1, msg); } -} // namespace err -} // namespace jellyfish - -#define define_error_class(name) \ - class name : public std::runtime_error { \ - public: explicit name(const std::string &txt) : std::runtime_error(txt) {} \ - } - -#endif // __JELLYFISH_ERR_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/file_header.hpp b/src/modifiedJellyfish/include/jellyfish/file_header.hpp deleted file mode 100644 index c43f7361..00000000 --- a/src/modifiedJellyfish/include/jellyfish/file_header.hpp +++ /dev/null @@ -1,112 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_FILE_HEADER_HPP__ -#define __JELLYFISH_FILE_HEADER_HPP__ - -#include -#include -#include - -namespace jellyfish { -/// A header with jellyfish hash specific entries: size, matrix, etc. -class file_header : public generic_file_header { -public: - file_header() : generic_file_header(sizeof(uint64_t)) { } - file_header(std::istream& is) : generic_file_header(sizeof(uint64_t)) { - this->read(is); - } - - template - void update_from_ary(const storage& ary) { - this->size(ary.size()); - this->key_len(ary.key_len()); - this->val_len(ary.val_len()); - this->matrix(ary.matrix()); - this->max_reprobe(ary.max_reprobe()); - this->set_reprobes(ary.reprobes()); - } - - RectangularBinaryMatrix matrix(int i = 1) const { - std::string name("matrix"); - name += std::to_string((long long int)i); // Cast to make gcc4.4 happy! - const unsigned int r = root_[name]["r"].asUInt(); - const unsigned int c = root_[name]["c"].asUInt(); - std::vector raw(c, (uint64_t)0); - for(unsigned int i = 0; i < c; ++i) - raw[i] = root_[name]["columns"][i].asUInt64(); - return RectangularBinaryMatrix(raw.data(), r, c); - } - - void matrix(const RectangularBinaryMatrix& m, int i = 1) { - std::string name("matrix"); - name += std::to_string((long long int)i); - root_[name].clear(); - root_[name]["r"] = m.r(); - root_[name]["c"] = m.c(); - for(unsigned int i = 0; i < m.c(); ++i) { - Json::UInt64 x = m[i]; - root_[name]["columns"].append(x); - } - } - - size_t size() const { return root_["size"].asLargestUInt(); } - void size(size_t s) { root_["size"] = (Json::UInt64)s; } - - unsigned int key_len() const { return root_["key_len"].asUInt(); } - void key_len(unsigned int k) { root_["key_len"] = (Json::UInt)k; } - - unsigned int val_len() const { return root_["val_len"].asUInt(); } - void val_len(unsigned int k) { root_["val_len"] = (Json::UInt)k; } - - unsigned int max_reprobe() const { return root_["max_reprobe"].asUInt(); } - void max_reprobe(unsigned int m) { root_["max_reprobe"] = (Json::UInt)m; } - - size_t max_reprobe_offset() const { return root_["reprobes"][max_reprobe()].asLargestUInt(); } - - double fpr() const { return root_["fpr"].asDouble(); } - void fpr(double f) { root_["fpr"] = f; } - - unsigned long nb_hashes() const { return root_["nb_hashes"].asUInt(); } - void nb_hashes(unsigned long nbh) { root_["nb_hashes"] = (Json::UInt)nbh; } - - bool canonical() const { return root_.get("canonical", false).asBool(); } - void canonical(bool v) { root_["canonical"] = v; } - - /// reprobes must be at least max_reprobe() + 1 long - void get_reprobes(size_t* reprobes) const { - for(unsigned int i = 0; i <= max_reprobe(); ++i) - reprobes[i] = root_["reprobes"][i].asLargestUInt(); - } - - /// This must be call after max_reprobe has been set. reprobes must - /// be at least max_reprobe() + 1 long. - void set_reprobes(const size_t* reprobes) { - root_["reprobes"].clear(); - for(unsigned int i = 0; i <= max_reprobe(); ++i) - root_["reprobes"].append((Json::UInt64)reprobes[i]); - } - - /// Length of counter field in binary/sorted format - unsigned int counter_len() const { return root_["counter_len"].asUInt(); } - void counter_len(unsigned int l) { root_["counter_len"] = (Json::UInt)l; } - - std::string format() const { return root_["format"].asString(); } - void format(const std::string& s) { root_["format"] = s; } -}; -} // namespace jellyfish - -#endif /* __JELLYFISH_FILE_HEADER_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/generator_manager.hpp b/src/modifiedJellyfish/include/jellyfish/generator_manager.hpp deleted file mode 100644 index 0d9224ef..00000000 --- a/src/modifiedJellyfish/include/jellyfish/generator_manager.hpp +++ /dev/null @@ -1,174 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_GENERATOR_MANAGER_H__ -#define __JELLYFISH_GENERATOR_MANAGER_H__ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef HAVE_EXT_STDIO_FILEBUF_H -#include -#define STDIO_FILEBUF_TYPE __gnu_cxx::stdio_filebuf -#else -#include -#define STDIO_FILEBUF_TYPE jellyfish::stdio_filebuf -#endif - -#include - -namespace jellyfish { -// Open a path and set CLOEXEC flags -int open_cloexec(const char* path, int flags); - -// Input stream (inherit from std::istream, behaves mostly like an -// ifstream), with flag O_CLOEXEC (close-on-exec) turned on. -class cloexec_istream : public std::istream -{ - static std::streambuf* open_file(const char* path) { - int fd = open_cloexec(path, O_RDONLY); - return new STDIO_FILEBUF_TYPE(fd, std::ios::in); - } - -public: - cloexec_istream(const cloexec_istream&) = delete; - cloexec_istream(const char* path) : - std::istream((open_file(path))) - { } - cloexec_istream(const std::string& path) : - std::istream(open_file(path.c_str())) - { } - virtual ~cloexec_istream() { close(); } - void close() { delete std::istream::rdbuf(0); } -}; - - -// This class is responsible for creating a tmp directory and -// populating it with fifos. -class tmp_pipes { - static std::string create_tmp_dir(); - std::vector create_pipes(const std::string& tmpdir, int nb_pipes); - - std::string tmpdir_; - std::vector pipes_; - std::vector pipes_paths_; - -public: - tmp_pipes(int nb_pipes): - tmpdir_(create_tmp_dir()), - pipes_(create_pipes(tmpdir_, nb_pipes)) - { - for(auto it = pipes_.cbegin(); it != pipes_.cend(); ++it) - pipes_paths_.push_back(it->c_str()); - } - ~tmp_pipes() { cleanup(); } - - size_t size() const { return pipes_.size(); } - const char* operator[](int i) const { return pipes_[i].c_str(); } - std::vector::const_iterator begin() const { return pipes_paths_.cbegin(); } - std::vector::const_iterator end() const { return pipes_paths_.cend(); } - - // Discard a pipe: unlink it while it is open for writing. The - // reading process will get no data and won't be able to reopen the - // file, marking the end of this pipe. - void discard(int i); - // Discard all pipes - void cleanup(); -}; - -// This class creates a new process which manages a bunch of -// "generators", sub-processes that writes into a fifo (named pipe) -// and generate sequence. -class generator_manager_base { - tmp_pipes pipes_; - pid_t manager_pid_; - const char* shell_; - int kill_signal_; // if >0, process has received that signal - - struct cmd_info_type { - std::string command; - int pipe; - }; - typedef std::map pid2pipe_type; - pid2pipe_type pid2pipe_; - -public: - generator_manager_base(int nb_pipes, const char* shell = 0) : - pipes_(nb_pipes), - manager_pid_(-1), - shell_(shell), - kill_signal_(0) - { - if(!shell_) - shell_ = getenv("SHELL"); - if(!shell_) - shell_ = "/bin/sh"; - } - virtual ~generator_manager_base() { wait(); } - - const tmp_pipes& pipes() const { return pipes_; } - pid_t pid() const { return manager_pid_; } - - // Start the manager process - void start(); - // Wait for manager process to finish. Return true if it finishes - // with no error, false otherwise. - bool wait(); - -protected: - virtual std::string get_cmd() = 0; - virtual void parent_cleanup() { } - void start_commands(); - void start_one_command(const std::string& command, int pipe); - bool display_status(int status, const std::string& command); - int setup_signal_handlers(); - void unset_signal_handlers(); - static void signal_handler(int signal); - void cleanup(); -}; - -class generator_manager : public generator_manager_base { - cloexec_istream cmds_; -public: - generator_manager(const char* cmds, int nb_pipes, const char* shell = 0) - : generator_manager_base(nb_pipes, shell) - , cmds_(cmds) - { - if(!cmds_.good()) - throw std::runtime_error(err::msg() << "Failed to open cmds file '" << cmds << "'"); - } - - void parent_cleanup() { - cmds_.close(); - } - - std::string get_cmd(); -}; -} - -#endif /* __JELLYFISH_GENERATOR_MANAGER_H__ */ - diff --git a/src/modifiedJellyfish/include/jellyfish/generic_file_header.hpp b/src/modifiedJellyfish/include/jellyfish/generic_file_header.hpp deleted file mode 100644 index a8ddf825..00000000 --- a/src/modifiedJellyfish/include/jellyfish/generic_file_header.hpp +++ /dev/null @@ -1,255 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_GENERIC_FILE_HEADER_HPP__ -#define __JELLYFISH_GENERIC_FILE_HEADER_HPP__ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_NSGETEXECUTABLEPATH -#include -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -namespace jellyfish { -/// Generic file header. It contains by default the hostname, the -/// current time, the current working directory and the path to the -/// executable. -class generic_file_header { -protected: - static const int MAX_HEADER_DIGITS = 9; - Json::Value root_; - size_t offset_; // Nb of bytes past header - - struct buffer { - char* data; - buffer(size_t size) : data(new char[size]) { } - ~buffer() { delete [] data; } - }; - - struct restore_fmtflags { - std::ostream& os_; - std::ios::fmtflags flags_; - std::streamsize width_; - char fill_; - restore_fmtflags(std::ostream& os) : - os_(os), flags_(os.flags(std::ios::fmtflags())), width_(os.width()), fill_(os.fill()) - { } - ~restore_fmtflags() { - os_.flags(flags_); - os_.width(width_); - os_.fill(fill_); - } - }; - - static void chomp(std::string& s) { - size_t found = s.find_last_not_of(" \t\f\v\n\r"); - if (found != std::string::npos) - s.erase(found+1); - else - s.clear(); - } - -public: - explicit generic_file_header(int alignment = 0) - { - root_["alignment"] = alignment; - } - - bool operator==(const generic_file_header& rhs) const { - std::cerr << "operator== " << (root_ == rhs.root_) << "\n"; - return root_ == rhs.root_; - } - bool operator!=(const generic_file_header& rhs) const { return root_ != rhs.root_; } - - /// Write the header to an output stream. The format will be: the - /// length written in text and decimal, followed by the header in - /// terse JSON format, followed by some padding to align according - /// to the `alignment_` member. - void write(std::ostream& os) { - restore_fmtflags flags(os); - Json::FastWriter writer; - std::string header = writer.write(root_); - chomp(header); - - int align = alignment(); - int padding = 0; - size_t hlen = header.size(); - if(align > 0) { - padding = (MAX_HEADER_DIGITS + header.size()) % align; - if(padding) - hlen += align - padding; - } - os << std::dec << std::right << std::setw(MAX_HEADER_DIGITS) << std::setfill('0') << hlen; - os.write(header.c_str(), header.size()); - offset_ = MAX_HEADER_DIGITS + hlen; - - if(padding) { - char pad[align - padding]; - memset(pad, '\0', align - padding); - os.write(pad, align - padding); - } - } - - /// Read an input stream to search for a header. If one is found, - /// true is returned. In that case, the position in the input stream points after the header and padding. - /// - /// If false is returned, the parsing failed. The - /// position in the input stream may have changed and the keys - /// present in this header may be anything. - bool read(std::istream& is) { - std::string len; - int i; - for(i = 0; i < MAX_HEADER_DIGITS && isdigit(is.peek()); ++i) - len += is.get(); - if(is.peek() != '{') - return false; - unsigned long hlen = atol(len.c_str()); - if(hlen < 2) - return false; - - offset_ = MAX_HEADER_DIGITS + hlen; - buffer hbuf(hlen); - is.read(hbuf.data, hlen); - if(!is.good()) - return false; - const char* end = hbuf.data + hlen; - while(end > hbuf.data && *(end - 1) == '\0') --end; - - Json::Reader reader; - if(!reader.parse(hbuf.data, end, root_, false)) - return false; - - return true; - } - - const Json::Value root() const { return root_; } - - void fill_standard() { - root_["hostname"] = get_hostname(); - root_["pwd"] = get_pwd(); - root_["time"] = get_localtime(); - root_["exe_path"] = get_exe_path(); - } - - std::string operator[](const std::string& key) const { return root_.get(key, "").asString(); } - std::string operator[](const char* key) const { return root_.get(key, "").asString(); } - int alignment() const { return std::max(0, root_.get("alignment", 0).asInt()); } - size_t offset() const { return offset_; } - - std::vector cmdline() const { - std::vector res; - for(unsigned int i = 0; i < root_["cmdline"].size(); ++i) - res.push_back(root_["cmdline"][i].asString()); - return res; - } - - - void set_cmdline(int argc, char* argv[]) { - root_["cmdline"].clear(); - for(int i = 0; i < argc; i++) - root_["cmdline"].append(argv[i]); - } - -protected: - std::string get_hostname() const { - struct utsname buf; - if(uname(&buf) == -1) - return ""; - return buf.nodename; - } - - std::string get_pwd() const { -#ifdef PATH_MAX - size_t len = PATH_MAX; -#else - size_t len = 1024; -#endif - char path[len + 1]; - - if(!getcwd(path, len + 1)) - path[0] = '\0'; - return path; - } - - std::string get_localtime() const { - time_t t = time(0); - std::string res(ctime(&t)); - chomp(res); - return res; - } - - std::string get_exe_path() const { -#ifdef HAVE_NSGETEXECUTABLEPATH - return get_exe_path_macosx(); -#else - return get_exe_path_linux(); -#endif - } - -#ifdef HAVE_NSGETEXECUTABLEPATH - std::string get_exe_path_macosx() const { -#ifdef MAXPATHLEN - size_t len = MAXPATHLEN; -#else - size_t len = 1024; -#endif - - char path[len + 1]; - if(_NSGetExecutablePath(path, (uint32_t*)&len) == -1) - return ""; - - return std::string(path); - } -#endif // HAVE_NSGETEXECUTABLEPATH - - std::string get_exe_path_linux() const { -#ifdef PATH_MAX - size_t len = PATH_MAX; -#else - size_t len = 1024; -#endif - - char path[len + 1]; - ssize_t l = readlink("/proc/self/exe", path, len + 1); - if(l == -1) - return ""; - return std::string(path, l); - } -}; - -inline std::ostream& operator<<(std::ostream& os, const generic_file_header& h) { - Json::StyledWriter w; - return os << w.write(h.root()); -} - -} // namespace jellyfish - -#endif /* __JELLYFISH_GENERIC_FILE_HEADER_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/hash_counter.hpp b/src/modifiedJellyfish/include/jellyfish/hash_counter.hpp deleted file mode 100644 index 9b18baba..00000000 --- a/src/modifiedJellyfish/include/jellyfish/hash_counter.hpp +++ /dev/null @@ -1,244 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __HASH_COUNTER_HPP__ -#define __HASH_COUNTER_HPP__ - -#include - -#include -#include -#include - -/// Cooperative version of the hash_counter. In this implementation, -/// it is expected that the given number of threads will call the -/// `add` method regularly. In case the hash table is full, it gets -/// enlarged using all the threads. After the work is done, every -/// thread must call promptly the `done` method. - -namespace jellyfish{ namespace cooperative { - -template -class hash_counter { -public: - typedef typename large_hash::array array; - typedef typename array::key_type key_type; - typedef typename array::mapped_type mapped_type; - typedef typename array::value_type value_type; - typedef typename array::reference reference; - typedef typename array::const_reference const_reference; - typedef typename array::pointer pointer; - typedef typename array::const_pointer const_pointer; - typedef typename array::eager_iterator eager_iterator; - typedef typename array::lazy_iterator lazy_iterator; - -protected: - array* ary_; - array* new_ary_; - uint16_t nb_threads_; - locks::pthread::barrier size_barrier_; - volatile uint16_t size_thid_, done_threads_; - bool do_size_doubling_; - dumper_t* dumper_; - -public: - hash_counter(size_t size, // Size of hash. To be rounded up to a power of 2 - uint16_t key_len, // Size of key in bits - uint16_t val_len, // Size of val in bits - uint16_t nb_threads, // Number of threads accessing this hash - uint16_t reprobe_limit = 126, // Maximum reprobe - const size_t* reprobes = jellyfish::quadratic_reprobes) : - ary_(new array(size, key_len, val_len, reprobe_limit, reprobes)), - new_ary_(0), - nb_threads_(nb_threads), - size_barrier_(nb_threads), - size_thid_(0), - done_threads_(0), - do_size_doubling_(true), - dumper_(0) - { } - - ~hash_counter() { - delete ary_; - } - - array* ary() { return ary_; } - const array* ary() const { return ary_; } - size_t size() const { return ary_->size(); } - uint16_t key_len() const { return ary_->key_len(); } - uint16_t val_len() const { return ary_->val_len(); } - uint16_t nb_threads() const { return nb_threads; } - uint16_t reprobe_limit() const { return ary_->max_reprobe(); } - - - /// Whether we attempt to double the size of the hash when full. - bool do_size_doubling() const { return do_size_doubling_; } - /// Set whether we attempt to double the size of the hash when full. - void do_size_doubling(bool v) { do_size_doubling_ = v; } - - /// Set dumper responsible for cleaning out the array. - void dumper(dumper_t *d) { dumper_ = d; } - - /// Add `v` to the entry `k`. It returns in `is_new` true if the - /// entry `k` did not exist in the hash. In `id` is returned the - /// final position of `k` in the hash array. - void add(const Key& k, uint64_t v, bool* is_new, size_t* id) { - unsigned int carry_shift = 0; - bool* is_new_ptr = is_new; - size_t* id_ptr = id; - bool is_new_void = false; - size_t id_void = false; - - while(!ary_->add(k, v, &carry_shift, is_new_ptr, id_ptr)) { - handle_full_ary(); - v &= ~(uint64_t)0 << carry_shift; - // If carry_shift == 0, failed to allocate the first field for - // key, hence status of is_new and value for id are not - // determined yet. On the other hand, if carry_shift > 0, we - // failed while adding extra field for large key, so the status - // of is_new and value of id are known. We do not update them in future - // calls. - if(carry_shift) { - is_new_ptr = &is_new_void; - id_ptr = &id_void; - } - } - } - - /// Add `v` to the entry `k`. This method is multi-thread safe. If - /// the entry for `k` does not exists, it is inserted. - /// - /// @param k Key to add to - /// @param v Value to add - inline void add(const Key& k, uint64_t v) { - bool is_new; - size_t id; - add(k, v, &is_new, &id); - } - - /// Insert the key `k` in the hash. The value is not changed or set - /// to 0 if not already in the hash. - /// - /// @param k Key to insert - inline void set(const Key& k) { - bool is_new; - size_t id; - set(k, &is_new, &id); - } - - /// Insert the key `k` in the hash. The value is not changed or set - /// to 0 if not already in the hash. Set `is_new` to true if `k` did - /// not already exist in the hash. In `id` is returned the final - /// position of `k` in the hash. - void set(const Key& k, bool* is_new, size_t* id) { - while(!ary_->set(k, is_new, id)) - handle_full_ary(); - } - - /// Update the value of key `k` by adding `v`, if `k` is already - /// present in the hash, otherwise this nothing happens. Returns - /// true if `k` is already in the hash, false otherwise. - bool update_add(const Key& k, uint64_t v) { - Key tmp_key; - return update_add(k, v, tmp_key); - } - - bool update_add(const Key& k, uint64_t v, Key& tmp_key) { - unsigned int carry_shift = 0; - - while(true) { - if(ary_->update_add(k, v, &carry_shift, tmp_key)) - return true; - if(carry_shift == 0) - return false; - handle_full_ary(); - v &= ~(uint64_t)0 << carry_shift; - } - } - - /// Signify that thread is done and wait for all threads to be done. - void done() { - atomic_t::fetch_add(&done_threads_, (uint16_t)1); - while(!handle_full_ary()) ; - } - -protected: - // Double the size of the hash and return false. Unless all the - // thread have reported they are done, in which case do nothing and - // return true. - bool handle_full_ary() { - bool serial_thread = size_barrier_.wait(); - if(done_threads_ >= nb_threads_) // All done? - return true; - - bool success = false; - if(do_size_doubling_) - success = success || double_size(serial_thread); - - if(!success && dumper_) { - if(serial_thread) - dumper_->dump(ary_); - success = true; - size_barrier_.wait(); - } - - if(!success) - throw std::runtime_error("Hash full"); - - return false; - } - - bool double_size(bool serial_thread) { - if(serial_thread) {// Allocate new array for size doubling - try { - new_ary_ = new array(ary_->size() * 2, ary_->key_len(), ary_->val_len(), - ary_->max_reprobe(), ary_->reprobes()); - } catch(typename array::ErrorAllocation e) { - new_ary_ = 0; - } - } - size_thid_ = 0; - - size_barrier_.wait(); - array* my_ary = *(array* volatile*)&new_ary_; - if(!my_ary) // Allocation failed - return false; - - // Copy data from old to new - uint16_t id = atomic_t::fetch_add(&size_thid_, (uint16_t)1); - // Why doesn't the following work? Seems like a bug to - // me. Equivalent call works in test_large_hash_array. Or am I - // missing something? - // eager_iterator it = ary_->iterator_slice(id, nb_threads_); - eager_iterator it = ary_->eager_slice(id, nb_threads_); - while(it.next()) - my_ary->add(it.key(), it.val()); - - size_barrier_.wait(); - - if(serial_thread) { // Set new ary to be current and free old - delete ary_; - ary_ = new_ary_; - } - - // Done. Last sync point - size_barrier_.wait(); - return true; - } -}; - -} } // namespace jellyfish { namespace cooperative { -#endif /* __HASH_COUNTER_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/int128.hpp b/src/modifiedJellyfish/include/jellyfish/int128.hpp deleted file mode 100644 index 56ab25a9..00000000 --- a/src/modifiedJellyfish/include/jellyfish/int128.hpp +++ /dev/null @@ -1,203 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef _INT128_H_ -#define _INT128_H_ - -#ifdef HAVE_CONFIG_H -#include -#ifndef HAVE_INT128 -#error "The type __int128 is not supported" -#endif -#endif - -#include -#include -#include -#include -#include -#include - -// Output of __int128: this might be slow -namespace __int128_ns { -template -void __print_digits(std::ostream& os, unsigned __int128 x, - bool lower = true) { - char buf[50]; - char* ptr = buf + sizeof(buf); - do { - int o = x % base; - if(o < 10) { - *--ptr = '0' + o; - } else { - *--ptr = (lower ? 'a' : 'A') + o - 10; - } - x /= base; - } while (x > 0); - os.write(ptr, buf + sizeof(buf) - ptr); -} - -inline bool is_negative(unsigned __int128 x) { return false; } -inline bool is_negative(__int128 x) { return x < 0; } - -template -void __print_decimal(std::ostream& prefix, std::ostream& os, T x, - const std::ios::fmtflags& ff) { - if((ff & std::ios::showpos) && x > 0) - prefix << "+"; - if(x == 0) { - os << "0"; - return; - } - if(is_negative(x)) { - prefix << "-"; - x = -x; - } - __print_digits<10>(os, x); -} - -void __print_bases(std::ostream& prefix, std::ostream& os, - unsigned __int128 x, - const std::ios::fmtflags& ff); - -template -void __print_buf(std::ostream& prefix, std::ostream& os, T x, - const std::ios::fmtflags& ff) { - if(ff & std::ios::dec) - __print_decimal(prefix, os, x, ff); - else - __print_bases(prefix, os, (unsigned __int128)x, ff); -} - -template -void __print(std::ostream&os, T x) { - const std::ios_base::fmtflags ff = os.flags(); - - if(!(ff & std::ios::adjustfield)) - return __print_buf(os, os, x, ff); - - std::ostringstream prefix; - std::ostringstream buf; - __print_buf(prefix, buf, x, ff); - ssize_t nb_padding = os.width() - (prefix.str().size() + buf.str().size()); - if(nb_padding <= 0) { - os.write(prefix.str().c_str(), prefix.tellp()); - os.write(buf.str().c_str(), buf.tellp()); - return; - } - - char padding[nb_padding]; - memset(padding, os.fill(), nb_padding); - if(ff & std::ios::right) - os.write(padding, nb_padding); - os.write(prefix.str().c_str(), prefix.tellp()); - if(ff & std::ios::internal) - os.write(padding, nb_padding); - os.write(buf.str().c_str(), buf.tellp()); - if(ff & std::ios::left) - os.write(padding, nb_padding); -} -} - -inline -std::ostream& operator<<(std::ostream& os, __int128 x) { - __int128_ns::__print(os, x); - return os; -} - -inline -std::ostream& operator<<(std::ostream& os, unsigned __int128 x) { - __int128_ns::__print(os, x); - return os; -} - -#ifndef HAVE_NUMERIC_LIMITS128 -namespace std { -template<> -class numeric_limits<__int128> { -public: - static const bool is_specialized = true; - static __int128 max() { return (unsigned __int128)-1 >> 1; } - static __int128 min() { return max() + 1; } - static const int digits = 127; - static const int digits10 = 38; -#define NLS64 numeric_limits - static const bool is_signed = NLS64::is_signed; - static const bool is_integer = NLS64::is_integer; - static const bool is_exact = NLS64::is_exact; - static const int radix = NLS64::radix; - static __int128 epsilon() { return NLS64::epsilon(); } - static __int128 round_error() { return NLS64::round_error(); } - static const int min_exponent = NLS64::min_exponent; - static const int min_exponent10 = NLS64::min_exponent10; - static const int max_exponent = NLS64::max_exponent; - static const int max_exponent10 = NLS64::max_exponent10; - static const bool has_infinity = NLS64::has_infinity; - static const bool has_quiet_NaN = NLS64::has_quiet_NaN; - static const bool has_signaling_NaN = NLS64::has_signaling_NaN; - static const float_denorm_style has_denorm = NLS64::has_denorm; - static const bool has_denorm_loss = NLS64::has_denorm_loss; - static __int128 infinity() { return NLS64::infinity(); } - static __int128 quiet_NaN() { return NLS64::quiet_NaN(); } - static __int128 signaling_NaN() { return NLS64::signaling_NaN(); } - static __int128 denorm_min() { return NLS64::denorm_min(); } - static const bool is_iec559 = NLS64::is_iec559; - static const bool is_bounded = NLS64::is_bounded; - static const bool is_modulo = NLS64::is_modulo; - static const bool traps = NLS64::traps; - static const bool tinyness_before = NLS64::tinyness_before; - static const float_round_style round_style = NLS64::round_style; -}; - -template<> -class numeric_limits { -public: - static const bool is_specialized = true; - static __int128 max() { return (unsigned __int128)-1; } - static __int128 min() { return 0; } - static const int digits = 128; - static const int digits10 = 39; -#define NLU64 numeric_limits - static const bool is_signed = NLU64::is_signed; - static const bool is_integer = NLU64::is_integer; - static const bool is_exact = NLU64::is_exact; - static const int radix = NLU64::radix; - static __int128 epsilon() { return NLU64::epsilon(); } - static __int128 round_error() { return NLU64::round_error(); } - static const int min_exponent = NLU64::min_exponent; - static const int min_exponent10 = NLU64::min_exponent10; - static const int max_exponent = NLU64::max_exponent; - static const int max_exponent10 = NLU64::max_exponent10; - static const bool has_infinity = NLU64::has_infinity; - static const bool has_quiet_NaN = NLU64::has_quiet_NaN; - static const bool has_signaling_NaN = NLU64::has_signaling_NaN; - static const float_denorm_style has_denorm = NLU64::has_denorm; - static const bool has_denorm_loss = NLU64::has_denorm_loss; - static __int128 infinity() { return NLU64::infinity(); } - static __int128 quiet_NaN() { return NLU64::quiet_NaN(); } - static __int128 signaling_NaN() { return NLU64::signaling_NaN(); } - static __int128 denorm_min() { return NLU64::denorm_min(); } - static const bool is_iec559 = NLU64::is_iec559; - static const bool is_bounded = NLU64::is_bounded; - static const bool is_modulo = NLU64::is_modulo; - static const bool traps = NLU64::traps; - static const bool tinyness_before = NLU64::tinyness_before; - static const float_round_style round_style = NLU64::round_style; -}; -} // namespace std -#endif /* HAVE_NUMERIC_LIMITS128 */ - -#endif /* _INT128_H_ */ diff --git a/src/modifiedJellyfish/include/jellyfish/jellyfish.hpp b/src/modifiedJellyfish/include/jellyfish/jellyfish.hpp deleted file mode 100644 index eec4e84d..00000000 --- a/src/modifiedJellyfish/include/jellyfish/jellyfish.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_JELLYFISH_HPP__ -#define __JELLYFISH_JELLYFISH_HPP__ - -#include -#include -#include -#include -#include - -typedef jellyfish::cooperative::hash_counter mer_hash; -typedef mer_hash::array mer_array; -typedef jellyfish::text_dumper text_dumper; -typedef jellyfish::text_reader text_reader; -typedef jellyfish::binary_dumper binary_dumper; -typedef jellyfish::binary_reader binary_reader; -typedef jellyfish::binary_query_base binary_query; -typedef jellyfish::binary_writer binary_writer; -typedef jellyfish::text_writer text_writer; - - -#endif /* __JELLYFISH_JELLYFISH_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/json.h b/src/modifiedJellyfish/include/jellyfish/json.h deleted file mode 100644 index 3f81d017..00000000 --- a/src/modifiedJellyfish/include/jellyfish/json.h +++ /dev/null @@ -1,1855 +0,0 @@ -/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/). -/// It is intented to be used with #include - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: LICENSE -// ////////////////////////////////////////////////////////////////////// - -/* -The JsonCpp library's source code, including accompanying documentation, -tests and demonstration applications, are licensed under the following -conditions... - -The author (Baptiste Lepilleur) explicitly disclaims copyright in all -jurisdictions which recognize such a disclaimer. In such jurisdictions, -this software is released into the Public Domain. - -In jurisdictions which do not recognize Public Domain property (e.g. Germany as of -2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is -released under the terms of the MIT License (see below). - -In jurisdictions which recognize Public Domain property, the user of this -software may choose to accept it either as 1) Public Domain, 2) under the -conditions of the MIT License (see below), or 3) under the terms of dual -Public Domain/MIT License conditions described here, as they choose. - -The MIT License is about as close to Public Domain as a license can get, and is -described in clear, concise terms at: - - http://en.wikipedia.org/wiki/MIT_License - -The full text of the MIT License follows: - -======================================================================== -Copyright (c) 2007-2010 Baptiste Lepilleur - -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. -======================================================================== -(END LICENSE TEXT) - -The MIT license is compatible with both the GPL and commercial -software, affording one all of the rights of Public Domain with the -minor nuisance of being required to keep the above copyright notice -and license text in the source code. Note also that by accepting the -Public Domain "license" you can re-license your copy using whatever -license you like. - -*/ - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: LICENSE -// ////////////////////////////////////////////////////////////////////// - - - - - -#ifndef JSON_AMALGATED_H_INCLUDED -# define JSON_AMALGATED_H_INCLUDED -/// If defined, indicates that the source file is amalgated -/// to prevent private header inclusion. -#define JSON_IS_AMALGATED - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/config.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_CONFIG_H_INCLUDED -# define JSON_CONFIG_H_INCLUDED - -/// If defined, indicates that json library is embedded in CppTL library. -//# define JSON_IN_CPPTL 1 - -/// If defined, indicates that json may leverage CppTL library -//# define JSON_USE_CPPTL 1 -/// If defined, indicates that cpptl vector based map should be used instead of std::map -/// as Value container. -//# define JSON_USE_CPPTL_SMALLMAP 1 -/// If defined, indicates that Json specific container should be used -/// (hash table & simple deque container with customizable allocator). -/// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332 -//# define JSON_VALUE_USE_INTERNAL_MAP 1 -/// Force usage of standard new/malloc based allocator instead of memory pool based allocator. -/// The memory pools allocator used optimization (initializing Value and ValueInternalLink -/// as if it was a POD) that may cause some validation tool to report errors. -/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. -//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 - -/// If defined, indicates that Json use exception to report invalid type manipulation -/// instead of C assert macro. -/// # define JSON_USE_EXCEPTION 1 - -/// If defined, indicates that the source file is amalgated -/// to prevent private header inclusion. -/// Remarks: it is automatically defined in the generated amalgated header. -#define JSON_IS_AMALGAMATION 1 - - -# ifdef JSON_IN_CPPTL -# include -# ifndef JSON_USE_CPPTL -# define JSON_USE_CPPTL 1 -# endif -# endif - -# ifdef JSON_IN_CPPTL -# define JSON_API CPPTL_API -# elif defined(JSON_DLL_BUILD) -# define JSON_API __declspec(dllexport) -# elif defined(JSON_DLL) -# define JSON_API __declspec(dllimport) -# else -# define JSON_API -# endif - -// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer -// Storages, and 64 bits integer support is disabled. -// #define JSON_NO_INT64 1 - -#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 -// Microsoft Visual Studio 6 only support conversion from __int64 to double -// (no conversion from unsigned __int64). -#define JSON_USE_INT64_DOUBLE_CONVERSION 1 -#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 - -#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 -/// Indicates that the following function is deprecated. -# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) -#endif - -#if !defined(JSONCPP_DEPRECATED) -# define JSONCPP_DEPRECATED(message) -#endif // if !defined(JSONCPP_DEPRECATED) - -namespace Json { - typedef int Int; - typedef unsigned int UInt; -# if defined(JSON_NO_INT64) - typedef int LargestInt; - typedef unsigned int LargestUInt; -# undef JSON_HAS_INT64 -# else // if defined(JSON_NO_INT64) - // For Microsoft Visual use specific types as long long is not supported -# if defined(_MSC_VER) // Microsoft Visual Studio - typedef __int64 Int64; - typedef unsigned __int64 UInt64; -# else // if defined(_MSC_VER) // Other platforms, use long long - typedef long long int Int64; - typedef unsigned long long int UInt64; -# endif // if defined(_MSC_VER) - typedef Int64 LargestInt; - typedef UInt64 LargestUInt; -# define JSON_HAS_INT64 -# endif // if defined(JSON_NO_INT64) -} // end namespace Json - - -#endif // JSON_CONFIG_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/config.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/forwards.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_FORWARDS_H_INCLUDED -# define JSON_FORWARDS_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -# include "config.h" -#endif // if !defined(JSON_IS_AMALGAMATION) - -namespace Json { - - // writer.h - class FastWriter; - class StyledWriter; - - // reader.h - class Reader; - - // features.h - class Features; - - // value.h - typedef unsigned int ArrayIndex; - class StaticString; - class Path; - class PathArgument; - class Value; - class ValueIteratorBase; - class ValueIterator; - class ValueConstIterator; -#ifdef JSON_VALUE_USE_INTERNAL_MAP - class ValueMapAllocator; - class ValueInternalLink; - class ValueInternalArray; - class ValueInternalMap; -#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP - -} // namespace Json - - -#endif // JSON_FORWARDS_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/forwards.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/features.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_FEATURES_H_INCLUDED -# define CPPTL_JSON_FEATURES_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -# include "forwards.h" -#endif // if !defined(JSON_IS_AMALGAMATION) - -namespace Json { - - /** \brief Configuration passed to reader and writer. - * This configuration object can be used to force the Reader or Writer - * to behave in a standard conforming way. - */ - class JSON_API Features - { - public: - /** \brief A configuration that allows all features and assumes all strings are UTF-8. - * - C & C++ comments are allowed - * - Root object can be any JSON value - * - Assumes Value strings are encoded in UTF-8 - */ - static Features all(); - - /** \brief A configuration that is strictly compatible with the JSON specification. - * - Comments are forbidden. - * - Root object must be either an array or an object value. - * - Assumes Value strings are encoded in UTF-8 - */ - static Features strictMode(); - - /** \brief Initialize the configuration like JsonConfig::allFeatures; - */ - Features(); - - /// \c true if comments are allowed. Default: \c true. - bool allowComments_; - - /// \c true if root must be either an array or an object value. Default: \c false. - bool strictRoot_; - }; - -} // namespace Json - -#endif // CPPTL_JSON_FEATURES_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/features.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/value.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_H_INCLUDED -# define CPPTL_JSON_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -# include "forwards.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -# include -# include - -# ifndef JSON_USE_CPPTL_SMALLMAP -# include -# else -# include -# endif -# ifdef JSON_USE_CPPTL -# include -# endif - -/** \brief JSON (JavaScript Object Notation). - */ -namespace Json { - - /** \brief Type of the value held by a Value object. - */ - enum ValueType - { - nullValue = 0, ///< 'null' value - intValue, ///< signed integer value - uintValue, ///< unsigned integer value - realValue, ///< double value - stringValue, ///< UTF-8 string value - booleanValue, ///< bool value - arrayValue, ///< array value (ordered list) - objectValue ///< object value (collection of name/value pairs). - }; - - enum CommentPlacement - { - commentBefore = 0, ///< a comment placed on the line before a value - commentAfterOnSameLine, ///< a comment just after a value on the same line - commentAfter, ///< a comment on the line after a value (only make sense for root value) - numberOfCommentPlacement - }; - -//# ifdef JSON_USE_CPPTL -// typedef CppTL::AnyEnumerator EnumMemberNames; -// typedef CppTL::AnyEnumerator EnumValues; -//# endif - - /** \brief Lightweight wrapper to tag static string. - * - * Value constructor and objectValue member assignement takes advantage of the - * StaticString and avoid the cost of string duplication when storing the - * string or the member name. - * - * Example of usage: - * \code - * Json::Value aValue( StaticString("some text") ); - * Json::Value object; - * static const StaticString code("code"); - * object[code] = 1234; - * \endcode - */ - class JSON_API StaticString - { - public: - explicit StaticString( const char *czstring ) - : str_( czstring ) - { - } - - operator const char *() const - { - return str_; - } - - const char *c_str() const - { - return str_; - } - - private: - const char *str_; - }; - - /** \brief Represents a JSON value. - * - * This class is a discriminated union wrapper that can represents a: - * - signed integer [range: Value::minInt - Value::maxInt] - * - unsigned integer (range: 0 - Value::maxUInt) - * - double - * - UTF-8 string - * - boolean - * - 'null' - * - an ordered list of Value - * - collection of name/value pairs (javascript object) - * - * The type of the held value is represented by a #ValueType and - * can be obtained using type(). - * - * values of an #objectValue or #arrayValue can be accessed using operator[]() methods. - * Non const methods will automatically create the a #nullValue element - * if it does not exist. - * The sequence of an #arrayValue will be automatically resize and initialized - * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. - * - * The get() methods can be used to obtanis default value in the case the required element - * does not exist. - * - * It is possible to iterate over the list of a #objectValue values using - * the getMemberNames() method. - */ - class JSON_API Value - { - friend class ValueIteratorBase; -# ifdef JSON_VALUE_USE_INTERNAL_MAP - friend class ValueInternalLink; - friend class ValueInternalMap; -# endif - public: - typedef std::vector Members; - typedef ValueIterator iterator; - typedef ValueConstIterator const_iterator; - typedef Json::UInt UInt; - typedef Json::Int Int; -# if defined(JSON_HAS_INT64) - typedef Json::UInt64 UInt64; - typedef Json::Int64 Int64; -#endif // defined(JSON_HAS_INT64) - typedef Json::LargestInt LargestInt; - typedef Json::LargestUInt LargestUInt; - typedef Json::ArrayIndex ArrayIndex; - - static const Value null; - /// Minimum signed integer value that can be stored in a Json::Value. - static const LargestInt minLargestInt; - /// Maximum signed integer value that can be stored in a Json::Value. - static const LargestInt maxLargestInt; - /// Maximum unsigned integer value that can be stored in a Json::Value. - static const LargestUInt maxLargestUInt; - - /// Minimum signed int value that can be stored in a Json::Value. - static const Int minInt; - /// Maximum signed int value that can be stored in a Json::Value. - static const Int maxInt; - /// Maximum unsigned int value that can be stored in a Json::Value. - static const UInt maxUInt; - - /// Minimum signed 64 bits int value that can be stored in a Json::Value. - static const Int64 minInt64; - /// Maximum signed 64 bits int value that can be stored in a Json::Value. - static const Int64 maxInt64; - /// Maximum unsigned 64 bits int value that can be stored in a Json::Value. - static const UInt64 maxUInt64; - - private: -#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION -# ifndef JSON_VALUE_USE_INTERNAL_MAP - class CZString - { - public: - enum DuplicationPolicy - { - noDuplication = 0, - duplicate, - duplicateOnCopy - }; - CZString( ArrayIndex index ); - CZString( const char *cstr, DuplicationPolicy allocate ); - CZString( const CZString &other ); - ~CZString(); - CZString &operator =( const CZString &other ); - bool operator<( const CZString &other ) const; - bool operator==( const CZString &other ) const; - ArrayIndex index() const; - const char *c_str() const; - bool isStaticString() const; - private: - void swap( CZString &other ); - const char *cstr_; - ArrayIndex index_; - }; - - public: -# ifndef JSON_USE_CPPTL_SMALLMAP - typedef std::map ObjectValues; -# else - typedef CppTL::SmallMap ObjectValues; -# endif // ifndef JSON_USE_CPPTL_SMALLMAP -# endif // ifndef JSON_VALUE_USE_INTERNAL_MAP -#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - - public: - /** \brief Create a default Value of the given type. - - This is a very useful constructor. - To create an empty array, pass arrayValue. - To create an empty object, pass objectValue. - Another Value can then be set to this one by assignment. - This is useful since clear() and resize() will not alter types. - - Examples: - \code - Json::Value null_value; // null - Json::Value arr_value(Json::arrayValue); // [] - Json::Value obj_value(Json::objectValue); // {} - \endcode - */ - Value( ValueType type = nullValue ); - Value( Int value ); - Value( UInt value ); -#if defined(JSON_HAS_INT64) - Value( Int64 value ); - Value( UInt64 value ); -#endif // if defined(JSON_HAS_INT64) - Value( double value ); - Value( const char *value ); - Value( const char *beginValue, const char *endValue ); - /** \brief Constructs a value from a static string. - - * Like other value string constructor but do not duplicate the string for - * internal storage. The given string must remain alive after the call to this - * constructor. - * Example of usage: - * \code - * Json::Value aValue( StaticString("some text") ); - * \endcode - */ - Value( const StaticString &value ); - Value( const std::string &value ); -# ifdef JSON_USE_CPPTL - Value( const CppTL::ConstString &value ); -# endif - Value( bool value ); - Value( const Value &other ); - ~Value(); - - Value &operator=( const Value &other ); - /// Swap values. - /// \note Currently, comments are intentionally not swapped, for - /// both logic and efficiency. - void swap( Value &other ); - - ValueType type() const; - - bool operator <( const Value &other ) const; - bool operator <=( const Value &other ) const; - bool operator >=( const Value &other ) const; - bool operator >( const Value &other ) const; - - bool operator ==( const Value &other ) const; - bool operator !=( const Value &other ) const; - - int compare( const Value &other ) const; - - const char *asCString() const; - std::string asString() const; -# ifdef JSON_USE_CPPTL - CppTL::ConstString asConstString() const; -# endif - Int asInt() const; - UInt asUInt() const; - Int64 asInt64() const; - UInt64 asUInt64() const; - LargestInt asLargestInt() const; - LargestUInt asLargestUInt() const; - float asFloat() const; - double asDouble() const; - bool asBool() const; - - bool isNull() const; - bool isBool() const; - bool isInt() const; - bool isUInt() const; - bool isIntegral() const; - bool isDouble() const; - bool isNumeric() const; - bool isString() const; - bool isArray() const; - bool isObject() const; - - bool isConvertibleTo( ValueType other ) const; - - /// Number of values in array or object - ArrayIndex size() const; - - /// \brief Return true if empty array, empty object, or null; - /// otherwise, false. - bool empty() const; - - /// Return isNull() - bool operator!() const; - - /// Remove all object members and array elements. - /// \pre type() is arrayValue, objectValue, or nullValue - /// \post type() is unchanged - void clear(); - - /// Resize the array to size elements. - /// New elements are initialized to null. - /// May only be called on nullValue or arrayValue. - /// \pre type() is arrayValue or nullValue - /// \post type() is arrayValue - void resize( ArrayIndex size ); - - /// Access an array element (zero based index ). - /// If the array contains less than index element, then null value are inserted - /// in the array so that its size is index+1. - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - Value &operator[]( ArrayIndex index ); - - /// Access an array element (zero based index ). - /// If the array contains less than index element, then null value are inserted - /// in the array so that its size is index+1. - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - Value &operator[]( int index ); - - /// Access an array element (zero based index ) - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - const Value &operator[]( ArrayIndex index ) const; - - /// Access an array element (zero based index ) - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - const Value &operator[]( int index ) const; - - /// If the array contains at least index+1 elements, returns the element value, - /// otherwise returns defaultValue. - Value get( ArrayIndex index, - const Value &defaultValue ) const; - /// Return true if index < size(). - bool isValidIndex( ArrayIndex index ) const; - /// \brief Append value to array at the end. - /// - /// Equivalent to jsonvalue[jsonvalue.size()] = value; - Value &append( const Value &value ); - - /// Access an object value by name, create a null member if it does not exist. - Value &operator[]( const char *key ); - /// Access an object value by name, returns null if there is no member with that name. - const Value &operator[]( const char *key ) const; - /// Access an object value by name, create a null member if it does not exist. - Value &operator[]( const std::string &key ); - /// Access an object value by name, returns null if there is no member with that name. - const Value &operator[]( const std::string &key ) const; - /** \brief Access an object value by name, create a null member if it does not exist. - - * If the object as no entry for that name, then the member name used to store - * the new entry is not duplicated. - * Example of use: - * \code - * Json::Value object; - * static const StaticString code("code"); - * object[code] = 1234; - * \endcode - */ - Value &operator[]( const StaticString &key ); -# ifdef JSON_USE_CPPTL - /// Access an object value by name, create a null member if it does not exist. - Value &operator[]( const CppTL::ConstString &key ); - /// Access an object value by name, returns null if there is no member with that name. - const Value &operator[]( const CppTL::ConstString &key ) const; -# endif - /// Return the member named key if it exist, defaultValue otherwise. - Value get( const char *key, - const Value &defaultValue ) const; - /// Return the member named key if it exist, defaultValue otherwise. - Value get( const std::string &key, - const Value &defaultValue ) const; -# ifdef JSON_USE_CPPTL - /// Return the member named key if it exist, defaultValue otherwise. - Value get( const CppTL::ConstString &key, - const Value &defaultValue ) const; -# endif - /// \brief Remove and return the named member. - /// - /// Do nothing if it did not exist. - /// \return the removed Value, or null. - /// \pre type() is objectValue or nullValue - /// \post type() is unchanged - Value removeMember( const char* key ); - /// Same as removeMember(const char*) - Value removeMember( const std::string &key ); - - /// Return true if the object has a member named key. - bool isMember( const char *key ) const; - /// Return true if the object has a member named key. - bool isMember( const std::string &key ) const; -# ifdef JSON_USE_CPPTL - /// Return true if the object has a member named key. - bool isMember( const CppTL::ConstString &key ) const; -# endif - - /// \brief Return a list of the member names. - /// - /// If null, return an empty list. - /// \pre type() is objectValue or nullValue - /// \post if type() was nullValue, it remains nullValue - Members getMemberNames() const; - -//# ifdef JSON_USE_CPPTL -// EnumMemberNames enumMemberNames() const; -// EnumValues enumValues() const; -//# endif - - /// Comments must be //... or /* ... */ - void setComment( const char *comment, - CommentPlacement placement ); - /// Comments must be //... or /* ... */ - void setComment( const std::string &comment, - CommentPlacement placement ); - bool hasComment( CommentPlacement placement ) const; - /// Include delimiters and embedded newlines. - std::string getComment( CommentPlacement placement ) const; - - std::string toStyledString() const; - - const_iterator begin() const; - const_iterator end() const; - - iterator begin(); - iterator end(); - - private: - Value &resolveReference( const char *key, - bool isStatic ); - -# ifdef JSON_VALUE_USE_INTERNAL_MAP - inline bool isItemAvailable() const - { - return itemIsUsed_ == 0; - } - - inline void setItemUsed( bool isUsed = true ) - { - itemIsUsed_ = isUsed ? 1 : 0; - } - - inline bool isMemberNameStatic() const - { - return memberNameIsStatic_ == 0; - } - - inline void setMemberNameIsStatic( bool isStatic ) - { - memberNameIsStatic_ = isStatic ? 1 : 0; - } -# endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP - - private: - struct CommentInfo - { - CommentInfo(); - ~CommentInfo(); - - void setComment( const char *text ); - - char *comment_; - }; - - //struct MemberNamesTransform - //{ - // typedef const char *result_type; - // const char *operator()( const CZString &name ) const - // { - // return name.c_str(); - // } - //}; - - union ValueHolder - { - LargestInt int_; - LargestUInt uint_; - double real_; - bool bool_; - char *string_; -# ifdef JSON_VALUE_USE_INTERNAL_MAP - ValueInternalArray *array_; - ValueInternalMap *map_; -#else - ObjectValues *map_; -# endif - } value_; - ValueType type_ : 8; - int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. -# ifdef JSON_VALUE_USE_INTERNAL_MAP - unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container. - int memberNameIsStatic_ : 1; // used by the ValueInternalMap container. -# endif - CommentInfo *comments_; - }; - - - /** \brief Experimental and untested: represents an element of the "path" to access a node. - */ - class PathArgument - { - public: - friend class Path; - - PathArgument(); - PathArgument( ArrayIndex index ); - PathArgument( const char *key ); - PathArgument( const std::string &key ); - - private: - enum Kind - { - kindNone = 0, - kindIndex, - kindKey - }; - std::string key_; - ArrayIndex index_; - Kind kind_; - }; - - /** \brief Experimental and untested: represents a "path" to access a node. - * - * Syntax: - * - "." => root node - * - ".[n]" => elements at index 'n' of root node (an array value) - * - ".name" => member named 'name' of root node (an object value) - * - ".name1.name2.name3" - * - ".[0][1][2].name1[3]" - * - ".%" => member name is provided as parameter - * - ".[%]" => index is provied as parameter - */ - class Path - { - public: - Path( const std::string &path, - const PathArgument &a1 = PathArgument(), - const PathArgument &a2 = PathArgument(), - const PathArgument &a3 = PathArgument(), - const PathArgument &a4 = PathArgument(), - const PathArgument &a5 = PathArgument() ); - - const Value &resolve( const Value &root ) const; - Value resolve( const Value &root, - const Value &defaultValue ) const; - /// Creates the "path" to access the specified node and returns a reference on the node. - Value &make( Value &root ) const; - - private: - typedef std::vector InArgs; - typedef std::vector Args; - - void makePath( const std::string &path, - const InArgs &in ); - void addPathInArg( const std::string &path, - const InArgs &in, - InArgs::const_iterator &itInArg, - PathArgument::Kind kind ); - void invalidPath( const std::string &path, - int location ); - - Args args_; - }; - - - -#ifdef JSON_VALUE_USE_INTERNAL_MAP - /** \brief Allocator to customize Value internal map. - * Below is an example of a simple implementation (default implementation actually - * use memory pool for speed). - * \code - class DefaultValueMapAllocator : public ValueMapAllocator - { - public: // overridden from ValueMapAllocator - virtual ValueInternalMap *newMap() - { - return new ValueInternalMap(); - } - - virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) - { - return new ValueInternalMap( other ); - } - - virtual void destructMap( ValueInternalMap *map ) - { - delete map; - } - - virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) - { - return new ValueInternalLink[size]; - } - - virtual void releaseMapBuckets( ValueInternalLink *links ) - { - delete [] links; - } - - virtual ValueInternalLink *allocateMapLink() - { - return new ValueInternalLink(); - } - - virtual void releaseMapLink( ValueInternalLink *link ) - { - delete link; - } - }; - * \endcode - */ - class JSON_API ValueMapAllocator - { - public: - virtual ~ValueMapAllocator(); - virtual ValueInternalMap *newMap() = 0; - virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0; - virtual void destructMap( ValueInternalMap *map ) = 0; - virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0; - virtual void releaseMapBuckets( ValueInternalLink *links ) = 0; - virtual ValueInternalLink *allocateMapLink() = 0; - virtual void releaseMapLink( ValueInternalLink *link ) = 0; - }; - - /** \brief ValueInternalMap hash-map bucket chain link (for internal use only). - * \internal previous_ & next_ allows for bidirectional traversal. - */ - class JSON_API ValueInternalLink - { - public: - enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture. - enum InternalFlags { - flagAvailable = 0, - flagUsed = 1 - }; - - ValueInternalLink(); - - ~ValueInternalLink(); - - Value items_[itemPerLink]; - char *keys_[itemPerLink]; - ValueInternalLink *previous_; - ValueInternalLink *next_; - }; - - - /** \brief A linked page based hash-table implementation used internally by Value. - * \internal ValueInternalMap is a tradional bucket based hash-table, with a linked - * list in each bucket to handle collision. There is an addional twist in that - * each node of the collision linked list is a page containing a fixed amount of - * value. This provides a better compromise between memory usage and speed. - * - * Each bucket is made up of a chained list of ValueInternalLink. The last - * link of a given bucket can be found in the 'previous_' field of the following bucket. - * The last link of the last bucket is stored in tailLink_ as it has no following bucket. - * Only the last link of a bucket may contains 'available' item. The last link always - * contains at least one element unless is it the bucket one very first link. - */ - class JSON_API ValueInternalMap - { - friend class ValueIteratorBase; - friend class Value; - public: - typedef unsigned int HashKey; - typedef unsigned int BucketIndex; - -# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - struct IteratorState - { - IteratorState() - : map_(0) - , link_(0) - , itemIndex_(0) - , bucketIndex_(0) - { - } - ValueInternalMap *map_; - ValueInternalLink *link_; - BucketIndex itemIndex_; - BucketIndex bucketIndex_; - }; -# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - - ValueInternalMap(); - ValueInternalMap( const ValueInternalMap &other ); - ValueInternalMap &operator =( const ValueInternalMap &other ); - ~ValueInternalMap(); - - void swap( ValueInternalMap &other ); - - BucketIndex size() const; - - void clear(); - - bool reserveDelta( BucketIndex growth ); - - bool reserve( BucketIndex newItemCount ); - - const Value *find( const char *key ) const; - - Value *find( const char *key ); - - Value &resolveReference( const char *key, - bool isStatic ); - - void remove( const char *key ); - - void doActualRemove( ValueInternalLink *link, - BucketIndex index, - BucketIndex bucketIndex ); - - ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex ); - - Value &setNewItem( const char *key, - bool isStatic, - ValueInternalLink *link, - BucketIndex index ); - - Value &unsafeAdd( const char *key, - bool isStatic, - HashKey hashedKey ); - - HashKey hash( const char *key ) const; - - int compare( const ValueInternalMap &other ) const; - - private: - void makeBeginIterator( IteratorState &it ) const; - void makeEndIterator( IteratorState &it ) const; - static bool equals( const IteratorState &x, const IteratorState &other ); - static void increment( IteratorState &iterator ); - static void incrementBucket( IteratorState &iterator ); - static void decrement( IteratorState &iterator ); - static const char *key( const IteratorState &iterator ); - static const char *key( const IteratorState &iterator, bool &isStatic ); - static Value &value( const IteratorState &iterator ); - static int distance( const IteratorState &x, const IteratorState &y ); - - private: - ValueInternalLink *buckets_; - ValueInternalLink *tailLink_; - BucketIndex bucketsSize_; - BucketIndex itemCount_; - }; - - /** \brief A simplified deque implementation used internally by Value. - * \internal - * It is based on a list of fixed "page", each page contains a fixed number of items. - * Instead of using a linked-list, a array of pointer is used for fast item look-up. - * Look-up for an element is as follow: - * - compute page index: pageIndex = itemIndex / itemsPerPage - * - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage] - * - * Insertion is amortized constant time (only the array containing the index of pointers - * need to be reallocated when items are appended). - */ - class JSON_API ValueInternalArray - { - friend class Value; - friend class ValueIteratorBase; - public: - enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo. - typedef Value::ArrayIndex ArrayIndex; - typedef unsigned int PageIndex; - -# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - struct IteratorState // Must be a POD - { - IteratorState() - : array_(0) - , currentPageIndex_(0) - , currentItemIndex_(0) - { - } - ValueInternalArray *array_; - Value **currentPageIndex_; - unsigned int currentItemIndex_; - }; -# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - - ValueInternalArray(); - ValueInternalArray( const ValueInternalArray &other ); - ValueInternalArray &operator =( const ValueInternalArray &other ); - ~ValueInternalArray(); - void swap( ValueInternalArray &other ); - - void clear(); - void resize( ArrayIndex newSize ); - - Value &resolveReference( ArrayIndex index ); - - Value *find( ArrayIndex index ) const; - - ArrayIndex size() const; - - int compare( const ValueInternalArray &other ) const; - - private: - static bool equals( const IteratorState &x, const IteratorState &other ); - static void increment( IteratorState &iterator ); - static void decrement( IteratorState &iterator ); - static Value &dereference( const IteratorState &iterator ); - static Value &unsafeDereference( const IteratorState &iterator ); - static int distance( const IteratorState &x, const IteratorState &y ); - static ArrayIndex indexOf( const IteratorState &iterator ); - void makeBeginIterator( IteratorState &it ) const; - void makeEndIterator( IteratorState &it ) const; - void makeIterator( IteratorState &it, ArrayIndex index ) const; - - void makeIndexValid( ArrayIndex index ); - - Value **pages_; - ArrayIndex size_; - PageIndex pageCount_; - }; - - /** \brief Experimental: do not use. Allocator to customize Value internal array. - * Below is an example of a simple implementation (actual implementation use - * memory pool). - \code -class DefaultValueArrayAllocator : public ValueArrayAllocator -{ -public: // overridden from ValueArrayAllocator - virtual ~DefaultValueArrayAllocator() - { - } - - virtual ValueInternalArray *newArray() - { - return new ValueInternalArray(); - } - - virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) - { - return new ValueInternalArray( other ); - } - - virtual void destruct( ValueInternalArray *array ) - { - delete array; - } - - virtual void reallocateArrayPageIndex( Value **&indexes, - ValueInternalArray::PageIndex &indexCount, - ValueInternalArray::PageIndex minNewIndexCount ) - { - ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1; - if ( minNewIndexCount > newIndexCount ) - newIndexCount = minNewIndexCount; - void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount ); - if ( !newIndexes ) - throw std::bad_alloc(); - indexCount = newIndexCount; - indexes = static_cast( newIndexes ); - } - virtual void releaseArrayPageIndex( Value **indexes, - ValueInternalArray::PageIndex indexCount ) - { - if ( indexes ) - free( indexes ); - } - - virtual Value *allocateArrayPage() - { - return static_cast( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) ); - } - - virtual void releaseArrayPage( Value *value ) - { - if ( value ) - free( value ); - } -}; - \endcode - */ - class JSON_API ValueArrayAllocator - { - public: - virtual ~ValueArrayAllocator(); - virtual ValueInternalArray *newArray() = 0; - virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0; - virtual void destructArray( ValueInternalArray *array ) = 0; - /** \brief Reallocate array page index. - * Reallocates an array of pointer on each page. - * \param indexes [input] pointer on the current index. May be \c NULL. - * [output] pointer on the new index of at least - * \a minNewIndexCount pages. - * \param indexCount [input] current number of pages in the index. - * [output] number of page the reallocated index can handle. - * \b MUST be >= \a minNewIndexCount. - * \param minNewIndexCount Minimum number of page the new index must be able to - * handle. - */ - virtual void reallocateArrayPageIndex( Value **&indexes, - ValueInternalArray::PageIndex &indexCount, - ValueInternalArray::PageIndex minNewIndexCount ) = 0; - virtual void releaseArrayPageIndex( Value **indexes, - ValueInternalArray::PageIndex indexCount ) = 0; - virtual Value *allocateArrayPage() = 0; - virtual void releaseArrayPage( Value *value ) = 0; - }; -#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP - - - /** \brief base class for Value iterators. - * - */ - class ValueIteratorBase - { - public: - typedef unsigned int size_t; - typedef int difference_type; - typedef ValueIteratorBase SelfType; - - ValueIteratorBase(); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - explicit ValueIteratorBase( const Value::ObjectValues::iterator ¤t ); -#else - ValueIteratorBase( const ValueInternalArray::IteratorState &state ); - ValueIteratorBase( const ValueInternalMap::IteratorState &state ); -#endif - - bool operator ==( const SelfType &other ) const - { - return isEqual( other ); - } - - bool operator !=( const SelfType &other ) const - { - return !isEqual( other ); - } - - difference_type operator -( const SelfType &other ) const - { - return computeDistance( other ); - } - - /// Return either the index or the member name of the referenced value as a Value. - Value key() const; - - /// Return the index of the referenced Value. -1 if it is not an arrayValue. - UInt index() const; - - /// Return the member name of the referenced Value. "" if it is not an objectValue. - const char *memberName() const; - - protected: - Value &deref() const; - - void increment(); - - void decrement(); - - difference_type computeDistance( const SelfType &other ) const; - - bool isEqual( const SelfType &other ) const; - - void copy( const SelfType &other ); - - private: -#ifndef JSON_VALUE_USE_INTERNAL_MAP - Value::ObjectValues::iterator current_; - // Indicates that iterator is for a null value. - bool isNull_; -#else - union - { - ValueInternalArray::IteratorState array_; - ValueInternalMap::IteratorState map_; - } iterator_; - bool isArray_; -#endif - }; - - /** \brief const iterator for object and array value. - * - */ - class ValueConstIterator : public ValueIteratorBase - { - friend class Value; - public: - typedef unsigned int size_t; - typedef int difference_type; - typedef const Value &reference; - typedef const Value *pointer; - typedef ValueConstIterator SelfType; - - ValueConstIterator(); - private: - /*! \internal Use by Value to create an iterator. - */ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - explicit ValueConstIterator( const Value::ObjectValues::iterator ¤t ); -#else - ValueConstIterator( const ValueInternalArray::IteratorState &state ); - ValueConstIterator( const ValueInternalMap::IteratorState &state ); -#endif - public: - SelfType &operator =( const ValueIteratorBase &other ); - - SelfType operator++( int ) - { - SelfType temp( *this ); - ++*this; - return temp; - } - - SelfType operator--( int ) - { - SelfType temp( *this ); - --*this; - return temp; - } - - SelfType &operator--() - { - decrement(); - return *this; - } - - SelfType &operator++() - { - increment(); - return *this; - } - - reference operator *() const - { - return deref(); - } - }; - - - /** \brief Iterator for object and array value. - */ - class ValueIterator : public ValueIteratorBase - { - friend class Value; - public: - typedef unsigned int size_t; - typedef int difference_type; - typedef Value &reference; - typedef Value *pointer; - typedef ValueIterator SelfType; - - ValueIterator(); - ValueIterator( const ValueConstIterator &other ); - ValueIterator( const ValueIterator &other ); - private: - /*! \internal Use by Value to create an iterator. - */ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - explicit ValueIterator( const Value::ObjectValues::iterator ¤t ); -#else - ValueIterator( const ValueInternalArray::IteratorState &state ); - ValueIterator( const ValueInternalMap::IteratorState &state ); -#endif - public: - - SelfType &operator =( const SelfType &other ); - - SelfType operator++( int ) - { - SelfType temp( *this ); - ++*this; - return temp; - } - - SelfType operator--( int ) - { - SelfType temp( *this ); - --*this; - return temp; - } - - SelfType &operator--() - { - decrement(); - return *this; - } - - SelfType &operator++() - { - increment(); - return *this; - } - - reference operator *() const - { - return deref(); - } - }; - - -} // namespace Json - - -#endif // CPPTL_JSON_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/value.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/reader.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_READER_H_INCLUDED -# define CPPTL_JSON_READER_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -# include "features.h" -# include "value.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -# include -# include -# include -# include - -namespace Json { - - /** \brief Unserialize a JSON document into a Value. - * - */ - class JSON_API Reader - { - public: - typedef char Char; - typedef const Char *Location; - - /** \brief Constructs a Reader allowing all features - * for parsing. - */ - Reader(); - - /** \brief Constructs a Reader allowing the specified feature set - * for parsing. - */ - Reader( const Features &features ); - - /** \brief Read a Value from a JSON document. - * \param document UTF-8 encoded string containing the document to read. - * \param root [out] Contains the root value of the document if it was - * successfully parsed. - * \param collectComments \c true to collect comment and allow writing them back during - * serialization, \c false to discard comments. - * This parameter is ignored if Features::allowComments_ - * is \c false. - * \return \c true if the document was successfully parsed, \c false if an error occurred. - */ - bool parse( const std::string &document, - Value &root, - bool collectComments = true ); - - /** \brief Read a Value from a JSON document. - * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the document to read. - * \param endDoc Pointer on the end of the UTF-8 encoded string of the document to read. - \ Must be >= beginDoc. - * \param root [out] Contains the root value of the document if it was - * successfully parsed. - * \param collectComments \c true to collect comment and allow writing them back during - * serialization, \c false to discard comments. - * This parameter is ignored if Features::allowComments_ - * is \c false. - * \return \c true if the document was successfully parsed, \c false if an error occurred. - */ - bool parse( const char *beginDoc, const char *endDoc, - Value &root, - bool collectComments = true ); - - /// \brief Parse from input stream. - /// \see Json::operator>>(std::istream&, Json::Value&). - bool parse( std::istream &is, - Value &root, - bool collectComments = true ); - - /** \brief Returns a user friendly string that list errors in the parsed document. - * \return Formatted error message with the list of errors with their location in - * the parsed document. An empty string is returned if no error occurred - * during parsing. - * \deprecated Use getFormattedErrorMessages() instead (typo fix). - */ - JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead") - std::string getFormatedErrorMessages() const; - - /** \brief Returns a user friendly string that list errors in the parsed document. - * \return Formatted error message with the list of errors with their location in - * the parsed document. An empty string is returned if no error occurred - * during parsing. - */ - std::string getFormattedErrorMessages() const; - - private: - enum TokenType - { - tokenEndOfStream = 0, - tokenObjectBegin, - tokenObjectEnd, - tokenArrayBegin, - tokenArrayEnd, - tokenString, - tokenNumber, - tokenTrue, - tokenFalse, - tokenNull, - tokenArraySeparator, - tokenMemberSeparator, - tokenComment, - tokenError - }; - - class Token - { - public: - TokenType type_; - Location start_; - Location end_; - }; - - class ErrorInfo - { - public: - Token token_; - std::string message_; - Location extra_; - }; - - typedef std::deque Errors; - - bool expectToken( TokenType type, Token &token, const char *message ); - bool readToken( Token &token ); - void skipSpaces(); - bool match( Location pattern, - int patternLength ); - bool readComment(); - bool readCStyleComment(); - bool readCppStyleComment(); - bool readString(); - void readNumber(); - bool readValue(); - bool readObject( Token &token ); - bool readArray( Token &token ); - bool decodeNumber( Token &token ); - bool decodeString( Token &token ); - bool decodeString( Token &token, std::string &decoded ); - bool decodeDouble( Token &token ); - bool decodeUnicodeCodePoint( Token &token, - Location ¤t, - Location end, - unsigned int &unicode ); - bool decodeUnicodeEscapeSequence( Token &token, - Location ¤t, - Location end, - unsigned int &unicode ); - bool addError( const std::string &message, - Token &token, - Location extra = 0 ); - bool recoverFromError( TokenType skipUntilToken ); - bool addErrorAndRecover( const std::string &message, - Token &token, - TokenType skipUntilToken ); - void skipUntilSpace(); - Value ¤tValue(); - Char getNextChar(); - void getLocationLineAndColumn( Location location, - int &line, - int &column ) const; - std::string getLocationLineAndColumn( Location location ) const; - void addComment( Location begin, - Location end, - CommentPlacement placement ); - void skipCommentTokens( Token &token ); - - typedef std::stack Nodes; - Nodes nodes_; - Errors errors_; - std::string document_; - Location begin_; - Location end_; - Location current_; - Location lastValueEnd_; - Value *lastValue_; - std::string commentsBefore_; - Features features_; - bool collectComments_; - }; - - /** \brief Read from 'sin' into 'root'. - - Always keep comments from the input JSON. - - This can be used to read a file into a particular sub-object. - For example: - \code - Json::Value root; - cin >> root["dir"]["file"]; - cout << root; - \endcode - Result: - \verbatim - { - "dir": { - "file": { - // The input stream JSON would be nested here. - } - } - } - \endverbatim - \throw std::exception on parse error. - \see Json::operator<<() - */ - std::istream& operator>>( std::istream&, Value& ); - -} // namespace Json - -#endif // CPPTL_JSON_READER_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/reader.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/writer.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_WRITER_H_INCLUDED -# define JSON_WRITER_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -# include "value.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -# include -# include -# include - -namespace Json { - - class Value; - - /** \brief Abstract class for writers. - */ - class JSON_API Writer - { - public: - virtual ~Writer(); - - virtual std::string write( const Value &root ) = 0; - }; - - /** \brief Outputs a Value in JSON format without formatting (not human friendly). - * - * The JSON document is written in a single line. It is not intended for 'human' consumption, - * but may be usefull to support feature such as RPC where bandwith is limited. - * \sa Reader, Value - */ - class JSON_API FastWriter : public Writer - { - public: - FastWriter(); - virtual ~FastWriter(){} - - void enableYAMLCompatibility(); - - public: // overridden from Writer - virtual std::string write( const Value &root ); - - private: - void writeValue( const Value &value ); - - std::string document_; - bool yamlCompatiblityEnabled_; - }; - - /** \brief Writes a Value in JSON format in a human friendly way. - * - * The rules for line break and indent are as follow: - * - Object value: - * - if empty then print {} without indent and line break - * - if not empty the print '{', line break & indent, print one value per line - * and then unindent and line break and print '}'. - * - Array value: - * - if empty then print [] without indent and line break - * - if the array contains no object value, empty array or some other value types, - * and all the values fit on one lines, then print the array on a single line. - * - otherwise, it the values do not fit on one line, or the array contains - * object or non empty array, then print one value per line. - * - * If the Value have comments then they are outputed according to their #CommentPlacement. - * - * \sa Reader, Value, Value::setComment() - */ - class JSON_API StyledWriter: public Writer - { - public: - StyledWriter(); - virtual ~StyledWriter(){} - - public: // overridden from Writer - /** \brief Serialize a Value in JSON format. - * \param root Value to serialize. - * \return String containing the JSON document that represents the root value. - */ - virtual std::string write( const Value &root ); - - private: - void writeValue( const Value &value ); - void writeArrayValue( const Value &value ); - bool isMultineArray( const Value &value ); - void pushValue( const std::string &value ); - void writeIndent(); - void writeWithIndent( const std::string &value ); - void indent(); - void unindent(); - void writeCommentBeforeValue( const Value &root ); - void writeCommentAfterValueOnSameLine( const Value &root ); - bool hasCommentForValue( const Value &value ); - static std::string normalizeEOL( const std::string &text ); - - typedef std::vector ChildValues; - - ChildValues childValues_; - std::string document_; - std::string indentString_; - int rightMargin_; - int indentSize_; - bool addChildValues_; - }; - - /** \brief Writes a Value in JSON format in a human friendly way, - to a stream rather than to a string. - * - * The rules for line break and indent are as follow: - * - Object value: - * - if empty then print {} without indent and line break - * - if not empty the print '{', line break & indent, print one value per line - * and then unindent and line break and print '}'. - * - Array value: - * - if empty then print [] without indent and line break - * - if the array contains no object value, empty array or some other value types, - * and all the values fit on one lines, then print the array on a single line. - * - otherwise, it the values do not fit on one line, or the array contains - * object or non empty array, then print one value per line. - * - * If the Value have comments then they are outputed according to their #CommentPlacement. - * - * \param indentation Each level will be indented by this amount extra. - * \sa Reader, Value, Value::setComment() - */ - class JSON_API StyledStreamWriter - { - public: - StyledStreamWriter( std::string indentation="\t" ); - ~StyledStreamWriter(){} - - public: - /** \brief Serialize a Value in JSON format. - * \param out Stream to write to. (Can be ostringstream, e.g.) - * \param root Value to serialize. - * \note There is no point in deriving from Writer, since write() should not return a value. - */ - void write( std::ostream &out, const Value &root ); - - private: - void writeValue( const Value &value ); - void writeArrayValue( const Value &value ); - bool isMultineArray( const Value &value ); - void pushValue( const std::string &value ); - void writeIndent(); - void writeWithIndent( const std::string &value ); - void indent(); - void unindent(); - void writeCommentBeforeValue( const Value &root ); - void writeCommentAfterValueOnSameLine( const Value &root ); - bool hasCommentForValue( const Value &value ); - static std::string normalizeEOL( const std::string &text ); - - typedef std::vector ChildValues; - - ChildValues childValues_; - std::ostream* document_; - std::string indentString_; - int rightMargin_; - std::string indentation_; - bool addChildValues_; - }; - -# if defined(JSON_HAS_INT64) - std::string JSON_API valueToString( Int value ); - std::string JSON_API valueToString( UInt value ); -# endif // if defined(JSON_HAS_INT64) - std::string JSON_API valueToString( LargestInt value ); - std::string JSON_API valueToString( LargestUInt value ); - std::string JSON_API valueToString( double value ); - std::string JSON_API valueToString( bool value ); - std::string JSON_API valueToQuotedString( const char *value ); - - /// \brief Output using the StyledStreamWriter. - /// \see Json::operator>>() - std::ostream& operator<<( std::ostream&, const Value &root ); - -} // namespace Json - - - -#endif // JSON_WRITER_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/writer.h -// ////////////////////////////////////////////////////////////////////// - - - - - -#endif //ifndef JSON_AMALGATED_H_INCLUDED diff --git a/src/modifiedJellyfish/include/jellyfish/large_hash_array.hpp b/src/modifiedJellyfish/include/jellyfish/large_hash_array.hpp deleted file mode 100644 index 2a49c9f5..00000000 --- a/src/modifiedJellyfish/include/jellyfish/large_hash_array.hpp +++ /dev/null @@ -1,994 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_LARGE_HASH_ARRAY_HPP__ -#define __JELLYFISH_LARGE_HASH_ARRAY_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace jellyfish { namespace large_hash { -/* Contains an integer, the reprobe limit. It is capped based on the - * reprobe strategy to not be bigger than the size of the hash - * array. Also, the length to encode reprobe limit must not be larger - * than the length to encode _size. - */ -class reprobe_limit_t { - uint_t limit; -public: - reprobe_limit_t(uint_t _limit, const size_t *_reprobes, size_t _size) : - limit(_limit) - { - while(_reprobes[limit] >= _size && limit >= 1) - limit--; - } - inline uint_t val() const { return limit; } -}; - -// Key is any type with the following two methods: get_bits(unsigned -// int start, unsigned int len); and set_bits(unsigned int start, -// unsigned int len, uint64_t bits). These methods get and set the -// bits [start, start + len). Start and len may not be aligned to word -// boundaries. On the other hand, len is guaranteed to be < -// sizeof(uint64_t). I.e. never more than 1 word is fetched or set. -template -class array_base { - static const int wsize = std::numeric_limits::digits; // Word size in bits - // Can't be done. Resort to an evil macro! - // static const word fmask = std::numeric_limits::max(); // Mask full of ones -#define fmask (std::numeric_limits::max()) - -public: - define_error_class(ErrorAllocation); - - typedef word data_word; - typedef typename Offsets::offset_t offset_t; - typedef struct offset_t::key key_offsets; - typedef struct offset_t::val val_offsets; - - typedef Key key_type; - typedef uint64_t mapped_type; - typedef std::pair value_type; - typedef stl_iterator_base iterator; - typedef stl_iterator_base const_iterator; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* pointer; - typedef const value_type* const_pointer; - - typedef eager_iterator_base eager_iterator; - typedef lazy_iterator_base lazy_iterator; - typedef region_iterator_base region_iterator; - - /// Status of a (key,value) pair. LBSET means that the large bit is - /// set. Hence, it contains a pointer back to the original key and a - /// large value. - enum key_status { FILLED, EMPTY, LBSET}; - -protected: - uint16_t lsize_; // log of size - size_t size_, size_mask_; - reprobe_limit_t reprobe_limit_; - uint16_t key_len_; // Length of key in bits - uint16_t raw_key_len_; // Length of key stored raw (i.e. complement of implied length) - Offsets offsets_; // key len reduced by size of hash array - size_t size_bytes_; - word * const data_; - atomic_t atomic_; - const size_t *reprobes_; - RectangularBinaryMatrix hash_matrix_; - RectangularBinaryMatrix hash_inverse_matrix_; - -public: - /// Give information about memory usage and array size. - struct usage_info { - uint16_t key_len_, val_len_, reprobe_limit_; - const size_t* reprobes_; - - usage_info(uint16_t key_len, uint16_t val_len, uint16_t reprobe_limit, - const size_t* reprobes = jellyfish::quadratic_reprobes) : - key_len_(key_len), val_len_(val_len), reprobe_limit_(reprobe_limit), reprobes_(reprobes) { } - - /// Memory usage for a given size. - size_t mem(size_t size) { - uint16_t lsize(ceilLog2(size)); - size_t asize((size_t)1 << lsize); - reprobe_limit_t areprobe_limit(reprobe_limit_, reprobes_, asize); - uint16_t raw_key_len(key_len_ > lsize ? key_len_ - lsize : 0); - Offsets offsets(raw_key_len + bitsize(areprobe_limit.val() + 1), val_len_, - areprobe_limit.val() + 1); - return div_ceil(asize, - (size_t)offsets.block_len()) * offsets.block_word_len() * sizeof(word) + sizeof(array_base) + sizeof(Offsets); - } - - /// Actual size for a given size. - size_t asize(size_t size) { return (size_t)1 << ceilLog2(size); } - - struct fit_in { - usage_info* i_; - size_t mem_; - fit_in(usage_info* i, size_t mem) : i_(i), mem_(mem) { } - bool operator()(uint16_t size_bits) const { return i_->mem((size_t)1 << size_bits) < mem_; } - }; - - /// Maximum size for a given maximum memory. - size_t size(size_t mem) { return (size_t)1 << size_bits(mem); } - - /// Log of maximum size for a given maximum memory - uint16_t size_bits(size_t mem) { - uint16_t res = *binary_search_first_false(pointer_integer(0), pointer_integer(64), - fit_in(this, mem)); - return res > 0 ? res - 1 : 0; - } - - size_t size_bits_linear(size_t mem) { - fit_in predicate(this, mem); - uint16_t i = 0; - for( ; i < 64; ++i) - if(!predicate(i)) - break; - - return i > 0 ? i - 1 : 0; - } - - }; - - - array_base(size_t size, // Size of hash. To be rounded up to a power of 2 - uint16_t key_len, // Size of key in bits - uint16_t val_len, // Size of val in bits - uint16_t reprobe_limit, // Maximum reprobe - RectangularBinaryMatrix m, - const size_t* reprobes = quadratic_reprobes) : // Reprobing policy - lsize_(ceilLog2(size)), - size_((size_t)1 << lsize_), - size_mask_(size_ - 1), - reprobe_limit_(reprobe_limit, reprobes, size_), - key_len_(key_len), - raw_key_len_(key_len_ > lsize_ ? key_len_ - lsize_ : 0), - offsets_(raw_key_len_ + bitsize(reprobe_limit_.val() + 1), val_len, reprobe_limit_.val() + 1), - size_bytes_(div_ceil(size_, (size_t)offsets_.block_len()) * offsets_.block_word_len() * sizeof(word)), - data_(static_cast(this)->alloc_data(size_bytes_)), - reprobes_(reprobes), - hash_matrix_(m), - hash_inverse_matrix_(hash_matrix_.pseudo_inverse()) - { - if(!data_) - throw ErrorAllocation(err::msg() << "Failed to allocate " - << (div_ceil(size, (size_t)offsets_.block_len()) * offsets_.block_word_len() * sizeof(word)) - << " bytes of memory"); - } - - array_base(array_base&& ary) : - lsize_(ary.lsize_), - size_(ary.size_), - size_mask_(size_ - 1), - reprobe_limit_(ary.reprobe_limit_), - key_len_(ary.key_len_), - raw_key_len_(ary.raw_key_len_), - offsets_(std::move(ary.offsets_)), - size_bytes_(ary.size_bytes_), - data_(ary.data_), - reprobes_(ary.reprobes_), - hash_matrix_(std::move(ary.hash_matrix_)), - hash_inverse_matrix_(std::move(ary.hash_inverse_matrix_)) - { } - - array_base& operator=(const array_base& rhs) = delete; - array_base& operator=(array_base&& rhs) = delete; - - size_t size() const { return size_; } - size_t lsize() const { return lsize_; } - size_t size_mask() const { return size_mask_; } - uint_t key_len() const { return key_len_; } - uint_t val_len() const { return offsets_.val_len(); } - - const size_t* reprobes() const { return reprobes_; } - uint_t max_reprobe() const { return reprobe_limit_.val(); } - size_t max_reprobe_offset() const { return reprobes_[reprobe_limit_.val()]; } - - const RectangularBinaryMatrix& matrix() const { return hash_matrix_; } - const RectangularBinaryMatrix& inverse_matrix() const { return hash_inverse_matrix_; } - void matrix(const RectangularBinaryMatrix& m) { - hash_inverse_matrix_ = m.pseudo_inverse(); - hash_matrix_ = m; - } - - /** - * Clear hash table. Not thread safe. - */ - void clear() { - memset(data_, '\0', size_bytes_); - } - - /** - * Write the hash table raw to a stream. Not thread safe. - */ - void write(std::ostream& os) const { - os.write((const char*)data_, size_bytes_); - } - - size_t size_bytes() const { return size_bytes_; } - - /* The storage of the hash is organized in "blocks". A (key,value) - * pair always start at bit 0 of the block. The following methods - * work with the blocks of the hash. - */ - - /** - * Number of blocks needed to fit at least a given number of - * records. Given a number of records, it returns the number of - * blocks necessary and the actual number of records these blocks - * contain. - */ - std::pair blocks_for_records(size_t nb_records) const { - return offsets_.blocks_for_records(nb_records); - } - - - /** - * Convert coordinate from (start, blen) given in blocks to - * coordinate in char* and length in bytes. It also makes sure that - * the pointer and length returned do not go beyond allocated - * memory. - */ - void block_to_ptr(const size_t start, const size_t blen, - char **start_ptr, size_t *memlen) const { - *start_ptr = (char *)(data_ + start * offsets_.block_word_len()); - char *end_ptr = (char *)data_ + size_bytes_; - - if(*start_ptr >= end_ptr) { - *memlen = 0; - return; - } - *memlen = blen * offsets_.block_word_len() * sizeof(word); - if(*start_ptr + *memlen > end_ptr) - *memlen = end_ptr - *start_ptr; - } - - /** - * Zero out blocks in [start, start+length), where start and - * length are given in number of blocks. - **/ - void zero_blocks(const size_t start, const size_t length) { - char *start_ptr; - size_t memlen; - block_to_ptr(start, length, &start_ptr, &memlen); - memset(start_ptr, '\0', memlen); - } - - - /** - * Use hash values as counters. - * - * The matrix multiplication gets only a uint64_t. The lsb of the - * matrix product, the hsb are assume to be equal to the key itself - * (the matrix has a partial identity on the first rows). - * - * In case of failure (false is returned), carry_shift contains the - * number of bits of the value that were successfully stored in the - * hash (low significant bits). If carry_shift == 0, then nothing - * was stored and the key is not in the hash at all. In that case, - * the value of *is_new and *id are not valid. If carry_shift > 0, - * then the key is present but the value stored is not correct - * (missing the high significant bits of value), but *is_new and *id - * contain the proper information. - */ - inline bool add(const key_type& key, mapped_type val, unsigned int* carry_shift, bool* is_new, size_t* id) { - uint64_t hash = hash_matrix_.times(key); - *carry_shift = 0; - return add_rec(hash & size_mask_, key, val, false, is_new, id, carry_shift); - } - - inline bool add(const key_type& key, mapped_type val, unsigned int* carry_shift) { - bool is_new = false; - size_t id = 0; - return add(key, val, carry_shift, &is_new, &id); - } - - inline bool add(const key_type& key, mapped_type val) { - unsigned int carry_shift = 0; - return add(key, val, &carry_shift); - } - - inline bool set(const key_type& key) { - bool is_new; - size_t id; - return set(key, &is_new, &id); - } - bool set(const key_type& key, bool* is_new, size_t* id) { - word* w; - const offset_t* o; - - *id = hash_matrix_.times(key) & size_mask_; - return claim_key(key, is_new, id, &o, &w); - } - - /** - * Use hash values as counters, if already exists - * - * Add val to the value associated with key if key is already in the - * hash. Returns true if the update was done, false otherwise. - */ - inline bool update_add(const key_type& key, mapped_type val) { - key_type tmp_key; - unsigned int carry_shift; - return update_add(key, val, &carry_shift, tmp_key); - } - - - // Optimization. Use tmp_key as buffer. Avoids allocation if update_add is called repeatedly. - bool update_add(const key_type& key, mapped_type val, unsigned int* carry_shift, key_type& tmp_key) { - size_t id; - word* w; - const offset_t* o; - *carry_shift = 0; - - if(get_key_id(key, &id, tmp_key, (const word**)&w, &o)) - return add_rec_at(id, key, val, o, w, carry_shift); - return false; - } - - // Get the value, stored in *val, associated with key. If the key is - // not found, false is returned, otherwise true is returned and *val - // is updated. If carry_bit is true, then the first bit of the key - // field indicates whether we should reprobe to get the complete - // value. - inline bool get_val_for_key(const key_type& key, mapped_type* val, bool carry_bit = false) const { - key_type tmp_key; - size_t id; - return get_val_for_key(key, val, tmp_key, &id, carry_bit); - } - - // Optimization version. A tmp_key buffer is passed and the id where - // the key was found is return in *id. If get_val_for_key is called - // many times consecutively, it may be faster to pass the same - // tmp_key buffer instead of allocating it every time. - bool get_val_for_key(const key_type& key, mapped_type* val, key_type& tmp_key, - size_t* id, bool carry_bit = false) const { - const word* w; - const offset_t* o; - if(!get_key_id(key, id, tmp_key, &w, &o)) - return false; - *val = get_val_at_id(*id, w, o, true, carry_bit); - return true; - } - - // Return true if the key is present in the hash - inline bool has_key(const key_type& key) const { - size_t id; - return get_key_id(key, &id); - } - - // Get the id of the key in the hash. Returns true if the key is - // found in the hash, false otherwise. - inline bool get_key_id(const key_type& key, size_t* id) const { - key_type tmp_key; - const word* w; - const offset_t* o; - return get_key_id(key, id, tmp_key, &w, &o); - } - - // Optimization version where a tmp_key buffer is provided instead - // of being allocated. May be faster if many calls to get_key_id are - // made consecutively by passing the same tmp_key each time. - inline bool get_key_id(const key_type& key, size_t* id, key_type& tmp_key) const { - const word* w; - const offset_t* o; - return get_key_id(key, id, tmp_key, &w, &o); - } - -protected: - // Information and methods to manage the prefetched data. - struct prefetch_info { - size_t id; - const word* w; - const offset_t *o, *lo; - }; - typedef simple_circular_buffer::pre_alloc prefetch_buffer; - - void warm_up_cache(prefetch_buffer& buffer, size_t oid) const { - buffer.clear(); - for(int i = 0; i < buffer.capacity(); ++i) { - buffer.push_back(); - prefetch_info& info = buffer.back(); - info.id = (oid + (i > 0 ? reprobes_[i] : 0)) & size_mask_; - info.w = offsets_.word_offset(info.id, &info.o, &info.lo, data_); - __builtin_prefetch(info.w + info.o->key.woff, 0, 1); - __builtin_prefetch(info.o, 0, 3); - } - } - - void prefetch_next(prefetch_buffer& buffer, size_t oid, uint_t reprobe) const { - buffer.pop_front(); - // if(reprobe + buffer.capacity() <= reprobe_limit_.val()) { - buffer.push_back(); - prefetch_info& info = buffer.back(); - info.id = (oid + reprobes_[reprobe + buffer.capacity() - 1]) & size_mask_; - info.w = offsets_.word_offset(info.id, &info.o, &info.lo, data_); - __builtin_prefetch(info.w + info.o->key.woff, 0, 1); - __builtin_prefetch(info.o, 0, 3); - // } - } - -public: - // Optimization version again. Also return the word and the offset - // information where the key was found. These can be used later one - // to fetch the value associated with the key. - inline bool get_key_id(const key_type& key, size_t* id, key_type& tmp_key, const word** w, const offset_t** o) const { - return get_key_id(key, id, tmp_key, w, o, hash_matrix_.times(key) & size_mask_); - } - - // Find the actual id of the key in the hash, starting at oid. - bool get_key_id(const key_type& key, size_t* id, key_type& tmp_key, const word** w, const offset_t** o, const size_t oid) const { - // This static_assert makes clang++ happy - static_assert(std::is_pod::value, "prefetch_info must be a POD"); - prefetch_info info_ary[prefetch_buffer::capacityConstant]; - prefetch_buffer buffer(info_ary); - warm_up_cache(buffer, oid); - - for(uint_t reprobe = 0; reprobe <= reprobe_limit_.val(); ++reprobe) { - prefetch_info& info = buffer.front(); - key_status st = get_key_at_id(info.id, tmp_key, info.w, info.o); - - switch(st) { - case EMPTY: - return false; - case FILLED: - if(oid != tmp_key.get_bits(0, lsize_)) - break; - tmp_key.template set_bits(0, lsize_, key.get_bits(0, lsize_)); - if(tmp_key != key) - break; - *id = info.id; - *w = info.w; - *o = info.o; - return true; - default: - break; - } - - prefetch_next(buffer, oid, reprobe + 1); - } // for - - return false; - } - - ////////////////////////////// - // Iterator - ////////////////////////////// - const_iterator begin() { return const_iterator(this); } - const_iterator begin() const { return const_iterator(this); } - const_iterator end() { return const_iterator(); } - const_iterator end() const { return const_iterator(); } - -/// Get a slice of an array as an iterator - template - Iterator iterator_slice(size_t index, size_t nb_slices) const { - std::pair res = slice(index, nb_slices, size()); - return Iterator(this, res.first, res.second); - } - - template - Iterator iterator_all() const { return iterator_slice(0, 1); } - - // See hash_counter.hpp for why we added this method. It should not - // be needed, but I can't get the thing to compile without :(. - eager_iterator eager_slice(size_t index, size_t nb_slices) const { - return iterator_slice(index, nb_slices); - } - region_iterator region_slice(size_t index, size_t nb_slices) const { - return iterator_slice(index, nb_slices); - } - - // Claim a key with the large bit not set. I.e. first entry for a key. - // - // id is input/output. Equal to hash & size_maks on input. Equal to - // actual id where key was set on output. key is already hash - // shifted and masked to get higher bits. (>> lsize & key_mask) - // is_new is set on output to true if key did not exists in hash - // before. *ao points to the actual offsets object and w to the word - // holding the value. - bool claim_key(const key_type& key, bool* is_new, size_t* id, const offset_t** _ao, word** _w) { - uint_t reprobe = 0; - const offset_t *o, *lo; - word *w, *kw, nkey; - bool key_claimed = false; - size_t cid = *id; - - // Akey contains first word of what to store in the key - // field. I.e. part of the original key (the rest is encoded in - // the original position) and the reprobe value to substract from - // the actual position to get to the original position. - // - // MSB LSB - // +--------------+-------------+ - // | MSB of key | reprobe | - // + -------------+-------------+ - // raw_key_len reprobe_len - // - // Akey is updated at every operation to reflect the current - // reprobe value. nkey is the temporary word containing the part - // to be stored in the current word kw (+ some offset). - word akey = 1; // start reprobe value == 0. Store reprobe value + 1 - const int to_copy = std::min((uint16_t)(wsize - offsets_.reprobe_len()), raw_key_len_); - const int implied_copy = std::min(key_len_, lsize_); - akey |= key.get_bits(implied_copy, to_copy) << offsets_.reprobe_len(); - const int abits_copied = implied_copy + to_copy; // Bits from original key already copied, explicitly or implicitly - - do { - int bits_copied = abits_copied; - - w = offsets_.word_offset(cid, &o, &lo, data_); - kw = w + o->key.woff; - - if(o->key.sb_mask1) { // key split on multiple words - nkey = akey << o->key.boff; - nkey |= o->key.sb_mask1; - nkey &= o->key.mask1; - - key_claimed = set_key(kw, nkey, o->key.mask1, o->key.mask1, is_new); - if(key_claimed) { - nkey = akey >> o->key.shift; - if(o->key.full_words) { - // Copy full words. First one is special - nkey |= key.get_bits(bits_copied, o->key.shift - 1) << (wsize - o->key.shift); - bits_copied += o->key.shift - 1; - nkey |= o->key.sb_mask1; // Set bit is MSB - int copied_full_words = 1; - key_claimed = set_key(kw + copied_full_words, nkey, fmask, fmask, is_new); - // Copy more full words if needed - while(bits_copied + wsize - 1 <= key_len_ && key_claimed) { - nkey = key.get_bits(bits_copied, wsize - 1); - bits_copied += wsize - 1; - nkey |= o->key.sb_mask1; - copied_full_words += 1; - key_claimed = set_key(kw + copied_full_words, nkey, fmask, fmask, is_new); - } - assert(!key_claimed || (bits_copied < key_len_) == (o->key.sb_mask2 != 0)); - if(o->key.sb_mask2 && key_claimed) { // Copy last word - nkey = key.get_bits(bits_copied, key_len_ - bits_copied); - nkey |= o->key.sb_mask2; - copied_full_words += 1; - key_claimed = set_key(kw + copied_full_words, nkey, o->key.mask2, o->key.mask2, is_new); - } - } else if(o->key.sb_mask2) { // if bits_copied + wsize - 1 < key_len - // Copy last word, no full words copied - nkey |= key.get_bits(bits_copied, key_len_ - bits_copied) << (wsize - o->key.shift); - nkey |= o->key.sb_mask2; - nkey &= o->key.mask2; - key_claimed = set_key(kw + 1, nkey, o->key.mask2, o->key.mask2, is_new); - } - } // if(key_claimed) - } else { // key on one word - nkey = akey << o->key.boff; - nkey &= o->key.mask1; - key_claimed = set_key(kw, nkey, o->key.mask1, o->key.mask1, is_new); - } - if(!key_claimed) { // reprobe - if(++reprobe > reprobe_limit_.val()) - return false; - cid = (*id + reprobes_[reprobe]) & size_mask_; - akey = (akey & ~offsets_.reprobe_mask()) | (reprobe + 1); - } - } while(!key_claimed); - - *id = cid; - *_w = w; - *_ao = o; - return true; - } - - // Claim large key. Enter an entry for a key when it is not the - // first entry. Only encode the number of reprobe hops back to the - // first entry of the key in the hash table. It is simpler as can - // takes less than one word in length. - bool claim_large_key(size_t* id, const offset_t** _ao, word** _w) { - uint_t reprobe = 0; - size_t cid = *id; - const offset_t *o, *lo; - word *w, *kw, nkey; - bool key_claimed = false; - - do { - w = offsets_.word_offset(cid, &o, &lo, data_); - kw = w + lo->key.woff; - - if(lo->key.sb_mask1) { // key split on multiple words - nkey = (reprobe << lo->key.boff) | lo->key.sb_mask1 | lo->key.lb_mask; - nkey &= lo->key.mask1; - - // Use o->key.mask1 and not lo->key.mask1 as the first one is - // guaranteed to be bigger. The key needs to be free on its - // longer mask to claim it! - key_claimed = set_key(kw, nkey, o->key.mask1, lo->key.mask1); - if(key_claimed) { - nkey = (reprobe >> lo->key.shift) | lo->key.sb_mask2; - nkey &= lo->key.mask2; - key_claimed = set_key(kw + 1, nkey, o->key.full_words ? fmask : o->key.mask2, lo->key.mask2); - } - } else { // key on 1 word - nkey = (reprobe << lo->key.boff) | lo->key.lb_mask; - nkey &= lo->key.mask1; - key_claimed = set_key(kw, nkey, o->key.mask1, lo->key.mask1); - } - if(!key_claimed) { //reprobe - if(++reprobe > reprobe_limit_.val()) - return false; - cid = (*id + reprobes_[reprobe]) & size_mask_; - } - } while(!key_claimed); - - *id = cid; - *_w = w; - *_ao = lo; - return true; - } - - // Add val to key. id is the starting place (result of hash - // computation). eid is set to the effective place in the - // array. large is set to true is setting a large key (upon - // recurrence if there is a carry). - bool add_rec(size_t id, const key_type& key, word val, bool large, bool* is_new, size_t* eid, unsigned int* carry_shift) { - const offset_t *ao = 0; - word *w = 0; - - bool claimed = false; - if(large) - claimed = claim_large_key(&id, &ao, &w); - else - claimed = claim_key(key, is_new, &id, &ao, &w); - if(!claimed) - return false; - *eid = id; - return add_rec_at(id, key, val, ao, w, carry_shift); - } - - bool add_rec_at(size_t id, const key_type& key, word val, const offset_t* ao, word* w, unsigned int* carry_shift) { - // Increment value - word *vw = w + ao->val.woff; - word cary = add_val(vw, val, ao->val.boff, ao->val.mask1); - cary >>= ao->val.shift; - *carry_shift += ao->val.shift; - if(cary && ao->val.mask2) { // value split on two words - cary = add_val(vw + 1, cary, 0, ao->val.mask2); - cary >>= ao->val.cshift; - *carry_shift += ao->val.cshift; - } - if(!cary) - return true; - - id = (id + reprobes_[0]) & size_mask_; - size_t ignore_eid; - bool ignore_is_new; - return add_rec(id, key, cary, true, &ignore_is_new, &ignore_eid, carry_shift); - - // // Adding failed, table is full. Need to back-track and - // // substract val. - // std::cerr << "Failed to add large part of value -> return false\n"; - // cary = add_val(vw, ((word)1 << offsets_.val_len()) - val, - // ao->val.boff, ao->val.mask1); - // cary >>= ao->val.shift; - // if(cary && ao->val.mask2) { - // // Can I ignore the cary here? Table is known to be full, so - // // not much of a choice. But does it leave the table in a - // // consistent state? - // add_val(vw + 1, cary, 0, ao->val.mask2); - // } - // return false; - } - - // Atomic methods to set the key. Attempt to set nkey in word w. All - // bits matching free_mask must be unset and the bits matching - // equal_mask must be equal for a success in setting the key. Set - // is_new to true if the spot was previously empty. Otherwise, if - // is_new is false but true is returned, the key was already present - // at that spot. - inline bool set_key(word *w, word nkey, word free_mask, word equal_mask, bool *is_new) { - word ow = *w, nw, okey; - - okey = ow & free_mask; - while(okey == 0) { // large bit not set && key is free - nw = atomic_.cas(w, ow, ow | nkey); - if(nw == ow) { - *is_new = true; - return true; - } - ow = nw; - okey = ow & free_mask; - } - *is_new = false; - return (ow & equal_mask) == nkey; - } - - inline bool set_key(word *w, word nkey, word free_mask, word equal_mask) { - bool is_new; - return set_key(w, nkey, free_mask, equal_mask, &is_new); - } - - // Add val the value in word w, with shift and mask giving the - // particular part of the word in which the value is stored. The - // return value is the carry. - inline word add_val(word *w, word val, uint_t shift, word mask) { - word now = *w, ow, nw, nval; - - do { - ow = now; - nval = ((ow & mask) >> shift) + val; - nw = (ow & ~mask) | ((nval << shift) & mask); - now = atomic_.cas(w, ow, nw); - } while(now != ow); - - return nval & (~(mask >> shift)); - } - - // Return the key and value at position id. If the slot at id is - // empty or has the large bit set, returns false. Otherwise, returns - // the key and the value is the sum of all the entries in the hash - // table for that key. I.e., the table is search forward for entries - // with large bit set pointing back to the key at id, and all those - // values are summed up. - key_status get_key_val_at_id(size_t id, key_type& key, word& val, const bool carry_bit = false) const { - const word* w; - const offset_t* o; - - key_status st = get_key_at_id(id, key, &w, &o); - if(st != FILLED) - return st; - - val = get_val_at_id(id, w, o, true, carry_bit); - - return FILLED; - } - - // Get a the key at the given id. It also returns the word and - // offset information in w and o. The return value is EMPTY (no key - // at id), FILLED (there is a key at id), LBSET (the large bit is - // set, hence the key is only a pointer back to the real key). - // - // The key returned contains the original id in the hash as its - // lsize_ lsb bits. To obtain the full key, one needs to compute the - // product with the inverse matrix to get the lsb bits. - inline key_status get_key_at_id(size_t id, key_type& key, const word** w, const offset_t** o) const { - const offset_t *lo; - *w = offsets_.word_offset(id, o, &lo, data_); - return get_key_at_id(id, key, *w, *o); - } - - // Sam as above, but it assume that the word w and o for id have - // already be computed (like already prefetched). - key_status get_key_at_id(size_t id, key_type&key, const word* w, const offset_t* o) const { - const word* kvw = w + o->key.woff; - word key_word = *kvw; - word kreprobe = 0; - - const key_offsets& key_o = o->key; - if(key_word & key_o.lb_mask) - return LBSET; - const int implied_copy = std::min(lsize_, key_len_); - int bits_copied = implied_copy; - if(key_o.sb_mask1) { - if((key_word & key_o.sb_mask1) == 0) - return EMPTY; - kreprobe = (key_word & key_o.mask1 & ~key_o.sb_mask1) >> key_o.boff; - if(key_o.full_words) { - // Copy full words. First one is special - key_word = *(kvw + 1); - if(offsets_.reprobe_len() < key_o.shift) { - key.set_bits(bits_copied, key_o.shift - offsets_.reprobe_len(), kreprobe >> offsets_.reprobe_len()); - bits_copied += key_o.shift - offsets_.reprobe_len(); - kreprobe &= offsets_.reprobe_mask(); - key.set_bits(bits_copied, wsize - 1, key_word & ~key_o.sb_mask1); - bits_copied += wsize - 1; - } else { - int reprobe_left = offsets_.reprobe_len() - key_o.shift; - kreprobe |= (key_word & (((word)1 << reprobe_left) - 1)) << key_o.shift; - key.set_bits(bits_copied, wsize - 1 - reprobe_left, (key_word & ~key_o.sb_mask1) >> reprobe_left); - bits_copied += wsize - 1 - reprobe_left; - } - int word_copied = 2; - while(bits_copied + wsize - 1 <= key_len_) { - key.set_bits(bits_copied, wsize - 1, *(kvw + word_copied++) & (fmask >> 1)); - bits_copied += wsize - 1; - } - if(key_o.sb_mask2) - key.set_bits(bits_copied, key_len_ - bits_copied, *(kvw + word_copied) & key_o.mask2 & ~key_o.sb_mask2); - } else if(key_o.sb_mask2) { // if(bits_copied + wsize - 1 < key_len - // Two words but no full words - key_word = *(kvw + 1) & key_o.mask2 & ~key_o.sb_mask2; - if(offsets_.reprobe_len() < key_o.shift) { - key.set_bits(bits_copied, key_o.shift - offsets_.reprobe_len(), kreprobe >> offsets_.reprobe_len()); - bits_copied += key_o.shift - offsets_.reprobe_len(); - kreprobe &= offsets_.reprobe_mask(); - key.set_bits(bits_copied, key_len_ - bits_copied, key_word); - } else { - int reprobe_left = offsets_.reprobe_len() - key_o.shift; - kreprobe |= (key_word & (((word)1 << reprobe_left) - 1)) << key_o.shift; - key.set_bits(bits_copied, key_len_ - bits_copied, key_word >> reprobe_left); - } - } - } else { // if(key_o.sb_mask1 - // Everything in 1 word - key_word = (key_word & key_o.mask1) >> key_o.boff; - if(key_word == 0) - return EMPTY; - kreprobe = key_word & offsets_.reprobe_mask(); - key.set_bits(bits_copied, raw_key_len_, key_word >> offsets_.reprobe_len()); - } - // Compute missing oid so that the original key can be computed - // back through the inverse matrix. Although the key may have a - // length of key_len_, which may be less than lsize_, assume that - // it still fit here as lsize_ is less than a word length. Need all lsize_. - size_t oid = id; // Original id - if(kreprobe > 1) - oid -= reprobes_[kreprobe - 1]; - oid &= size_mask_; - // Can use more bits than mer size. That's OK, will fix it later - // when computing the actual mers by computing the product with - // the inverse matrix. - key.template set_bits<0>(0, lsize_, oid); - - return FILLED; - } - - word get_val_at_id(const size_t id, const word* w, const offset_t* o, const bool reprobe = true, - const bool carry_bit = false) const { - word val = 0; - if(val_len() == 0) - return val; - - // First part of value - const word* kvw = w + o->val.woff; - val = ((*kvw) & o->val.mask1) >> o->val.boff; - if(o->val.mask2) - val |= ((*(kvw+1)) & o->val.mask2) << o->val.shift; - - // Do we want to get the large value - bool do_reprobe = reprobe; - if(carry_bit && do_reprobe) { - do_reprobe = do_reprobe && (val & 0x1); - val >>= 1; - } - if(!do_reprobe) - return val; - - return resolve_val_rec((id + reprobes_[0]) & size_mask_, val, carry_bit); - } - - word resolve_val_rec(const size_t id, word val, const bool carry_bit, const uint_t overflows = 0) const { - uint_t reprobe = 0; - size_t cid = id; - - while(reprobe <= reprobe_limit_.val()) { - const offset_t *o, *lo; - const word* w = offsets_.word_offset(cid, &o, &lo, data_); - const word* kw = w + o->key.woff; - word nkey = *kw; - const key_offsets& lkey = lo->key; - - if(nkey & lkey.lb_mask) { - // If the large bit is set, the size of the key (reprobe_len) - // is guaranteed to have a length of at most 1 word. - if(lkey.sb_mask1) { - nkey = (nkey & lkey.mask1 & ~lkey.sb_mask1) >> lkey.boff; - nkey |= ((*(kw+1)) & lkey.mask2 & ~lkey.sb_mask2) << lkey.shift; - } else { - nkey = (nkey & lkey.mask1) >> lkey.boff; - } - if(nkey == reprobe) { - const val_offsets& lval = lo->val; - const word* vw = w + lval.woff; - word nval = ((*vw) & lval.mask1) >> lval.boff; - if(lval.mask2) - nval |= ((*(vw+1)) & lval.mask2) << lval.shift; - - bool do_reprobe = true; - if(carry_bit) { - do_reprobe = nval & 0x1; - nval >>= 1; - } - - nval <<= offsets_.val_len(); - nval <<= offsets_.lval_len() * overflows; - val += nval; - - if(!do_reprobe) - return val; - - return resolve_val_rec((cid + reprobes_[0]) & size_mask_, val, carry_bit, overflows + 1); - } - } else if((nkey & o->key.mask1) == 0) { - break; - } - - cid = (id + reprobes_[++reprobe]) & size_mask_; - } - - return val; - } - -}; - -template -class array : - protected mem_block_t, - public array_base > -{ - typedef array_base > super; - friend class array_base >; - -public: - array(size_t size, // Size of hash. To be rounded up to a power of 2 - uint16_t key_len, // Size of key in bits - uint16_t val_len, // Size of val in bits - uint16_t reprobe_limit, // Maximum reprobe - const size_t* reprobes = quadratic_reprobes) : // Reprobing policy - mem_block_t(), - super(size, key_len, val_len, reprobe_limit, RectangularBinaryMatrix(ceilLog2(size), key_len).randomize_pseudo_inverse(), - reprobes) - { } - -protected: - word* alloc_data(size_t s) { - mem_block_t::realloc(s); - return (word*)mem_block_t::get_ptr(); - } -}; - -struct ptr_info { - void* ptr_; - size_t bytes_; - ptr_info(void* ptr, size_t bytes) : ptr_(ptr), bytes_(bytes) { } -}; -template -class array_raw : - protected ptr_info, - public array_base > -{ - typedef array_base > super; - friend class array_base >; - -public: - array_raw(void* ptr, - size_t bytes, // Memory available at ptr - size_t size, // Size of hash in number of entries. To be rounded up to a power of 2 - uint16_t key_len, // Size of key in bits - uint16_t val_len, // Size of val in bits - uint16_t reprobe_limit, // Maximum reprobe - RectangularBinaryMatrix m, - const size_t* reprobes = quadratic_reprobes) : // Reprobing policy - ptr_info(ptr, bytes), - super(size, key_len, val_len, reprobe_limit, m, reprobes) - { } - -protected: - word* alloc_data(size_t s) { - assert(bytes_ == s); - return (word*)ptr_; - } -}; - -} } // namespace jellyfish { namespace large_hash_array - -#endif /* __JELLYFISH_LARGE_HASH_ARRAY_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/large_hash_iterator.hpp b/src/modifiedJellyfish/include/jellyfish/large_hash_iterator.hpp deleted file mode 100644 index 80d9d252..00000000 --- a/src/modifiedJellyfish/include/jellyfish/large_hash_iterator.hpp +++ /dev/null @@ -1,260 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __LARGE_HASH_ITERATOR_HPP__ -#define __LARGE_HASH_ITERATOR_HPP__ - -#include -#include - -/// Various iterators for the large hash array - -namespace jellyfish { namespace large_hash { - -/// Eager iterator. It computes the actual key and value when doing next. -template -class eager_iterator_base { -public: - typedef typename array::key_type key_type; - typedef typename array::mapped_type mapped_type; - typedef typename array::key_status key_status; - -protected: - const array* ary_; - size_t start_id_, id_, end_id_; - key_type key_; - mapped_type val_; - -public: - eager_iterator_base(const array* ary, size_t start, size_t end) : - ary_(ary), - start_id_(start > ary->size() ? ary->size() : start), - id_(start), - end_id_(end > ary->size() ? ary->size() : end) - {} - - uint64_t start() const { return start_id_; } - uint64_t end() const { return end_id_; } - const key_type& key() const { return key_; } - const mapped_type& val() const { return val_; } - size_t id() const { return id_ - 1; } - size_t pos() const { return key_.get_bits(0, ary_->lsize()); } - - bool next() { - key_status success = array::EMPTY; - while(success != array::FILLED && id_ < end_id_) - success = ary_->get_key_val_at_id(id_++, key_, val_); - if(success == array::FILLED) - key_.set_bits(0, ary_->lsize(), ary_->inverse_matrix().times(key_)); - - return success == array::FILLED; - } -}; - -/// Lazy iterator. The actual key and value are actually computed only -/// when the key() and val() methods are called. -template -class lazy_iterator_base { -public: - typedef typename array::key_type key_type; - typedef typename array::mapped_type mapped_type; - typedef typename array::key_status key_status; - typedef typename array::data_word word; - typedef typename array::offset_t offset_t; - -protected: - const array* ary_; - size_t start_id_, id_, end_id_; - const word* w_; - const offset_t* o_; - bool reversed_key_; - key_type key_; - -public: - lazy_iterator_base(const array *ary, size_t start, size_t end) : - ary_(ary), - start_id_(ary ? (start > ary->size() ? ary->size() : start) : 0), - id_(start), - end_id_(ary ? (end > ary->size() ? ary->size() : end) : 0), - w_(0), o_(0), - reversed_key_(false) - {} - - uint64_t start() const { return start_id_; } - uint64_t end() const { return end_id_; } - const key_type& key() { - if(!reversed_key_) { - key_.set_bits(0, ary_->lsize(), ary_->inverse_matrix().times(key_)); - reversed_key_ = true; - } - return key_; - } - mapped_type val() const { - return ary_->get_val_at_id(id_ - 1, w_, o_, true, false); - } - size_t id() const { return id_ - 1; } - size_t pos() const { return key_.get_bits(0, ary_->lsize()); } - - bool next() { - reversed_key_ = false; - key_status success = array::EMPTY; - while(success != array::FILLED && id_ < end_id_) - success = ary_->get_key_at_id(id_++, key_, &w_, &o_); - - return success == array::FILLED; - } -}; - -/// Region iterator. Iterate over elements whose original position -/// (and not position after reprobing) falls inside the region -/// [start_id, end_id) -template -class region_iterator_base { - public: - typedef typename array::key_type key_type; - typedef typename array::mapped_type mapped_type; - typedef typename array::key_status key_status; - typedef typename array::data_word word; - typedef typename array::offset_t offset_t; - -protected: - const array* ary_; - const uint64_t mask_; - const size_t start_id_, end_id_, mid_; - size_t oid_, id_; - const word* w_; - const offset_t* o_; - bool reversed_key_; - key_type* key_; - bool own_key; - -public: - region_iterator_base(const array *ary, size_t start, size_t end) : - ary_(ary), mask_(ary ? ary->size() - 1 : 0), - start_id_(ary ? std::min(start, ary->size()) : 0), - end_id_(ary ? std::min(end, ary->size()) : 0), - mid_(ary ? std::min(end_id_ - start_id_ + ary->max_reprobe_offset(), ary->size()) : 0), - oid_(end_id_), id_(0), w_(0), o_(0), - reversed_key_(false), - key_(new key_type), - own_key(true) - {} - - region_iterator_base(const array *ary, size_t start, size_t end, key_type& key) : - ary_(ary), mask_(ary ? ary->size() - 1 : 0), - start_id_(ary ? std::min(start, ary->size()) : 0), - end_id_(ary ? std::min(end, ary->size()) : 0), - mid_(ary ? std::min(end_id_ - start_id_ + ary->max_reprobe_offset(), ary->size()) : 0), - oid_(end_id_), id_(0), w_(0), o_(0), - reversed_key_(false), - key_(&key), - own_key(false) - { } - - ~region_iterator_base() { - if(own_key) - delete key_; - } - - const key_type& key() { - if(!reversed_key_) { - key_->set_bits(0, ary_->lsize(), ary_->inverse_matrix().times(*key_)); - reversed_key_ = true; - } - return *key_; - } - mapped_type val() const { - return ary_->get_val_at_id(id(), w_, o_, true, false); - } - uint64_t pos() const{ - return oid_; - } - - size_t start() { return start_id_; } - size_t end() { return end_id_; } - - /// Position where key is stored - size_t id() const { return (start_id_ + id_ - 1) & mask_; } - /// Original position (before reprobing). - size_t oid() const { return oid_; } - - bool next() { - reversed_key_ = false; - bool found_oid = false; - while(!found_oid && id_ < mid_) { - if(ary_->get_key_at_id((start_id_ + id_++) & mask_, *key_, &w_, &o_) == array::FILLED) { - oid_ = key_->get_bits(0, ary_->lsize()); - found_oid = start_id_ <= oid_ && oid_ < end_id_; - } - } - - return found_oid; - - } -}; - -/// STL like iterator on a large hash array. -template -class stl_iterator_base : - public std::iterator, - public array::lazy_iterator -{ -public: - typedef typename array::key_type key_type; - typedef typename array::mapped_type mapped_type; - typedef typename array::value_type value_type; - -protected: - typedef typename array::lazy_iterator lit; - typedef std::pair pair; - pair val_; - -public: - explicit stl_iterator_base(const array* ary, size_t start_id = 0) : - lit(ary, start_id, ary->size()), val_(lit::key_, (mapped_type)0) - { ++*this; } - stl_iterator_base(const array* ary, size_t start_id, size_t end_id) : - lit(ary, start_id, end_id), val_(lit::key_, (mapped_type)0) - { ++*this; } - explicit stl_iterator_base() : lit(0, 0, 0), val_(lit::key_, (mapped_type)0) { } - stl_iterator_base(const stl_iterator_base& rhs) : lit(rhs), val_(lit::key_, rhs.val_.second) { } - - bool operator==(const stl_iterator_base& rhs) const { return lit::ary_ == rhs.ary_ && lit::id_ == rhs.id_; } - bool operator!=(const stl_iterator_base& rhs) const { return !(*this == rhs); } - - const value_type& operator*() { - lit::key(); - val_.second = lit::val(); - return val_; - } - const value_type* operator->() { return &this->operator*(); } - - stl_iterator_base& operator++() { - if(!lit::next()) { - lit::ary_ = 0; - lit::id_ = 0; - } - return *this; - } - - stl_iterator_base operator++(int) { - stl_iterator_base res(*this); - ++*this; - return res; - } -}; -} } // namespace jellyfish { namespace large_hash { -#endif /* __LARGE_HASH_ITERATOR_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/locks_pthread.hpp b/src/modifiedJellyfish/include/jellyfish/locks_pthread.hpp deleted file mode 100644 index 55496a88..00000000 --- a/src/modifiedJellyfish/include/jellyfish/locks_pthread.hpp +++ /dev/null @@ -1,211 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#ifndef __JELLYFISH_LOCKS_PTHREAD_HPP__ -#define __JELLYFISH_LOCKS_PTHREAD_HPP__ - -#include -#include -#include -#ifdef HAVE_CONFIG_H -#include -#endif - -namespace jellyfish { namespace locks{ namespace pthread { -class cond -{ - pthread_mutex_t _mutex; - pthread_cond_t _cond; - -public: - cond() { - pthread_mutex_init(&_mutex, NULL); - pthread_cond_init(&_cond, NULL); - } - - ~cond() { - pthread_cond_destroy(&_cond); - pthread_mutex_destroy(&_mutex); - } - - inline void lock() { pthread_mutex_lock(&_mutex); } - inline void unlock() { pthread_mutex_unlock(&_mutex); } - inline void wait() { pthread_cond_wait(&_cond, &_mutex); } - inline void signal() { pthread_cond_signal(&_cond); } - inline void broadcast() { pthread_cond_broadcast(&_cond); } - inline int timedwait(struct timespec *abstime) { - return pthread_cond_timedwait(&_cond, &_mutex, abstime); - } - inline int timedwait(time_t seconds) { - struct timespec curtime; -#ifdef HAVE_CLOCK_GETTIME - clock_gettime(CLOCK_REALTIME, &curtime); -#else - struct timeval timeofday; - gettimeofday(&timeofday, 0); - curtime.tv_sec = timeofday.tv_sec; - curtime.tv_nsec = timeofday.tv_usec * 1000; -#endif - curtime.tv_sec += seconds; - return timedwait(&curtime); - } -}; - -class mutex { - pthread_mutex_t _mutex; - -public: - mutex(int type = PTHREAD_MUTEX_DEFAULT) { - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, type); - pthread_mutex_init(&_mutex, &attr); - } - - ~mutex() { - pthread_mutex_destroy(&_mutex); - } - - inline void lock() { pthread_mutex_lock(&_mutex); } - inline void unlock() { pthread_mutex_unlock(&_mutex); } - inline bool try_lock() { return !pthread_mutex_trylock(&_mutex); } -}; - -class mutex_recursive : public mutex { -public: - mutex_recursive() : mutex(PTHREAD_MUTEX_RECURSIVE) { } -}; - -class mutex_lock { - mutex& m_; -public: - explicit mutex_lock(mutex& m) : m_(m) { m_.lock(); } - ~mutex_lock() { m_.unlock(); } -}; - -class Semaphore { - int _value, _wakeups; - cond _cv; -public: - explicit Semaphore(int value) : - _value(value), - _wakeups(0) - { - // nothing to do - } - - ~Semaphore() {} - - inline void wait() { - _cv.lock(); - _value--; - if (_value < 0) { - do { - _cv.wait(); - } while(_wakeups < 1); - _wakeups--; - } - _cv.unlock(); - } - - inline void signal() { - _cv.lock(); - _value++; - if(_value <= 0) { - _wakeups++; - _cv.signal(); - } - _cv.unlock(); - } -}; - -#if defined(_POSIX_BARRIERS) && (_POSIX_BARRIERS - 20012L) >= 0 -class barrier -{ - pthread_barrier_t _barrier; - -public: - explicit barrier(unsigned count) { - - pthread_barrier_init(&_barrier, NULL, count); - } - - ~barrier() { - pthread_barrier_destroy(&_barrier); - } - - /// Return true if serial thread. - inline bool wait() { - return pthread_barrier_wait(&_barrier) == PTHREAD_BARRIER_SERIAL_THREAD; - } -}; - -#else -// # ifndef PTHREAD_BARRIER_SERIAL_THREAD -// # define PTHREAD_BARRIER_SERIAL_THREAD 1 -// # endif - -class barrier -{ - int count; // required # of threads - int current; // current # of threads that have passed thru - mutex barlock; // protect current - Semaphore barrier1; // implement the barrier - Semaphore barrier2; - -public: - explicit barrier(unsigned cnt) - : count(cnt), current(0), barrier1(0), barrier2(0) { - } - - ~barrier() {} - - inline bool wait() { - bool ret = false; - barlock.lock(); - current += 1; - if(current == count) { - ret = true; - for(int i=0; i. -*/ - -#ifndef __JELLYFISH_MAPPED_FILE_HPP__ -#define __JELLYFISH_MAPPED_FILE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace jellyfish { -class mapped_file { -protected: - std::string _path; - char *_base, *_end; - size_t _length; - - void map_(int fd) { - struct stat stat; - if(fstat(fd, &stat) < 0) - throw ErrorMMap(err::msg() << "Can't stat file '" << _path << "'" << err::no); - - _length = stat.st_size; - _base = (char*)mmap(NULL, _length, PROT_READ, MAP_SHARED, fd, 0); - if(_base == MAP_FAILED) { - _base = 0; - throw ErrorMMap(err::msg() << "Can't mmap file '" << _path << "'" << err::no); - } - _end = _base + _length; - } - - void map_(const char *filename) { - int fd = open(filename, O_RDONLY); - if(fd < 0) - throw ErrorMMap(err::msg() << "Can't open file '" << filename << "'" << err::no); - map_(fd); - close(fd); - } - - -public: - define_error_class(ErrorMMap); - mapped_file() : _path(), _base(0), _end(0), _length(0) { } - explicit mapped_file(const char *filename) - : _path(filename), _base(0), _end(0), _length(0) - { - map_(filename); - } - explicit mapped_file(int fd) - : _path(), _base(0), _end(0), _length() - { - map_(fd); - } - mapped_file(mapped_file&& rhs) - : _path(std::move(rhs._path)), _base(rhs._base), _end(rhs._end), - _length(rhs._length) - { - rhs._base = 0; - } - - ~mapped_file() { - unmap(); - } - - void map(const char* filename) { - unmap(); - map_(filename); - } - - void map(int fd) { - unmap(); - map_(fd); - } - - void unmap() { - if(!_base) - return; - munmap(_base, _length); - _path.clear(); - _base = 0; - _length = 0; - } - - mapped_file& operator=(mapped_file&& rhs) { - _path = std::move(rhs._path); - _base = rhs._base; - rhs._base = 0; - _end = rhs._end; - _length = rhs._length; - return *this; - } - - void swap(mapped_file& rhs) { - std::swap(_path, rhs._path); - std::swap(_base, rhs._base); - std::swap(_end, rhs._end); - std::swap(_length, rhs._length); - } - - char *base() const { return _base; } - char *end() const { return _end; } - size_t length() const { return _length; } - std::string path() const { return _path; } - - // No error checking here. Should I throw something? - const mapped_file & will_need() const { - madvise(_base, _length, MADV_WILLNEED); - return *this; - } - const mapped_file & sequential() const { - madvise(_base, _length, MADV_SEQUENTIAL); - return *this; - } - const mapped_file & random() const { - madvise(_base, _length, MADV_RANDOM); - return *this; - } - const mapped_file & lock() const { - if(mlock(_base, _length) < 0) - throw ErrorMMap(err::msg() << "Can't lock map in memory" << err::no); - return *this; - } - - char load() const { - const long sz = sysconf(_SC_PAGESIZE); - // Do not optimize. Side effect is that every page is accessed and - // should now be in cache. - volatile char unused = 0; - for(const char *w = _base; w < _base + _length; w += sz) - unused ^= *w; - return unused; - } -}; -inline void swap(mapped_file& a, mapped_file& b) { a.swap(b); } - -// class mapped_files_t : public std::vector { -// public: -// mapped_files_t(int nb_files, char *argv[]) { -// for(int j = 0; j < nb_files; j++) -// push_back(mapped_file(argv[j])); -// } - -// mapped_files_t(int nb_files, char *argv[], bool sequential) { -// for(int j = 0; j < nb_files; j++) { -// push_back(mapped_file(argv[j])); -// if(sequential) -// end()->sequential(); -// } -// } -// }; - -// // File mapped on demand. -// class lazy_mapped_file_t : public mapped_file { -// std::string _path; -// volatile bool done; -// volatile long used_counter; - -// public: -// explicit lazy_mapped_file_t(const char *path) : -// mapped_file((char *)0, (size_t)0), -// _path(path), done(false), used_counter(0) {} - -// void map() { -// used_counter = 1; -// done = false; -// mapped_file::map(_path.c_str()); -// } -// void unmap() { -// done = true; -// dec(); -// } - -// void inc() { -// atomic::gcc::fetch_add(&used_counter, (long)1); -// } -// void dec() { -// long val = atomic::gcc::add_fetch(&used_counter, (long)-1); -// if(done && val == 0) -// mapped_file::unmap(); -// } -// }; - -// class lazy_mapped_files_t : public std::vector { -// public: -// lazy_mapped_files_t(int nb_files, char *argv[]) { -// for(int j = 0; j < nb_files; j++) -// push_back(lazy_mapped_file_t(argv[j])); -// } - -// lazy_mapped_files_t(int nb_files, char *argv[], bool sequential) { -// for(int j = 0; j < nb_files; j++) { -// push_back(lazy_mapped_file_t(argv[j])); -// if(sequential) -// end()->sequential(); -// } -// } -// }; - -} -#endif diff --git a/src/modifiedJellyfish/include/jellyfish/mer_dna.hpp b/src/modifiedJellyfish/include/jellyfish/mer_dna.hpp deleted file mode 100644 index b2e875f9..00000000 --- a/src/modifiedJellyfish/include/jellyfish/mer_dna.hpp +++ /dev/null @@ -1,729 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_MER_DNA_HPP__ -#define __JELLYFISH_MER_DNA_HPP__ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include -#include -#include -#include -#include - -#include -#ifdef HAVE_INT128 -#include -#endif - -namespace jellyfish { namespace mer_dna_ns { -#define R -1 -#define I -2 -#define O -3 -#define A 0 -#define C 1 -#define G 2 -#define T 3 -static const int codes[256] = { - O, O, O, O, O, O, O, O, O, O, I, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, R, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - O, A, R, C, R, O, O, G, R, O, O, R, O, R, R, O, - O, O, R, R, T, O, R, R, R, R, O, O, O, O, O, O, - O, A, R, C, R, O, O, G, R, O, O, R, O, R, R, O, - O, O, R, R, T, O, R, R, R, R, O, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O -}; -#undef R -#undef I -#undef O -#undef A -#undef C -#undef G -#undef T -static const char rev_codes[4] = { 'A', 'C', 'G', 'T' }; - - -extern const char* const error_different_k; -extern const char* const error_short_string; - - -// Checkered mask. cmask is every other bit on -// (0x55). cmask is two bits one, two bits off (0x33). Etc. -template -struct cmask { - static const U v = - (cmask::v << (2 * len)) | (((U)1 << len) - 1); -}; -template -struct cmask { - static const U v = 0; -}; - -// Fast reverse complement of one word through bit tweedling. -inline uint32_t word_reverse_complement(uint32_t w) { - typedef uint64_t U; - w = ((w >> 2) & cmask::v) | ((w & cmask::v) << 2); - w = ((w >> 4) & cmask::v) | ((w & cmask::v) << 4); - w = ((w >> 8) & cmask::v) | ((w & cmask::v) << 8); - w = ( w >> 16 ) | ( w << 16); - return ((U)-1) - w; -} - -inline uint64_t word_reverse_complement(uint64_t w) { - typedef uint64_t U; - w = ((w >> 2) & cmask::v) | ((w & cmask::v) << 2); - w = ((w >> 4) & cmask::v) | ((w & cmask::v) << 4); - w = ((w >> 8) & cmask::v) | ((w & cmask::v) << 8); - w = ((w >> 16) & cmask::v) | ((w & cmask::v) << 16); - w = ( w >> 32 ) | ( w << 32); - return ((U)-1) - w; -} - -#ifdef HAVE_INT128 -inline unsigned __int128 word_reverse_complement(unsigned __int128 w) { - typedef unsigned __int128 U; - w = ((w >> 2) & cmask::v) | ((w & cmask::v) << 2); - w = ((w >> 4) & cmask::v) | ((w & cmask::v) << 4); - w = ((w >> 8) & cmask::v) | ((w & cmask::v) << 8); - w = ((w >> 16) & cmask::v) | ((w & cmask::v) << 16); - w = ((w >> 32) & cmask::v) | ((w & cmask::v) << 32); - w = ( w >> 64 ) | ( w << 64); - return ((U)-1) - w; -} -#endif - -template -class base_proxy { -public: - typedef T base_type; - - base_proxy(base_type* w, unsigned int i) : - word_(w), i_(i) { } - - base_proxy& operator=(char base) { return this->operator=(codes[(int)(unsigned char)base]); } - base_proxy& operator=(int code) { - base_type mask = (base_type)0x3 << i_; - *word_ = (*word_ & ~mask) | ((base_type)code << i_); - return *this; - } - int code() const { return (*word_ >> i_) & (base_type)0x3; } - operator char() const { return rev_codes[code()]; } - -private: - base_type* const word_; - unsigned int i_; -}; - -// enum { CODE_A, CODE_C, CODE_G, CODE_T, -// CODE_RESET = -1, CODE_IGNORE = -2, CODE_COMMENT = -3 }; - -template -struct mer_dna_traits { }; - -template -class mer_base { -public: - typedef typename mer_dna_traits::base_type base_type; - - enum { CODE_A, CODE_C, CODE_G, CODE_T, - CODE_RESET = -1, CODE_IGNORE = -2, CODE_COMMENT = -3 }; - - explicit mer_base(unsigned int k) : - _data(new base_type[derived::nb_words(k)]) - { - memset(_data, '\0', nb_words(k) * sizeof(base_type)); - } - - mer_base(const mer_base &m) : - _data(new base_type[nb_words(static_cast(&m)->k())]) - { - memcpy(_data, m._data, nb_words(static_cast(&m)->k()) * sizeof(base_type)); - } - - template - mer_base(const unsigned int k, const U& rhs) : - _data(new base_type[nb_words(k)]) - { - for(unsigned int i = 0; i < k; ++i) - _data[i] = rhs[i]; - clean_msw(); - } - - ~mer_base() { - delete [] _data; - } - - operator derived() { return *static_cast(this); } - operator const derived() const { return *static_cast(this); } - unsigned int k() const { return static_cast(this)->k(); } - - /// Direct access to data. No bound or consistency check. Use with - /// caution! - // base_type operator[](unsigned int i) { return _data[i]; } - base_type word(unsigned int i) const { return _data[i]; } - base_type operator[](unsigned int i) const { return _data[i]; } - /// Direct access to the data array. - const base_type* data() const { return _data; } - - /// Same as above, but can modify directly content. Use at your own - /// risk! - base_type& word__(unsigned int i) { return _data[i]; } - base_type* data__() { return _data; } - - template - void read(std::istream& is) { - const unsigned int k = static_cast(this)->k(); - const unsigned int l = k / (4 * alignment) + (k % (4 * alignment) != 0); - is.read((char*)_data, l); - } - - bool operator==(const mer_base& rhs) const { - unsigned int i = nb_words() - 1; - bool res = (_data[i] & msw()) == (rhs._data[i] & msw()); - while(res && i > 7) { - i -= 8; - res = res && (_data[i+7] == rhs._data[i+7]); - res = res && (_data[i+6] == rhs._data[i+6]); - res = res && (_data[i+5] == rhs._data[i+5]); - res = res && (_data[i+4] == rhs._data[i+4]); - res = res && (_data[i+3] == rhs._data[i+3]); - res = res && (_data[i+2] == rhs._data[i+2]); - res = res && (_data[i+1] == rhs._data[i+1]); - res = res && (_data[i] == rhs._data[i] ); - } - switch(i) { - case 7: res = res && (_data[6] == rhs._data[6]); - case 6: res = res && (_data[5] == rhs._data[5]); - case 5: res = res && (_data[4] == rhs._data[4]); - case 4: res = res && (_data[3] == rhs._data[3]); - case 3: res = res && (_data[2] == rhs._data[2]); - case 2: res = res && (_data[1] == rhs._data[1]); - case 1: res = res && (_data[0] == rhs._data[0]); - } - return res; - } - - bool operator!=(const mer_base& rhs) const { return !this->operator==(rhs); } - bool operator<(const mer_base& rhs) const { - unsigned int i = nb_words(); - while(i >= 8) { - i -= 8; - if(_data[i+7] != rhs._data[i+7]) return _data[i+7] < rhs._data[i+7]; - if(_data[i+6] != rhs._data[i+6]) return _data[i+6] < rhs._data[i+6]; - if(_data[i+5] != rhs._data[i+5]) return _data[i+5] < rhs._data[i+5]; - if(_data[i+4] != rhs._data[i+4]) return _data[i+4] < rhs._data[i+4]; - if(_data[i+3] != rhs._data[i+3]) return _data[i+3] < rhs._data[i+3]; - if(_data[i+2] != rhs._data[i+2]) return _data[i+2] < rhs._data[i+2]; - if(_data[i+1] != rhs._data[i+1]) return _data[i+1] < rhs._data[i+1]; - if(_data[i] != rhs._data[i]) return _data[i] < rhs._data[i]; - } - switch(i) { - case 7: if(_data[6] != rhs._data[6]) return _data[6] < rhs._data[6]; - case 6: if(_data[5] != rhs._data[5]) return _data[5] < rhs._data[5]; - case 5: if(_data[4] != rhs._data[4]) return _data[4] < rhs._data[4]; - case 4: if(_data[3] != rhs._data[3]) return _data[3] < rhs._data[3]; - case 3: if(_data[2] != rhs._data[2]) return _data[2] < rhs._data[2]; - case 2: if(_data[1] != rhs._data[1]) return _data[1] < rhs._data[1]; - case 1: if(_data[0] != rhs._data[0]) return _data[0] < rhs._data[0]; - } - return false; - } - bool operator<=(const mer_base& rhs) const { - return *this < rhs || *this == rhs; - } - bool operator>(const mer_base& rhs) const { - return !(*this <= rhs); - } - bool operator>=(const mer_base& rhs) const { - return !(*this < rhs); - } - - base_proxy base(unsigned int i) { return base_proxy(_data + i / wbases, 2 * (i % wbases)); } - const base_proxy base(unsigned int i) const { return base_proxy(_data + i / wbases, 2 * (i % wbases)); } - - // Make current k-mer all As. - void polyA() { memset(_data, 0x00, sizeof(base_type) * nb_words()); clean_msw(); } - void polyC() { memset(_data, 0x55, sizeof(base_type) * nb_words()); clean_msw(); } - void polyG() { memset(_data, 0xaa, sizeof(base_type) * nb_words()); clean_msw(); } - void polyT() { memset(_data, 0xff, sizeof(base_type) * nb_words()); clean_msw(); } - void randomize() { - for(unsigned int i = 0; i < nb_words(); ++i) - _data[i] = random_bits(wbits); - clean_msw(); - } - - bool is_homopolymer() const { - const base_type base = _data[0] & c3; - const unsigned int barrier = nb_words(); - unsigned int i = 0; - - for( ; i + 5 < barrier; i += 4) { - if(_data[i ] != ((_data[i ] << 2) | base)) return false; - if(_data[i + 1] != ((_data[i + 1] << 2) | base)) return false; - if(_data[i + 2] != ((_data[i + 2] << 2) | base)) return false; - if(_data[i + 3] != ((_data[i + 3] << 2) | base)) return false; - } - - switch(nb_words() - i) { - case 5: if(_data[i] != ((_data[i] << 2) | base) ) return false; ++i; - case 4: if(_data[i] != ((_data[i] << 2) | base) ) return false; ++i; - case 3: if(_data[i] != ((_data[i] << 2) | base) ) return false; ++i; - case 2: if(_data[i] != ((_data[i] << 2) | base) ) return false; ++i; - case 1: if(_data[i] != (((_data[i] << 2) | base) & msw())) return false; - } - - return true; - } - - derived& operator=(const mer_base& rhs) { - memcpy(_data, rhs._data, nb_words() * sizeof(base_type)); - return *static_cast(this); - } - - derived& operator=(const char* s) { - if(strlen(s) < static_cast(this)->k()) - throw std::length_error(error_short_string); - from_chars(s); - return *static_cast(this); - } - - derived& operator=(const std::string& s) { - if(s.size() < static_cast(this)->k()) - throw std::length_error(error_short_string); - from_chars(s.c_str()); - return *static_cast(this); - } - - // Shift the k-mer by 1 base, left or right. The char version take - // a base 'A', 'C', 'G', or 'T'. The base_type version takes a code - // in [0, 3] (not check of validity of argument, taken modulo - // 4). The return value is the base that was pushed off the side - // ('N' if the input character is not a valid base). - base_type shift_left(int c) { - const base_type r = (_data[nb_words()-1] >> lshift()) & c3; - const unsigned int barrier = nb_words() & (~c3); - base_type c2; // c2 and c1: carries - base_type c1 = (base_type)c & c3; - unsigned int i = 0; - - for( ; i < barrier; i += 4) { - c2 = _data[i] >> wshift; _data[i] = (_data[i] << 2) | c1; - c1 = _data[i+1] >> wshift; _data[i+1] = (_data[i+1] << 2) | c2; - c2 = _data[i+2] >> wshift; _data[i+2] = (_data[i+2] << 2) | c1; - c1 = _data[i+3] >> wshift; _data[i+3] = (_data[i+3] << 2) | c2; - } - c2 = c1; - - switch(nb_words() - i) { - case 3: c2 = _data[i] >> wshift; _data[i] = (_data[i] << 2) | c1; ++i; - case 2: c1 = _data[i] >> wshift; _data[i] = (_data[i] << 2) | c2; ++i; - case 1: _data[i] = (_data[i] << 2) | c1; - } - clean_msw(); - - return r; - } - - base_type shift_right(int c) { - const base_type r = _data[0] & c3; - if(nb_words() > 1){ - const unsigned int barrier = (nb_words() - 1) & (~c3); - unsigned int i = 0; - - for( ; i < barrier; i += 4) { - _data[i] = (_data[i] >> 2) | (_data[i+1] << wshift); - _data[i+1] = (_data[i+1] >> 2) | (_data[i+2] << wshift); - _data[i+2] = (_data[i+2] >> 2) | (_data[i+3] << wshift); - _data[i+3] = (_data[i+3] >> 2) | (_data[i+4] << wshift); - } - switch(nb_words() - 1 - i) { - case 3: _data[i] = (_data[i] >> 2) | (_data[i+1] << wshift); ++i; - case 2: _data[i] = (_data[i] >> 2) | (_data[i+1] << wshift); ++i; - case 1: _data[i] = (_data[i] >> 2) | (_data[i+1] << wshift); - } - } - - _data[nb_words() - 1] = - ((_data[nb_words() - 1] & msw()) >> 2) | (((base_type)c & c3) << lshift()); - - return r; - } - - // Non DNA codes are negative - inline static bool not_dna(int c) { return c < 0; } - inline static int code(char c) { return codes[(int)(unsigned char)c]; } - inline static char rev_code(int x) { return rev_codes[x]; } - static int complement(int x) { return (base_type)3 - x; } - static char complement(char c) { - switch(c) { - case 'A': case 'a': return 'T'; - case 'C': case 'c': return 'G'; - case 'G': case 'g': return 'C'; - case 'T': case 't': return 'A'; - } - return 'N'; - } - - char shift_left(char c) { - int x = code(c); - if(x == -1) - return 'N'; - return rev_code(shift_left(x)); - } - - char shift_right(char c) { - int x = code(c); - if(x == -1) - return 'N'; - return rev_code(shift_right(x)); - } - - void reverse_complement() { - base_type *low = _data; - base_type *high = _data + nb_words() - 1; - for( ; low < high; ++low, --high) { - base_type tmp = word_reverse_complement(*low); - *low = word_reverse_complement(*high); - *high = tmp; - } - if(low == high) - *low = word_reverse_complement(*low); - unsigned int rs = wbits - nb_msb(); - if(rs > 0) - large_shift_right(rs); - } - - void canonicalize() { - derived rc = this->get_reverse_complement(); - if(rc < *this) - *this = rc; - } - - derived get_reverse_complement() const { - derived res(*this); - res.reverse_complement(); - return res; - } - - derived get_canonical() const { - derived rc = this->get_reverse_complement(); - return rc < *this ? rc : *this; - } - - // Transfomr the k-mer into a C++ string. - std::string to_str() const { - std::string res(static_cast(this)->k(), '\0'); - to_chars(res.begin()); - return res; - } - - // Transform the k-mer into a string. For the char * version, - // assume that the buffer is large enough to receive k+1 - // characters (space for '\0' at end of string). - void to_str(char* s) const { - s = to_chars(s); - *s = '\0'; - } - - // Copy bases as char to the output iterator it. No '\0' is added - // or check made that there is enough space. The iterator pointed - // after the last base is returned. - template - OutputIterator to_chars(OutputIterator it) const { - int shift = lshift(); // Number of bits to shift to get base - - for(int j = nb_words() - 1; j >= 0; --j) { - base_type w = _data[j]; - for( ; shift >= 0; shift -= 2, ++it) - *it = rev_code((w >> shift) & c3); - shift = wshift; - } - return it; - } - - // Get bits [start, start+len). start must be < 2k, len <= - // sizeof(base_type) and start+len < 2k. No checks - // performed. start and len are in bits, not bases. - base_type get_bits(unsigned int start, unsigned int len) const { - unsigned int q = start / wbits; - unsigned int r = start % wbits; - - base_type res = _data[q] >> r; - if(len > wbits - r) - res |= _data[q + 1] << (wbits - r); - return len < (unsigned int)wbits ? res & (((base_type)1 << len) - 1) : res; - } - - // Set bits [start, start+len). Same restriction as get_bits. In - // some rare cases, the value written can be larger than the bits - // occupied by the mer itself. The mer is then not valid if some MSB - // are set to 1. - template - void set_bits(unsigned int start, unsigned int len, base_type v) { - unsigned int q = start / wbits; - unsigned int r = start % wbits; - unsigned int left = wbits - r; - base_type mask; - if(len > left) { - mask = ((base_type)1 << r) - 1; - _data[q] = (_data[q] & mask) | (v << r); - mask = ((base_type)1 << (len - left)) - 1; - _data[q + 1] = (_data[q + 1] & ~mask) | (v >> (left)); - } else { - mask = (len < (unsigned int)wbits ? (((base_type)1 << len) - 1) : (base_type)-1) << r; - _data[q] = (_data[q] & ~mask) | (v << r); - } - if(zero_msw) - clean_msw(); - } - - - - // Internal stuff - - // Number of words in _data - inline static unsigned int nb_words(unsigned int k) { return (k / wbases) + (k % wbases != 0); } - inline unsigned int nb_words() const { return nb_words(static_cast(this)->k()); } - - // Mask of highest word - inline base_type msw() const { - const base_type m = std::numeric_limits::max(); - return m >> (wbits - nb_msb()); - } - - // Nb of bits used in highest word - inline unsigned int nb_msb() const { - base_type nb = (static_cast(this)->k() % wbases) * 2; - return nb ? nb : wbits; - } - // How much to shift last base in last word of _data - inline unsigned int lshift() const { return nb_msb() - 2; } - - // Make sure the highest bits are all zero - inline void clean_msw() { _data[nb_words() - 1] &= msw(); } - - template - bool from_chars(InputIterator it) { - int shift = lshift(); - clean_msw(); - - for(int j = nb_words() - 1; j >= 0; --j) { - base_type& w = _data[j]; - w = 0; - for( ; shift >= 0; shift -= 2, ++it) { - int c = code(*it); - if(not_dna(c)) - return false; - w |= (base_type)c << shift; - } - shift = wshift; - } - return true; - } - -protected: - static const base_type c3 = (base_type)0x3; - static const int wshift = sizeof(base_type) * 8 - 2; // left shift in 1 word - static const int wbases = 4 * sizeof(base_type); // bases in a word - static const int wbits = 8 * sizeof(base_type); // bits in a word - base_type * _data; - - // Shift to the right by rs bits (Note bits, not bases) - void large_shift_right(unsigned int rs) { - if(nb_words() > 1) { - const unsigned int barrier = (nb_words() - 1) & (~c3); - const unsigned int ls = wbits - rs; - unsigned int i = 0; - - for( ; i < barrier; i += 4) { - _data[i] = (_data[i] >> rs) | (_data[i+1] << ls); - _data[i+1] = (_data[i+1] >> rs) | (_data[i+2] << ls); - _data[i+2] = (_data[i+2] >> rs) | (_data[i+3] << ls); - _data[i+3] = (_data[i+3] >> rs) | (_data[i+4] << ls); - } - switch(nb_words() - 1 - i) { - case 3: _data[i] = (_data[i] >> rs) | (_data[i+1] << ls); ++i; - case 2: _data[i] = (_data[i] >> rs) | (_data[i+1] << ls); ++i; - case 1: _data[i] = (_data[i] >> rs) | (_data[i+1] << ls); - } - } - _data[nb_words() - 1] >>= rs; - clean_msw(); - } -}; - -// Mer type where the length is kept in each mer object: allows to -// manipulate mers of different size within the same application. -template -class mer_base_dynamic : public mer_base > { -public: - typedef T base_type; - typedef mer_base > super; - - explicit mer_base_dynamic(unsigned int k) : super(k), k_(k) { } - mer_base_dynamic(const mer_base_dynamic& rhs) : super(rhs), k_(rhs.k()) { } - mer_base_dynamic(unsigned int k, const char* s) : super(k), k_(k) { - super::from_chars(s); - } - explicit mer_base_dynamic(const char* s) : super(strlen(s)), k_(strlen(s)) { - super::from_chars(s); - } - explicit mer_base_dynamic(const std::string& s) : super(s.size()), k_(s.size()) { - super::from_chars(s.begin()); - } - - template - explicit mer_base_dynamic(unsigned int k, const U& rhs) : super(k, rhs), k_(k) { } - - ~mer_base_dynamic() { } - - mer_base_dynamic& operator=(const mer_base_dynamic rhs) { - if(k_ != rhs.k_) - throw std::length_error(error_different_k); - super::operator=(rhs); - return *this; - } - - unsigned int k() const { return k_; } - static unsigned int k(unsigned int k) { return k; } - -private: - const unsigned int k_; -}; - -template -struct mer_dna_traits > { - typedef T base_type; -}; - -// Mer type where the length is a static variable: the mer size is -// fixed for all k-mers in the application. -// -// The CI (Class Index) template parameter allows to have more than one such -// class with different length in the same application. Each class has -// its own static variable associated with it. -template -class mer_base_static : public mer_base > { -public: - typedef T base_type; - typedef mer_base > super; - static const int class_index = CI; - - mer_base_static() : super(k_) { } - explicit mer_base_static(unsigned int k) : super(k_) { - if(k != k_) - throw std::length_error(error_different_k); - } - mer_base_static(const mer_base_static& rhs) : super(rhs) { } - - mer_base_static(unsigned int k, const char* s) : super(k_) { - super::from_chars(s); - } - explicit mer_base_static(const char* s) : super(k_) { - super::from_chars(s); - } - explicit mer_base_static(const std::string& s) : super(k_) { - super::from_chars(s.begin()); - } - - template - mer_base_static(unsigned int k, const U& rhs) : super(k_, rhs) { - if(k != k_) - throw std::length_error(error_different_k); - } - - mer_base_static& operator=(const char* s) { return super::operator=(s); } - mer_base_static& operator=(const std::string& s) { return super::operator=(s); } - - ~mer_base_static() { } - - static unsigned int k(); // { return k_; } - static unsigned int k(unsigned int k) { std::swap(k, k_); return k; } - -private: - static unsigned int k_; -}; -template -unsigned int mer_base_static::k_ = 22; -template -unsigned int mer_base_static::k() { return k_; } -template -const int mer_base_static::class_index; - -template -struct mer_dna_traits > { - typedef T base_type; -}; - -typedef std::ostream_iterator ostream_char_iterator; -template -inline std::ostream& operator<<(std::ostream& os, const mer_base& mer) { - // char s[static_cast(mer).k() + 1]; - char s[mer.k() + 1]; - mer.to_str(s); - return os << s; -} - -typedef std::istream_iterator istream_char_iterator; -template -inline std::istream& operator>>(std::istream& is, mer_base& mer) { - if(is.flags() & std::ios::skipws) { - while(isspace(is.peek())) { is.ignore(1); } - } - - char buffer[mer.k() + 1]; - is.read(buffer, mer.k()); - if(is.gcount() != mer.k()) - goto error; - buffer[mer.k()] = '\0'; - if(!mer.from_chars(buffer)) - goto error; - return is; - - error: - is.setstate(std::ios::failbit); - return is; -} - -} // namespace mer_dna_ns - - -typedef mer_dna_ns::mer_base_static mer_dna32; -typedef mer_dna_ns::mer_base_static mer_dna64; -#ifdef HAVE_INT128 -typedef mer_dna_ns::mer_base_static mer_dna128; -#endif - -typedef mer_dna64 mer_dna; - -} // namespace jellyfish - -#endif diff --git a/src/modifiedJellyfish/include/jellyfish/mer_dna_bloom_counter.hpp b/src/modifiedJellyfish/include/jellyfish/mer_dna_bloom_counter.hpp deleted file mode 100644 index f640d1f4..00000000 --- a/src/modifiedJellyfish/include/jellyfish/mer_dna_bloom_counter.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_MER_DNA_BLOOM_COUNTER_HPP_ -#define __JELLYFISH_MER_DNA_BLOOM_COUNTER_HPP_ - -#include -#include -#include -#include -#include - -namespace jellyfish { -template<> -struct hash_pair { - RectangularBinaryMatrix m1, m2; - - hash_pair() : m1(8 * sizeof(uint64_t), mer_dna::k() * 2), m2(8 * sizeof(uint64_t), mer_dna::k() * 2) { - m1.randomize(random_bits); - m2.randomize(random_bits); - } - - hash_pair(RectangularBinaryMatrix&& m1_, RectangularBinaryMatrix&& m2_) : m1(m1_), m2(m2_) { } - - void operator()(const mer_dna& k, uint64_t* hashes) const { - hashes[0] = m1.times(k); - hashes[1] = m2.times(k); - } -}; - -typedef bloom_counter2 mer_dna_bloom_counter; -typedef bloom_counter2_file mer_dna_bloom_counter_file; -typedef bloom_filter mer_dna_bloom_filter; -typedef bloom_filter_file mer_dna_bloom_filter_file; -} - -#endif /* __JELLYFISH_MER_DNA_BLOOM_COUNTER_HPP_ */ diff --git a/src/modifiedJellyfish/include/jellyfish/mer_heap.hpp b/src/modifiedJellyfish/include/jellyfish/mer_heap.hpp deleted file mode 100644 index 29bd228b..00000000 --- a/src/modifiedJellyfish/include/jellyfish/mer_heap.hpp +++ /dev/null @@ -1,115 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_HEAP_HPP__ -#define __JELLYFISH_HEAP_HPP__ - -#include -#include - -namespace jellyfish { namespace mer_heap { -template -struct heap_item { - Key key_; - uint64_t val_; - uint64_t pos_; - Iterator* it_; - - heap_item() : it_(0) { } - heap_item(Iterator& iter) : key_(iter.key()), val_(iter.val()), pos_(iter.pos()), it_(&iter) { } - - bool operator>(const heap_item& other) const { - if(pos_ == other.pos_) - return key_ > other.key_; - return pos_ > other.pos_; - } -}; - -// STL make_heap creates a max heap. We want a min heap, so -// we use the > operator -template -struct heap_item_comp { - bool operator()(const heap_item* i1, const heap_item* i2) { - return *i1 > *i2; - } -}; - -template -class heap { - heap_item* storage_; // Storage of the elements - heap_item** elts_; // Pointers to storage. Create a heap of pointers - size_t capacity_; // Actual capacity - size_t h_; // Head pointer - heap_item_comp comp_; - -public: - typedef const heap_item *const_item_t; - - heap() : storage_(0), elts_(0), capacity_(0), h_(0) { } - explicit heap(size_t capacity) { initialize(capacity); } - ~heap() { - delete[] storage_; - delete[] elts_; - } - - void initialize(size_t capacity) { - capacity_ = capacity; - h_ = 0; - storage_ = new heap_item[capacity_]; - elts_ = new heap_item*[capacity_]; - for(size_t h1 = 0; h1 < capacity_; ++h1) - elts_[h1] = &storage_[h1]; - } - - void fill(Iterator &it) { - for(h_ = 0; h_ < capacity_; ++h_) { - if(!it.next()) - break; - storage_[h_] = it; - elts_[h_] = &storage_[h_]; - } - std::make_heap(elts_, elts_ + h_, comp_); - } - // template - // void fill(ForwardIterator first, ForwardIterator last) { - // h_ = 0; - // while(h_ < capacity_ && first != last) { - // if(!first->next()) - // break; - // storage_[h_].initialize(*first++); - // elts_[h_] = &storage_[h_]; - // h_++; - // } - // std::make_heap(elts_, elts_ + h_, compare); - // } - - bool is_empty() const { return h_ == 0; } - bool is_not_empty() const { return h_ > 0; } - size_t size() const { return h_; } - size_t capacity() const { return capacity_; } - - // The following 3 should only be used after fill has been called - const_item_t head() const { return elts_[0]; } - void pop() { std::pop_heap(elts_, elts_ + h_--, comp_); } - void push(Iterator &item) { - *elts_[h_] = item; - std::push_heap(elts_, elts_ + ++h_, comp_); - } -}; - -} } // namespace jellyfish { namespace mer_heap { - -#endif // __HEAP_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/mer_iterator.hpp b/src/modifiedJellyfish/include/jellyfish/mer_iterator.hpp deleted file mode 100644 index cb9e6df4..00000000 --- a/src/modifiedJellyfish/include/jellyfish/mer_iterator.hpp +++ /dev/null @@ -1,100 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#ifndef __MER_ITERATOR_HPP__ -#define __MER_ITERATOR_HPP__ - -#include -#include - -namespace jellyfish { -template -class mer_iterator : public std::iterator { - typename SequencePool::job* job_; - const char* cseq_; - MerType m_; // mer - MerType rcm_; // reverse complement mer - unsigned int filled_; - const bool canonical_; - -public: - typedef MerType mer_type; - typedef SequencePool sequence_parser_type; - - mer_iterator(SequencePool& seq, bool canonical = false) : - job_(new typename SequencePool::job(seq)), cseq_(0), filled_(0), canonical_(canonical) - { - if(job_->is_empty()) { - delete job_; - job_ = 0; - } else { - cseq_ = (*job_)->start; - this->operator++(); - } - } - mer_iterator() : job_(0), cseq_(0), filled_(0), canonical_(false) { } - // mer_iterator(const mer_iterator& rhs) : job_(rhs.job_), cseq_(rhs.cseq_), m_(rhs.m_), filled_(rhs.filled_) { } - ~mer_iterator() { - delete job_; - } - - bool operator==(const mer_iterator& rhs) const { return job_ == rhs.job_; } - bool operator!=(const mer_iterator& rhs) const { return job_ != rhs.job_; } - - operator void*() const { return (void*)job_; } - const mer_type& operator*() const { return !canonical_ || m_ < rcm_ ? m_ : rcm_; } - const mer_type* operator->() const { return &this->operator*(); } - mer_iterator& operator++() { - while(true) { - while(cseq_ == (*job_)->end) { - job_->next(); - if(job_->is_empty()) { - delete job_; - job_ = 0; - cseq_ = 0; - return *this; - } - cseq_ = (*job_)->start; - filled_ = 0; - } - - do { - int code = m_.code(*cseq_++); - if(code >= 0) { - m_.shift_left(code); - if(canonical_) - rcm_.shift_right(rcm_.complement(code)); - filled_ = std::min(filled_ + 1, mer_dna::k()); - } else - filled_ = 0; - } while(filled_ < m_.k() && cseq_ < (*job_)->end); - if(filled_ >= m_.k()) - break; - } - return *this; - } - - mer_iterator operator++(int) { - mer_iterator res(*this); - ++*this; - return res; - } -}; - -} // namespace jellyfish { - -#endif /* __MER_ITERATOR_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/mer_overlap_sequence_parser.hpp b/src/modifiedJellyfish/include/jellyfish/mer_overlap_sequence_parser.hpp deleted file mode 100644 index 488cd835..00000000 --- a/src/modifiedJellyfish/include/jellyfish/mer_overlap_sequence_parser.hpp +++ /dev/null @@ -1,254 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_MER_OVELAP_SEQUENCE_PARSER_H_ -#define __JELLYFISH_MER_OVELAP_SEQUENCE_PARSER_H_ - -#include - -#include - -#include -#include -#include - -namespace jellyfish { - -struct sequence_ptr { - char* start; - char* end; -}; - -template -class mer_overlap_sequence_parser : public jellyfish::cooperative_pool2, sequence_ptr> { - typedef jellyfish::cooperative_pool2, sequence_ptr> super; - enum file_type { DONE_TYPE, FASTA_TYPE, FASTQ_TYPE }; - typedef std::unique_ptr stream_type; - - struct stream_status { - char* seam; - size_t seq_len; - bool have_seam; - file_type type; - stream_type stream; - - stream_status() : seam(0), seq_len(0), have_seam(false), type(DONE_TYPE) { } - }; - - uint16_t mer_len_; - size_t buf_size_; - char* buffer; - char* seam_buffer; - locks::pthread::mutex streams_mutex; - char* data; - cpp_array streams_; - StreamIterator& streams_iterator_; - size_t files_read_; // nb of files read - size_t reads_read_; // nb of reads read - -public: - /// Max_producers is the maximum number of concurrent threads than - /// can produce data simultaneously. Size is the number of buffer to - /// keep around. It should be larger than the number of thread - /// expected to read from this class. buf_size is the size of each - /// buffer. A StreamIterator is expected to have a next() method, - /// which is thread safe, and which returns (move) a - /// std::unique object. - mer_overlap_sequence_parser(uint16_t mer_len, uint32_t max_producers, uint32_t size, size_t buf_size, - StreamIterator& streams) : - super(max_producers, size), - mer_len_(mer_len), - buf_size_(buf_size), - buffer(new char[size * buf_size]), - seam_buffer(new char[max_producers * (mer_len - 1)]), - streams_(max_producers), - streams_iterator_(streams), - files_read_(0), reads_read_(0) - { - for(sequence_ptr* it = super::element_begin(); it != super::element_end(); ++it) - it->start = it->end = buffer + (it - super::element_begin()) * buf_size; - for(uint32_t i = 0; i < max_producers; ++i) { - streams_.init(i); - streams_[i].seam = seam_buffer + i * (mer_len - 1); - open_next_file(streams_[i]); - } - } - - ~mer_overlap_sequence_parser() { - delete [] buffer; - delete [] seam_buffer; - } - - // file_type get_type() const { return type; } - - inline bool produce(uint32_t i, sequence_ptr& buff) { - stream_status& st = streams_[i]; - - switch(st.type) { - case FASTA_TYPE: - read_fasta(st, buff); - break; - case FASTQ_TYPE: - read_fastq(st, buff); - break; - case DONE_TYPE: - return true; - } - - if(st.stream->good()) - return false; - - // Reach the end of file, close current and try to open the next one - st.have_seam = false; - open_next_file(st); - return false; - } - - size_t nb_files() const { return files_read_; } - size_t nb_reads() const { return reads_read_; } - -protected: - bool open_next_file(stream_status& st) { - // The stream must be released, with .reset(), before calling - // .next() on the streams_iterator_, to ensure that the - // streams_iterator_ noticed that we closed that stream before - // requesting a new one. - st.stream.reset(); - st.stream = streams_iterator_.next(); - if(!st.stream) { - st.type = DONE_TYPE; - return false; - } - - ++files_read_; - switch(st.stream->peek()) { - case EOF: return open_next_file(st); - case '>': - st.type = FASTA_TYPE; - ignore_line(*st.stream); // Pass header - ++reads_read_; - break; - case '@': - st.type = FASTQ_TYPE; - ignore_line(*st.stream); // Pass header - ++reads_read_; - break; - default: - throw std::runtime_error("Unsupported format"); // Better error management - } - return true; - } - - void read_fasta(stream_status& st, sequence_ptr& buff) { - size_t read = 0; - if(st.have_seam) { - memcpy(buff.start, st.seam, mer_len_ - 1); - read = mer_len_ - 1; - } - - // Here, the current stream is assumed to always point to some - // sequence (or EOF). Never at header. - while(st.stream->good() && read < buf_size_ - mer_len_ - 1) { - read += read_sequence(*st.stream, read, buff.start, '>'); - if(st.stream->peek() == '>') { - *(buff.start + read++) = 'N'; // Add N between reads - ignore_line(*st.stream); // Skip to next sequence (skip headers, quals, ...) - ++reads_read_; - } - } - buff.end = buff.start + read; - - st.have_seam = read >= (size_t)(mer_len_ - 1); - if(st.have_seam) - memcpy(st.seam, buff.end - mer_len_ + 1, mer_len_ - 1); - } - - void read_fastq(stream_status& st, sequence_ptr& buff) { - size_t read = 0; - if(st.have_seam) { - memcpy(buff.start, st.seam, mer_len_ - 1); - read = mer_len_ - 1; - } - - // Here, the st.stream is assumed to always point to some - // sequence (or EOF). Never at header. - while(st.stream->good() && read < buf_size_ - mer_len_ - 1) { - size_t nread = read_sequence(*st.stream, read, buff.start, '+'); - read += nread; - st.seq_len += nread; - if(st.stream->peek() == '+') { - skip_quals(*st.stream, st.seq_len); - if(st.stream->good()) { - *(buff.start + read++) = 'N'; // Add N between reads - ignore_line(*st.stream); // Skip sequence header - ++reads_read_; - } - st.seq_len = 0; - } - } - buff.end = buff.start + read; - - st.have_seam = read >= (size_t)(mer_len_ - 1); - if(st.have_seam) - memcpy(st.seam, buff.end - mer_len_ + 1, mer_len_ - 1); - } - - size_t read_sequence(std::istream& is, const size_t read, char* const start, const char stop) { - size_t nread = read; - - skip_newlines(is); // Skip new lines -> get below doesn't like them - while(is && nread < buf_size_ - 1 && is.peek() != stop) { - is.get(start + nread, buf_size_ - nread); - nread += is.gcount(); - skip_newlines(is); - } - return nread - read; - } - - inline void ignore_line(std::istream& is) { - is.ignore(std::numeric_limits::max(), '\n'); - } - - inline void skip_newlines(std::istream& is) { - while(is.peek() == '\n') - is.get(); - } - - // Skip quals header and qual values (read_len) of them. - void skip_quals(std::istream& is, size_t read_len) { - ignore_line(is); - size_t quals = 0; - - skip_newlines(is); - while(is.good() && quals < read_len) { - is.ignore(read_len - quals + 1, '\n'); - quals += is.gcount(); - if(is) - ++read_len; - skip_newlines(is); - } - skip_newlines(is); - if(quals == read_len && (is.peek() == '@' || is.peek() == EOF)) - return; - - throw std::runtime_error("Invalid fastq sequence"); - } - - char peek(std::istream& is) { return is.peek(); } -}; -} - -#endif /* __JELLYFISH_MER_OVELAP_SEQUENCE_PARSER_H_ */ diff --git a/src/modifiedJellyfish/include/jellyfish/mer_qual_iterator.hpp b/src/modifiedJellyfish/include/jellyfish/mer_qual_iterator.hpp deleted file mode 100644 index 328322db..00000000 --- a/src/modifiedJellyfish/include/jellyfish/mer_qual_iterator.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#ifndef __MER_QUAL_ITERATOR_HPP__ -#define __MER_QUAL_ITERATOR_HPP__ - -#include -#include - -namespace jellyfish { -template -class mer_qual_iterator : public std::iterator { - typename SequencePool::job* job_; - std::string::const_iterator cseq_, eseq_; - std::string::const_iterator cqual_, equal_; - MerType m_; // mer - MerType rcm_; // reverse complement mer - unsigned int filled_; - const char min_qual_; - const bool canonical_; - size_t index_; - -public: - typedef MerType mer_type; - typedef SequencePool sequence_parser_type; - - mer_qual_iterator(SequencePool& seq, char min_qual, bool canonical = false) : - job_(new typename SequencePool::job(seq)), - filled_(0), min_qual_(min_qual), canonical_(canonical), index_(0) - { - if(job_->is_empty()) { - delete job_; - job_ = 0; - } else { - init_from_job(); - this->operator++(); - } - } - mer_qual_iterator() : job_(0), filled_(0), canonical_(false), index_(0) { } - // mer_iterator(const mer_iterator& rhs) : job_(rhs.job_), cseq_(rhs.cseq_), m_(rhs.m_), filled_(rhs.filled_) { } - ~mer_qual_iterator() { - delete job_; - } - - bool operator==(const mer_qual_iterator& rhs) const { return job_ == rhs.job_; } - bool operator!=(const mer_qual_iterator& rhs) const { return job_ != rhs.job_; } - - operator void*() const { return (void*)job_; } - const mer_type& operator*() const { return !canonical_ || m_ < rcm_ ? m_ : rcm_; } - const mer_type* operator->() const { return &this->operator*(); } - mer_qual_iterator& operator++() { - while(true) { - while(cseq_ == eseq_) { - ++index_; - while(index_ >= (*job_)->nb_filled) { - index_ = 0; - job_->next(); - if(job_->is_empty()) { - delete job_; - job_ = 0; - return *this; - } - } - init_from_job(); - filled_ = 0; - } - - do { - const int code = m_.code(*cseq_++); - const char qual = cqual_ < equal_ ? *cqual_++ : std::numeric_limits::max(); - if(code >= 0 && qual >= min_qual_) { - m_.shift_left(code); - if(canonical_) - rcm_.shift_right(rcm_.complement(code)); - filled_ = std::min(filled_ + 1, mer_dna::k()); - } else - filled_ = 0; - } while(filled_ < m_.k() && cseq_ < eseq_); - if(filled_ >= m_.k()) - break; - } - return *this; - } - - mer_qual_iterator operator++(int) { - mer_qual_iterator res(*this); - ++*this; - return res; - } - -private: - void init_from_job() { - std::string& seq = (*job_)->data[index_].seq; - cseq_ = seq.begin(); - eseq_ = seq.end(); - std::string& quals = (*job_)->data[index_].qual; - cqual_ = quals.begin(); - equal_ = quals.end(); - } -}; - -} // namespace jellyfish { - -#endif /* __MER_QUAL_ITERATOR_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/misc.hpp b/src/modifiedJellyfish/include/jellyfish/misc.hpp deleted file mode 100644 index 4aa1a90b..00000000 --- a/src/modifiedJellyfish/include/jellyfish/misc.hpp +++ /dev/null @@ -1,247 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_MISC_HPP__ -#define __JELLYFISH_MISC_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace jellyfish { -#define bsizeof(v) (8 * sizeof(v)) -typedef uint_fast64_t uint_t; -//#define UINT_C(x) -#define PRIUINTu PRIuFAST64 -#define PRIUINTx PRIxFAST64 - -inline int leading_zeroes(int x) { return __builtin_clz(x); } // CLK -inline int leading_zeroes(unsigned int x) { return __builtin_clz(x); } -inline int leading_zeroes(unsigned long x) { return __builtin_clzl(x); } -inline int leading_zeroes(unsigned long long x) { return __builtin_clzll(x); } - -/// The floor of the log base two of n. Undefined if n == 0 -template -uint16_t floorLog2(T n) { - return sizeof(T) * 8 - 1 - leading_zeroes(n); -} - -/// The ceiling of the log base two of n. Undefined if n == 0 -template -uint16_t ceilLog2(T n) { - uint16_t r = floorLog2(n); - return n > (((T)1) << r) ? r + 1 : r; -} - -/// The ceiling of the quotient of the division of a by b. I.e. if b -/// divides a, then div_ceil(a, b) == a / b. Otherwise, div_ceil(a, b) -/// == a / b + 1 -template -T div_ceil(T a, T b) { - T q = a / b; - return a % b == 0 ? q : q + 1; -} - -/// Number of bits necessary to encode number n. Undefined if n == -/// 0. The following should be true: 2^bitsize(n) - 1 >= n > -/// 2^(bitsize(n) - 1) -template -uint16_t bitsize(T n) { - return floorLog2(n) + 1; -} - -inline uint32_t reverse_bits(uint32_t v) { - // swap odd and even bits - v = ((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1); - // swap consecutive pairs - v = ((v >> 2) & 0x33333333) | ((v & 0x33333333) << 2); - // swap nibbles ... - v = ((v >> 4) & 0x0F0F0F0F) | ((v & 0x0F0F0F0F) << 4); - // swap bytes - v = ((v >> 8) & 0x00FF00FF) | ((v & 0x00FF00FF) << 8); - // swap 2-byte long pairs - v = ( v >> 16 ) | ( v << 16); - return v; -} - -inline uint64_t reverse_bits(uint64_t v) { - v = ((v >> 1) & 0x5555555555555555UL) | ((v & 0x5555555555555555UL) << 1); - v = ((v >> 2) & 0x3333333333333333UL) | ((v & 0x3333333333333333UL) << 2); - v = ((v >> 4) & 0x0F0F0F0F0F0F0F0FUL) | ((v & 0x0F0F0F0F0F0F0F0FUL) << 4); - v = ((v >> 8) & 0x00FF00FF00FF00FFUL) | ((v & 0x00FF00FF00FF00FFUL) << 8); - v = ((v >> 16) & 0x0000FFFF0000FFFFUL) | ((v & 0x0000FFFF0000FFFFUL) << 16); - v = ( v >> 32 ) | ( v << 32); - return v; -} - -uint64_t bogus_sum(void *data, size_t len); - -template -size_t bits_to_bytes(T bits) { - return (size_t)((bits / 8) + (bits % 8 != 0)); -} - -template -union Tptr { - void *v; - T *t; -}; -template -T *calloc_align(size_t nmemb, size_t alignment) { - Tptr ptr; - if(posix_memalign(&ptr.v, alignment, sizeof(T) * nmemb) < 0) - throw std::bad_alloc(); - return ptr.t; -} - -/* Be pedantic about memory access. Any misaligned access will - * generate a BUS error. - */ -void disabled_misaligned_mem_access(); - -/* Raison d'etre of this version of mem_copy: It seems we have slow - * down due to misaligned cache accesses. glibc memcpy does unaligned - * memory accesses and crashes when they are disabled. This version - * does only aligned memory access (see above). - */ -template -void mem_copy(char *dest, const char *src, const T &len) { - // dumb copying char by char - for(T i = (T)0; i < len; ++i) - *dest++ = *src++; -} - -/* Slice a large number (total) in almost equal parts. return [start, - end) corresponding to the ith part (0 <= i < number_of_slices) - */ -template -std::pair slice(T i, T number_of_slices, T total) { - const T slice_size = total / number_of_slices; - const T slice_remain = total % number_of_slices; - - const T start = std::max((T)0, - std::min(total, i * slice_size + (i > 0 ? slice_remain : 0))); - const T end = std::max((T)0, - std::min(total, (i + 1) * slice_size + slice_remain)); - - return std::make_pair(start, end); -} - -uint64_t random_bits(int length); -inline uint64_t random_bits() { return random_bits(64); } - -// Quote string that could contain shell special characters -std::string quote_arg(const std::string& arg); - -std::streamoff get_file_size(std::istream& is); - -/// Find the first element for which the predicate p is false. The -/// input range [first, last) is assumed to be sorted according to the -/// predicate p: p(x) is false and p(y) is true implies x comes after -/// y in the input range. (I.e., the elements for which p(x) is true -/// come first followed by the elements for which p(x) is false). -template -ForwardIterator binary_search_first_false(ForwardIterator first, ForwardIterator last, Predicate p) -{ - ForwardIterator it; - typename std::iterator_traits::difference_type count, step; - count = std::distance(first,last); - while(count>0) { - it = first; step = count / 2; std::advance(it,step); - if(p(*it)) { - first = ++it; - count -= step + 1; - } else - count=step; - } - return first; -} - -/// An integer type which behaves like a random pointer to -/// itself. Meaning, with `it(5)`, then `*it == 5` and `*++it == -/// 6`. In other words, it is a pointer to an array `a` initialized -/// with `a[i] = i`, except the array is not instantiated and does not -/// have a fixed size. -template -class pointer_integer : public std::iterator { - T x_; - typedef typename std::iterator super; - public: - typedef T value_type; - typedef typename super::difference_type difference_type; - typedef typename super::pointer pointer; - typedef typename super::reference reference; - typedef typename super::iterator_category iterator_category; - - pointer_integer() : x_(0) { } - explicit pointer_integer(T x) : x_(x) { } - pointer_integer(const pointer_integer& rhs) : x_(rhs.x_) { } - pointer_integer& operator=(const pointer_integer& rhs) { - x_ = rhs.x_; - return *this; - } - pointer_integer& operator++() { ++x_; return *this; } - pointer_integer operator++(int) { - pointer_integer res(*this); - ++x_; - return res; - } - pointer_integer& operator--() { --x_; return *this; } - pointer_integer operator--(int) { - pointer_integer res(*this); - --x_; - return res; - } - - bool operator==(const pointer_integer& rhs) const { return x_ == rhs.x_; } - bool operator!=(const pointer_integer& rhs) const { return x_ != rhs.x_; } - bool operator<(const pointer_integer& rhs) const { return x_ < rhs.x_; } - bool operator>(const pointer_integer& rhs) const { return x_ > rhs.x_; } - bool operator<=(const pointer_integer& rhs) const { return x_ <= rhs.x_; } - bool operator>=(const pointer_integer& rhs) const { return x_ >= rhs.x_; } - - reference operator*() { return x_; } - pointer operator->() { return &x_; } // Probably useless - - difference_type operator-(pointer_integer& rhs) { return x_ - rhs.x_; } - - pointer_integer operator+(T x) const { return pointer_integer(x_ + x); } - pointer_integer operator-(T x) const { return pointer_integer(x_ - x); } - pointer_integer& operator+=(T x) { x_ += x; return *this; } - pointer_integer& operator-=(T x) { x_ -= x; return *this; } - - value_type operator[](T i) const { return x_ + i; } -}; - -template -pointer_integer operator+(T x, pointer_integer& p) { return pointer_integer(x + *p); } -template -pointer_integer operator-(T x, pointer_integer& p) { return pointer_integer(x - *p); } -} // namespace jellyfish - -#endif // __MISC_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/offsets_key_value.hpp b/src/modifiedJellyfish/include/jellyfish/offsets_key_value.hpp deleted file mode 100644 index 4580e761..00000000 --- a/src/modifiedJellyfish/include/jellyfish/offsets_key_value.hpp +++ /dev/null @@ -1,277 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_OFFSETS_KEY_VALUE_HPP__ -#define __JELLYFISH_OFFSETS_KEY_VALUE_HPP__ - -#include -#include -#include - -#include -#include - -namespace jellyfish { - -/* A word is whatever aligned type used for atomic operations - * (CAS). Typically, a uint64_t. We store pairs of (key, value), in a - * bit packed fashion. The key and value can have abritrary size as - * long as they each fit in one word. A block is the largest number of - * (key, value) pair such that the first key, and only the first, - * starts at an aligned word. - * - * The key 0x0 is not valid. A key which fits completely within one - * word is not protected by a "set" bit. A key which straddle the - * boundary between two aligned words has a set bit in each parts. - * - * A value field can have any value and is initialized to 0x0. It has - * no "set" bit ever. - * - * A key is prefixed with a "large" bit. If this bit is 0, the key - * field is length key_len (not counting the possible set bits) and - * the value field has length val_len. If the large bit has value 1, - * the key field is just long enough to encode the number of - * reprobing hops to go backward to find the actual key. The - * remainder bits is used for the value field. In this scheme, we - * assume the length needed to encode the number of reprobes is much - * less than the length needed to encode the key. - * - * The size of the value field, for the normal and large field, is - * capped at 64. If there is more bits available, they are wasted. - */ - -/* Offsets holds all the possible offset for a given combination of - * key length, value length and reprobe limit. - */ -template -class Offsets { -public: - // woff: offset in words from beginning of block - // boff: offset in bits within that word. Paste large bit. - // shift: number of bits stored in first word, or shift to get to beginning of second word - // cshift: number of bits stored in last word - // mask1: includes the large bit and the set bit if any. - // mask2: mask in last word. Contains large and set bit if any. 0 if last word is full - // sb_mask[12]: mask for set bit in words 1 to last-1 and in last word, if any. set bit is the - // last usable bit of the field. - // lb_mask: mask for the large bit. It is the first bit of the key field. - // full words: need to copy full words - typedef struct { - struct key { - unsigned int woff, boff, shift, cshift; - word mask1, mask2, sb_mask1, sb_mask2, lb_mask; - bool full_words; - }; - struct key key; - struct val { - unsigned int woff, boff, shift, cshift; - word mask1, mask2; - }; - struct val val; - } offset_t; - typedef struct { - offset_t normal; - offset_t large; - } offset_pair_t; - struct block_info { - unsigned int len; - unsigned int word_len; - }; - // Offsets() {} - - Offsets(unsigned int _key_len, unsigned int _val_len, unsigned int _reprobe_limit) : - key_len_(_key_len), - val_len_(_val_len), - reprobe_limit_(_reprobe_limit), - reprobe_len_(bitsize(reprobe_limit_)), - lval_len_(std::min(key_len_ + val_len_ - reprobe_len_, (unsigned int)bsizeof(word))), - block(compute_offsets()), - bld(block.len) - { - if(reprobe_len_ > bsizeof(word)) { - std::ostringstream err; - err << "The reprobe_limit (" << reprobe_limit_ << ", " << reprobe_len_ - << ") must be encoded in at most one word (" << bsizeof(word) << ")"; - throw std::length_error(err.str()); - } - if(val_len_ > bsizeof(word)) - throw std::length_error("Val length must be less than the word size"); - if(key_len_ < reprobe_len_) - throw std::length_error("Key length must be at least as large as to encode the reprobe_limit"); - } - - ~Offsets() {} - - unsigned int block_len() const { return block.len; } - unsigned int block_word_len() const { return block.word_len; } - unsigned int reprobe_len() const { return reprobe_len_; } - unsigned int reprobe_limit() const { return reprobe_limit_; } - word reprobe_mask() const { return mask(reprobe_len_, 0); } - unsigned int key_len() const { return key_len_; } - unsigned int val_len() const { return val_len_; } - unsigned int lval_len() const { return lval_len_; } - word get_max_val(bool large) const { - return (((uint64_t)1) << (large ? lval_len_ : val_len_)) - 1; - } - - /// Number of blocks that fit in a given amount of memory. Given an - /// amount of memory mem, it returns the number of blocks that fit - /// into mem and the actual memory this many block use. - std::pair blocks_for_records(size_t nb_records) const { - size_t blocks = nb_records / bld; - return std::make_pair(blocks, blocks * block.len); - } - - word *word_offset(size_t id, const offset_t **o, const offset_t **lo, word * const base) const { - uint64_t q, r; - bld.division(id, q, r); - word *w = base + (block.word_len * q); - *o = &offsets[r].normal; - *lo = &offsets[r].large; - return w; - } - -private: - const unsigned int key_len_, val_len_; - const unsigned int reprobe_limit_, reprobe_len_, lval_len_; - const block_info block; - const jflib::divisor64 bld; // Fast divisor by block.len - offset_pair_t offsets[bsizeof(word)]; - - block_info compute_offsets(); - bool add_key_offsets(unsigned int &cword, unsigned int &cboff, unsigned int add, bool& full_words); - bool add_val_offsets(unsigned int &cword, unsigned int &cboff, unsigned int add); - void set_key_offsets(Offsets::offset_t& key, unsigned int& cword, unsigned int& cboff, unsigned int len); - void set_val_offsets(Offsets::offset_t& val, unsigned int& cword, unsigned int& cboff, unsigned int len); - word mask(unsigned int length, unsigned int shift) const; -}; - -template -bool Offsets::add_key_offsets(unsigned int &cword, unsigned int &cboff, unsigned int add, bool& full_words) -{ - if(cboff + add <= bsizeof(word)) { // Not spilling over next word - cboff = (cboff + add) % bsizeof(word); - cword += (cboff == 0); - return false; - } - - // Span multiple words. Take into account the extra set bit, one in each word - size_t wcap = bsizeof(word) - 1; // Word capacity withouth set bit - add -= wcap - cboff; // Substract bits stored in first partial word including set bit - full_words = add >= wcap; - cword += 1 + add / wcap; // Add first word plus any extra complete word - cboff = add % wcap; // Extra bits in last word - cboff += cboff > 0; // Add set bit in last word if use partial word - return true; -} - -template -bool Offsets::add_val_offsets(unsigned int &cword, unsigned int &cboff, unsigned int add) -{ - unsigned int ocword = cword; - cboff += add; - cword += cboff / bsizeof(word); - cboff = cboff % bsizeof(word); - return cword > ocword && cboff > 0; -} - -template -word Offsets::mask(unsigned int length, unsigned int shift) const -{ - if(length) - return (((word)-1) >> (bsizeof(word) - length)) << shift; - return (word)0; -} - -template -void Offsets::set_key_offsets(Offsets::offset_t& offset, unsigned int& cword, unsigned int& cboff, unsigned int len) { - unsigned int ocboff; - bool full_words; - - offset.key.woff = cword; - ocboff = cboff; - offset.key.boff = cboff + 1; - offset.key.lb_mask = mask(1, cboff); - if(add_key_offsets(cword, cboff, len + 1, full_words)) { - // Extra bits in last extra word - offset.key.mask1 = mask(bsizeof(word) - ocboff, ocboff); - offset.key.mask2 = mask(cboff, 0); - offset.key.shift = bsizeof(word) - 1 - ocboff - 1; // -1 for large bit, -1 for set bit - offset.key.cshift = cboff ? cboff - 1 : 0; - offset.key.sb_mask1 = mask(1, bsizeof(word) - 1); - offset.key.sb_mask2 = cboff ? mask(1, cboff - 1) : 0; - offset.key.full_words = full_words; - } else { - offset.key.mask1 = mask(len + 1, ocboff); - offset.key.mask2 = 0; - offset.key.shift = 0; - offset.key.cshift = 0; - offset.key.sb_mask1 = 0; - offset.key.sb_mask2 = 0; - offset.key.full_words = false; - } -} - -template -void Offsets::set_val_offsets(Offsets::offset_t& offset, unsigned int& cword, unsigned int& cboff, unsigned int len) { - unsigned int ocboff; - - offset.val.woff = cword; - offset.val.boff = cboff; - ocboff = cboff; - if(add_val_offsets(cword, cboff, len)) { - offset.val.mask1 = mask(bsizeof(uint64_t) - ocboff, ocboff); - offset.val.mask2 = mask(cboff, 0); - offset.val.shift = len - cboff; - offset.val.cshift = cboff; - } else { - offset.val.mask1 = mask(len, ocboff); - offset.val.mask2 = 0; - offset.val.shift = len; - offset.val.cshift = 0; - } -} - -template -typename Offsets::block_info Offsets::compute_offsets() -{ - offset_pair_t *offset = offsets; - unsigned int cword = 0; // current word in block - unsigned int cboff = 0; // current offset in word - unsigned int lcword; // idem for large fields - unsigned int lcboff; - - memset(offsets, '\0', sizeof(offsets)); - do { - // Save current offsets as starting point for large key - lcword = cword; - lcboff = cboff; - - set_key_offsets(offset->normal, cword, cboff, key_len_); - set_val_offsets(offset->normal, cword, cboff, val_len_); - - set_key_offsets(offset->large, lcword, lcboff, reprobe_len_); - set_val_offsets(offset->large, lcword, lcboff, lval_len_); - - offset++; - } while(cboff != 0 && cboff < bsizeof(word) - 2); - - block_info res = { static_cast(offset - offsets), cword + (cboff == 0 ? 0 : 1) }; - return res; -} -} // namespace jellyfish - -#endif // __OFFSETS_KEY_VALUE_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/rectangular_binary_matrix.hpp b/src/modifiedJellyfish/include/jellyfish/rectangular_binary_matrix.hpp deleted file mode 100644 index 75ab7948..00000000 --- a/src/modifiedJellyfish/include/jellyfish/rectangular_binary_matrix.hpp +++ /dev/null @@ -1,379 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_RECTANGULAR_BINARY_MATRIX_HPP__ -#define __JELLYFISH_RECTANGULAR_BINARY_MATRIX_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_CONFIG_H -#include -#endif - -// Column major representation -// -// Rectangular matrices on Z/2Z of size _r x _c where 1<=_r<=64 (_c is -// not limited) and _r <= _c. I.e., the matrix can be stored as an -// array of 64 bit word, each representing a column (the highest 64-_r -// bits of each word are set to 0). -// -// Multiplication between a matrix and vector of size _c x 1 gives a -// vector of size _r x 1 stored as one 64 bit word. - -namespace jellyfish { - class RectangularBinaryMatrix { - public: - RectangularBinaryMatrix(unsigned int r, unsigned c) - : _columns(alloc(r, c)), _r(r), _c(c) { } - RectangularBinaryMatrix(const RectangularBinaryMatrix &rhs) - : _columns(alloc(rhs._r, rhs._c)), _r(rhs._r), _c(rhs._c) { - memcpy(_columns, rhs._columns, sizeof(uint64_t) * _c); - } - RectangularBinaryMatrix(RectangularBinaryMatrix&& rhs) : - _columns(rhs._columns), _r(rhs._r), _c(rhs._c) { - rhs._columns = 0; - } - // Initialize from raw data. raw must contain at least c words. - template - RectangularBinaryMatrix(const T &raw, unsigned int r, unsigned c) - : _columns(alloc(r, c)), _r(r), _c(c) { - for(unsigned int i = 0; i < _c; ++i) - _columns[i] = raw[i] & cmask(); - } - ~RectangularBinaryMatrix() { - free(_columns); - } - - RectangularBinaryMatrix &operator=(const RectangularBinaryMatrix &rhs) { - if(_r != rhs._r || _c != rhs._c) - throw std::invalid_argument("RHS matrix dimensions do not match"); - memcpy(_columns, rhs._columns, sizeof(uint64_t) * _c); - return *this; - } - RectangularBinaryMatrix& operator=(RectangularBinaryMatrix&& rhs) { - if(_r != rhs._r || _c != rhs._c) - throw std::invalid_argument("RHS matrix dimensions do not match"); - std::swap(_columns, rhs._columns); - return *this; - } - - bool operator==(const RectangularBinaryMatrix &rhs) const { - if(_r != rhs._r || _c != rhs._c) - return false; - return !memcmp(_columns, rhs._columns, sizeof(uint64_t) * _c); - } - bool operator!=(const RectangularBinaryMatrix &rhs) const { - return !(*this == rhs); - } - - // Get i-th column. No check on range - const uint64_t & operator[](unsigned int i) const { return _columns[i]; } - - unsigned int r() const { return _r; } - unsigned int c() const { return _c; } - - // True if every column is zero - bool is_zero() const { - uint64_t *p = _columns; - while(*p == 0 && p < _columns + _c) - ++p; - return (p - _columns) == _c; - } - - // Randomize the content of the matrix - void randomize(uint64_t (*rng)()) { - for(unsigned int i = 0; i < _c; ++i) - _columns[i] = rng() & cmask(); - } - //void randomize() { randomize(rng); } - - // Make and check that the matrix the lower right corner of the - // identity. - void init_low_identity(); - bool is_low_identity(); - - // Left matrix vector multiplication. Type T supports the operator - // v[i] to return the i-th 64 bit word of v. - template - uint64_t times_loop(const T &v) const; - - -#ifdef HAVE_SSE - // This SSE implementation only works if the number of columns is - // even. - template - uint64_t times_sse(const T &v) const; -#endif - -#ifdef HAVE_INT128 - // Implementation using __int128 - template - uint64_t times_128(const T& v) const; -#endif - - template - inline uint64_t times(const T& v) const { -#ifdef HAVE_SSE - return times_sse(v); -#elif HAVE_INT128 - return times_128(v); -#else - return times_loop(v); -#endif - } - - // Return a matrix which is the "pseudo inverse" of this matrix. It - // is assumed that there is above this square matrix an identity - // block and a zero so as to make the matrix squared. Raise an - // exception std::domain_error if the matrix is singular. - RectangularBinaryMatrix pseudo_inverse() const; - - // Return the multiplication of this and rhs. As in pseudo_inverse, - // the two matrices are viewed as being squared, padded above by the - // identity. - RectangularBinaryMatrix pseudo_multiplication(const RectangularBinaryMatrix &rhs) const; - - // Initialize the object with a pseudo-invertible matrix and return its pseudo-inverse - RectangularBinaryMatrix randomize_pseudo_inverse(uint64_t (*rng)()); - RectangularBinaryMatrix randomize_pseudo_inverse() { return randomize_pseudo_inverse(random_bits); } - - // Return the rank of the matrix. The matrix is assumed to be - // squared, padded above by the identity. - unsigned int pseudo_rank() const; - - // Display matrix - void print(std::ostream &os) const; - template - void print_vector(std::ostream &os, const T &v) const; - - // Nb words in vector for multiplication - uint64_t nb_words() const { return (_c >> 6) + ((_c & 0x3f) != 0); } - // Mask of most significant bit in most significant word of a vector - // with _c rows. - uint64_t msb() const { - int shift = _c & 0x3f; - if(shift == 0) - shift = sizeof(uint64_t) * 8; - return (uint64_t)1 << (shift - 1); - } - - private: - // Store column by column. A column may use one word. By - // convention, the "unused" bits (most significant bits) of each - // column are set to 0. - uint64_t * _columns; - const unsigned int _r, _c; - - static uint64_t *alloc(unsigned int r, unsigned int c) __attribute__((malloc)); - // Mask for column word (zero msb) - uint64_t cmask() const { return std::numeric_limits::max() >> (std::numeric_limits::digits - _r); } - // Mask of highest word of a vector with _c rows (Most Significant - // Word) - uint64_t msw() const { return (msb() << 1) - 1; } - // Nb of bits used in highest word of vector with _c rows. - uint64_t nb_msb() const { - uint64_t nb = _c & 0x3f; - return nb ? nb : sizeof(uint64_t) * 8; - } - // Allow to change the matrix vectors. No check on i. - uint64_t & get(unsigned int i) { return _columns[i]; } - }; - - template - uint64_t RectangularBinaryMatrix::times_loop(const T &v) const { - uint64_t *p = _columns + _c - 1; - uint64_t res = 0, x = 0, j = 0; - const uint64_t one = (uint64_t)1; - - for(unsigned int i = 0; i < nb_words(); ++i) { - j = sizeof(uint64_t) * 8; - x = v[i]; - if(i == nb_words() - 1) { - x &= msw(); - j = nb_msb(); - } - for( ; j > 7; j -= 8, p -= 8) { - res ^= (-(x & one)) & p[0]; x >>= 1; - res ^= (-(x & one)) & p[-1]; x >>= 1; - res ^= (-(x & one)) & p[-2]; x >>= 1; - res ^= (-(x & one)) & p[-3]; x >>= 1; - res ^= (-(x & one)) & p[-4]; x >>= 1; - res ^= (-(x & one)) & p[-5]; x >>= 1; - res ^= (-(x & one)) & p[-6]; x >>= 1; - res ^= (-(x & one)) & p[-7]; x >>= 1; - } - } - - // Finish the loop - switch(j) { - case 7: res ^= (-(x & one)) & *p--; x >>= 1; - case 6: res ^= (-(x & one)) & *p--; x >>= 1; - case 5: res ^= (-(x & one)) & *p--; x >>= 1; - case 4: res ^= (-(x & one)) & *p--; x >>= 1; - case 3: res ^= (-(x & one)) & *p--; x >>= 1; - case 2: res ^= (-(x & one)) & *p--; x >>= 1; - case 1: res ^= (-(x & one)) & *p; - } - - return res; - } - -#ifdef HAVE_SSE - template - uint64_t RectangularBinaryMatrix::times_sse(const T &v) const { -#define FFs ((uint64_t)-1) - static const uint64_t smear[8] asm("smear") __attribute__ ((aligned(16),used)) = - {0, 0, 0, FFs, FFs, 0, FFs, FFs}; - typedef uint64_t xmm_t __attribute__((vector_size(16))); - - uint64_t *p = _columns + _c - 8; - - // //#ifdef __ICC - // register xmm_t acc; - // register xmm_t load; - // memset(&acc, '\0', 16); - // memset(&load, '\0', 16); - // #else -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wuninitialized" -#endif - xmm_t acc = acc ^ acc; // Set acc to 0 - xmm_t load = load ^ load; -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - // #endif - -// // Zero out acc -// #pragma GCC diagnostic push -// #pragma GCC diagnostic ignored "-Wuninitialized" -// asm("pxor %0,%0\n\t" : "=x"(acc) : "0"(acc)); -// asm("pxor %0,%0\n\t" : "=x"(load) : "0"(load)); -// #pragma GCC diagnostic pop - - // i is the lower 2 bits of x, and an index into the smear array. Compute res ^= smear[i] & p[j]. -#define AND_XOR(off) \ - asm("movdqa (%[s],%[i]), %[load]\n\t" \ - "pand " off "(%[p]),%[load]\n\t" \ - "pxor %[load],%[acc]\n\t" \ - : [acc]"=&x"(acc) \ - : "[acc]"(acc), [i]"r"(i), [p]"r"(p), [s]"r"(smear), [load]"x"(load)) - - - uint64_t i, j = 0, x = 0; - for(unsigned int w = 0; w < nb_words(); ++w) { - x = v[w]; - j = sizeof(uint64_t) * 8; - if(w == nb_words() - 1) { - x &= msw(); - j = nb_msb(); - } - for( ; j > 7; j -= 8, p -= 8) { - i = (x & (uint64_t)0x3) << 4; - AND_XOR("0x30"); - x >>= 2; - i = (x & (uint64_t)0x3) << 4; - AND_XOR("0x20"); - x >>= 2; - i = (x & (uint64_t)0x3) << 4; - AND_XOR("0x10"); - x >>= 2; - i = (x & (uint64_t)0x3) << 4; - AND_XOR(""); - x >>= 2; - } - } - - // Finish loop - p = _columns; - switch(j) { - case 6: - i = (x & (uint64_t)0x3) << 4; - AND_XOR("0x20"); - x >>= 2; - case 4: - i = (x & (uint64_t)0x3) << 4; - AND_XOR("0x10"); - x >>= 2; - case 2: - i = (x & (uint64_t)0x3) << 4; - AND_XOR(""); - } - - // Get result out - uint64_t res1, res2; - asm("movd %[acc], %[res1]\n\t" - "psrldq $8, %[acc]\n\t" - "movd %[acc], %[res2]\n\t" - : [res1]"=r"(res1), [res2]"=r"(res2) - : [acc]"x"(acc)); - return res1 ^ res2; - } -#endif // HAVE_SSE - -#ifdef HAVE_INT128 - template - uint64_t RectangularBinaryMatrix::times_128(const T &v) const { - typedef unsigned __int128 u128; - static const u128 smear[4] = - { (u128)0, - (((u128)1 << 64) - 1) << 64, - ((u128)1 << 64) - 1, - (u128)-1 - };\ - u128 res = res ^ res; - u128* p = (u128*)(_columns + _c - 2); - - uint64_t j = 0, x = 0; - for(unsigned int w = 0; w < nb_words(); ++w) { - x = v[w]; - j = sizeof(uint64_t) * 8; - if(w == nb_words() - 1) { - x &= msw(); - j = nb_msb(); - } - for( ; j > 7; j -= 8, p -= 4) { - res ^= smear[x & (uint64_t)0x3] & p[ 0]; x >>= 2; - res ^= smear[x & (uint64_t)0x3] & p[-1]; x >>= 2; - res ^= smear[x & (uint64_t)0x3] & p[-2]; x >>= 2; - res ^= smear[x & (uint64_t)0x3] & p[-3]; x >>= 2; - } - } - - switch(j) { - case 6: res ^= smear[x & (uint64_t)0x3] & *p--; x >>=2; - case 4: res ^= smear[x & (uint64_t)0x3] & *p--; x >>=2; - case 2: res ^= smear[x & (uint64_t)0x3] & *p; - } - - return (res ^ (res >> 64)) & smear[2]; - } -#endif // HAVE_INT128 - -} - -#endif diff --git a/src/modifiedJellyfish/include/jellyfish/simple_circular_buffer.hpp b/src/modifiedJellyfish/include/jellyfish/simple_circular_buffer.hpp deleted file mode 100644 index 16cc2ba9..00000000 --- a/src/modifiedJellyfish/include/jellyfish/simple_circular_buffer.hpp +++ /dev/null @@ -1,135 +0,0 @@ -/* Jellyfish - * Copyright (C) 2012 Genome group at University of Maryland. - * - * 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 . - */ - -#ifndef __SIMPLE_CIRCULAR_BUFFER_H__ -#define __SIMPLE_CIRCULAR_BUFFER_H__ - -#include - -namespace jellyfish { - namespace simple_circular_buffer { - - // T: type of element in container. D: type of derived class for - // CRTP. A: allocator type. - template - class base { - public: - explicit base(T* data) : - data_(data), front_(0), back_(0), full_(false) - { } - - // Return true if empty - bool empty() const { - return front_ == back_ && !full(); - } - // Return true if full - bool full() const { - return full_; - } - void clear() { - front_ = back_; - full_ = false; - } - - // Valid only if empty() is false - T& front() { - return data_[front_]; - } - // Valid only if empty() is false - T& back() { - return data_[prev_index(back_)]; - } - - // Unlike the corresponding method on list or deqeue, push_back may - // fail if full() is true. Then false is returned. - bool push_back(const T& x) { - if(full()) - return false; - data_[back_] = x; - back_ = next_index(back_); - full_ = back_ == front_; - return true; - } - - bool push_back() { - if(full()) - return false; - back_ = next_index(back_); - full_ = back_ == front_; - return true; - } - - // Pop an element from the front. It has no effect if empty() is true - void pop_front() { - if(empty()) - return; - front_ = next_index(front_); - full_ = false; - } - - int size() const { - if(full()) - return static_cast(this)->capacity(); - int s = back_ - front_; - return s < 0 ? s + static_cast(this)->capacity() : s; - } - - protected: - int next_index(int i) const { - return (i + 1) % static_cast(this)->capacity(); - } - int prev_index(int i) const { - return i ? i - 1 : static_cast(this)->capacity() - 1; - } - T* data() const { return data_; } - - T* data_; - int front_, back_; - bool full_; - }; - - template - class pre_alloc : public base > { - typedef base > super; - public: - static const int capacityConstant = capa; - explicit pre_alloc(T* data) : super(data) { } - static int capacity() { return capa; } - }; - - // template > - // class fixed : public base, A> { - // typedef base, A> super; - // public: - // explicit fixed(const T v = T()) : super(capa, v) { } - // // fixed(const int ignored_size, const T v = T()) : super(capa, v) { } - - // int capacity() const { return capa; } - // }; - - // template > - // class dyn : public base, A> { - // typedef base, A> super; - // public: - // explicit dyn(int size, const T v = T()) : super(size, v), capa_(size) { } - - // int capacity() const { return capa_; } - // int capa_; - // }; - } -} -#endif /* __SIMPLE_CIRCULAR_BUFFER_H__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/sorted_dumper.hpp b/src/modifiedJellyfish/include/jellyfish/sorted_dumper.hpp deleted file mode 100644 index c18fb32f..00000000 --- a/src/modifiedJellyfish/include/jellyfish/sorted_dumper.hpp +++ /dev/null @@ -1,115 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_SORTED_DUMPER_HPP__ -#define __JELLYFISH_SORTED_DUMPER_HPP__ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace jellyfish { -/// Sorted dumper. Write mers according to the hash order. It -/// implements the CRTP to effectively write the k-mer/value pair. -template -class sorted_dumper : public dumper_t, public thread_exec { -protected: - typedef typename storage_t::key_type key_type; - typedef typename storage_t::region_iterator iterator; - typedef typename mer_heap::heap heap_type; - typedef typename heap_type::const_item_t heap_item; - typedef jellyfish::token_ring token_ring; - typedef typename token_ring::token token_type; - - int nb_threads_; - token_ring ring_; - const char* file_prefix_; - storage_t* ary_; - file_header* header_; - bool zero_array_; - std::ofstream out_; - std::pair block_info; // { nb blocks, nb records } - -public: - sorted_dumper(int nb_threads, const char* file_prefix, file_header* header = 0) : - nb_threads_(nb_threads), - ring_(nb_threads), - file_prefix_(file_prefix), - header_(header), - zero_array_(true) - { } - - bool zero_array() const { return zero_array_; } - void zero_array(bool v) { zero_array_ = v; } - - virtual void _dump(storage_t* ary) { - ary_ = ary; - block_info = ary_->blocks_for_records(5 * ary_->max_reprobe_offset()); - - this->open_next_file(file_prefix_, out_); - if(header_) - header_->write(out_); - - ring_.reset(); - exec_join(nb_threads_); - out_.close(); - if(zero_array_) - ary_->zero_blocks(0, block_info.first); // zero out last group of blocks - } - - virtual void start(const int i) { - std::ostringstream buffer; - heap_type heap(ary_->max_reprobe_offset()); - token_type& token = ring_[i]; - size_t count = 0; - typename storage_t::key_type key; - - for(size_t id = i; id * block_info.second < ary_->size(); id += nb_threads_) { - // Fill buffer - iterator it(ary_, id * block_info.second, (id + 1) * block_info.second, key); - heap.fill(it); - - while(heap.is_not_empty()) { - heap_item item = heap.head(); - if(item->val_ >= this->min() && item->val_ <= this->max()) - static_cast(this)->write_key_value_pair(buffer, item); - ++count; - heap.pop(); - if(it.next()) - heap.push(it); - } - - // Write buffer - token.wait(); - out_.write(buffer.str().data(), buffer.tellp()); - token.pass(); - - buffer.seekp(0); - if(id > 0 && zero_array_) - ary_->zero_blocks(id * block_info.first, block_info.first); - } - } -}; -} // namespace jellyfish { - -#endif /* __JELLYFISH_SORTED_DUMPER_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/stdio_filebuf.hpp b/src/modifiedJellyfish/include/jellyfish/stdio_filebuf.hpp deleted file mode 100644 index 7aa3a9e1..00000000 --- a/src/modifiedJellyfish/include/jellyfish/stdio_filebuf.hpp +++ /dev/null @@ -1,170 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_STDIO_FILEBUF_HPP__ -#define __JELLYFISH_STDIO_FILEBUF_HPP__ - -#include -#include -#include -#include - -#include -#include - -// Attempt to be (mostly) compatible with GCC ext/stdio_filebuf.h -// class. Contains code from stdio_filbuf.hpp and -// http://www.mr-edd.co.uk/blog/beginners_guide_streambuf. It is only -// meant as a quick replacement when stdio_filebuf is not available. - -namespace jellyfish { -template > -class stdio_filebuf : public std::basic_streambuf<_CharT, _Traits> -{ - const int fd_; - FILE* const file_; - const std::ios_base::openmode mode_; - const size_t put_back_; - std::vector<_CharT> buffer_; - -public: - // Types: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - // typedef std::size_t size_t; - - /** - * @param __fd An open file descriptor. - * @param __mode Same meaning as in a standard filebuf. - * @param __size Optimal or preferred size of internal buffer, - * in chars. - * - * This constructor associates a file stream buffer with an open - * POSIX file descriptor. The file descriptor will be automatically - * closed when the stdio_filebuf is closed/destroyed. - */ - stdio_filebuf(int __fd, std::ios_base::openmode __mode, - size_t __size = static_cast(BUFSIZ), - size_t put_back = 1) : - fd_(__fd), - file_(0), - mode_(__mode), - put_back_(std::max(put_back, (size_t)1)), - buffer_(std::max(__size, put_back_) + put_back_) - { - _CharT* end = buffer_.data() + buffer_.size(); - this->setg(end, end, end); - } - - /** - * @param __f An open @c FILE*. - * @param __mode Same meaning as in a standard filebuf. - * @param __size Optimal or preferred size of internal buffer, - * in chars. Defaults to system's @c BUFSIZ. - * - * This constructor associates a file stream buffer with an open - * C @c FILE*. The @c FILE* will not be automatically closed when the - * stdio_filebuf is closed/destroyed. - */ - stdio_filebuf(FILE* __f, std::ios_base::openmode __mode, - size_t __size = static_cast(BUFSIZ), - size_t put_back = 1) : - fd_(-1), - file_(__f), - mode_(__mode), - put_back_(std::max(put_back, (size_t)1)), - buffer_(std::max(__size, put_back_) + put_back_) - { - _CharT* end = buffer_.data() + buffer_.size(); - this->setg(end, end, end); - } - - /** - * Closes the external data stream if the file descriptor constructor - * was used. - */ - virtual ~stdio_filebuf() { - if(fd_ != -1) - close(fd_); - } - - /** - * @return The underlying file descriptor. - * - * Once associated with an external data stream, this function can be - * used to access the underlying POSIX file descriptor. Note that - * there is no way for the library to track what you do with the - * descriptor, so be careful. - */ - int - fd() { return fd_ != -1 ? fd_ : fileno(file_); } - - /** - * @return The underlying FILE*. - * - * This function can be used to access the underlying "C" file pointer. - * Note that there is no way for the library to track what you do - * with the file, so be careful. - */ - FILE* - file() { - if(file_) return file_; - const char* str_mode; - if(mode_ & std::ios_base::app) { - str_mode = "a+"; - } else if(mode_ & std::ios_base::ate) { - str_mode = "a"; - } else if(mode_ & std::ios_base::in) { - str_mode = (mode_ & std::ios_base::out) ? "r+" : "r"; - } else if(mode_ & std::ios_base::out) { - str_mode = "w"; - } - return fdopen(fd_, str_mode); - } - -private: - int_type underflow() { - if(this->gptr() >= this->egptr()) { - _CharT *base = buffer_.data(); - _CharT *start = base; - - if (this->eback() == base) { - // Make arrangements for putback characters - std::memcpy(base, this->egptr() - put_back_, put_back_ * sizeof(_CharT)); - start += put_back_; - } - - // start is now the start of the buffer, proper. - // Read from fptr_ in to the provided buffer - const ssize_t n = - (fd_ != -1) ? - read(fd_, start, (buffer_.size() - (start - base)) * sizeof(_CharT)) : - std::fread(start, sizeof(_CharT), buffer_.size() - (start - base), file_); - if (n <= 0) - return _Traits::eof(); - - // Set buffer pointers - this->setg(base, start, start + n); - } - return _Traits::to_int_type(*this->gptr()); - } - -}; -} // namespace jellyfish { -#endif // __JELLYFISH_STDIO_FILEBUF_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/storage.hpp b/src/modifiedJellyfish/include/jellyfish/storage.hpp deleted file mode 100644 index 3df85cfb..00000000 --- a/src/modifiedJellyfish/include/jellyfish/storage.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_STORAGE_HPP__ -#define __JELLYFISH_STORAGE_HPP__ - -#include -#include -#include - -namespace jellyfish { - - class storage_t { - public: - storage_t() {} - virtual ~storage_t() {} - }; - - // Entry 0 is used only when switching to a large field - extern const size_t *quadratic_reprobes; - -} - -#endif // __STORAGE_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/stream_iterator.hpp b/src/modifiedJellyfish/include/jellyfish/stream_iterator.hpp deleted file mode 100644 index 6f877c8e..00000000 --- a/src/modifiedJellyfish/include/jellyfish/stream_iterator.hpp +++ /dev/null @@ -1,90 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#ifndef __STREAM_ITERATOR_HPP__ -#define __STREAM_ITERATOR_HPP__ - -#include - -#include -#include -#include -#include -#include - -#include - -namespace jellyfish { -/// Transform an iterator of paths (c string: const char*) into an -/// iterator of std::ifstream. Every file is opened and closed in -/// turn. The object instantiated with no argument is the end marker. -template -class stream_iterator : public std::iterator { - PathIterator begin_, end_; - std::ifstream* stream_; -public: - stream_iterator(PathIterator begin, PathIterator end) : - begin_(begin), end_(end), stream_(0) - { - if(begin_ != end_) { - stream_ = new std::ifstream; - open_file(); - } - } - stream_iterator(const stream_iterator& rhs) : - begin_(rhs.begin_), end_(rhs.end_), stream_(rhs.stream_) - { } - stream_iterator() : begin_(), end_(), stream_() { } - - bool operator==(const stream_iterator& rhs) const { - return stream_ == rhs.stream_; - } - bool operator!=(const stream_iterator& rhs) const { - return stream_ != rhs.stream_; - } - - std::ifstream& operator*() { return *stream_; } - std::ifstream* operator->() { return stream_; } - - stream_iterator& operator++() { - stream_->close(); - if(++begin_ != end_) { - open_file(); - } else { - delete stream_; - stream_ = 0; - } - - return *this; - } - stream_iterator operator++(int) { - stream_iterator res(*this); - ++*this; - return res; - } - -protected: - void open_file() { - stream_->open(*begin_); - if(stream_->fail()) - throw std::runtime_error(err::msg() << "Failed to open file '" << *begin_ << "'"); - } -}; - -} - -#endif /* __STREAM_ITERATOR_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/stream_manager.hpp b/src/modifiedJellyfish/include/jellyfish/stream_manager.hpp deleted file mode 100644 index 5b317087..00000000 --- a/src/modifiedJellyfish/include/jellyfish/stream_manager.hpp +++ /dev/null @@ -1,157 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace jellyfish { -template -class stream_manager { - /// A wrapper around an ifstream for a standard file. Standard in - /// opposition to a pipe_stream below, but the file may be a regular - /// file or a pipe. The file is opened once and notifies the manager - /// that it is closed upon destruction. - class file_stream : public std::ifstream { - stream_manager& manager_; - public: - file_stream(const char* path, stream_manager& manager) : - std::ifstream(path), - manager_(manager) - { - manager_.take_file(); - } - virtual ~file_stream() { manager_.release_file(); } - }; - friend class file_stream; - - /// A wrapper around an ifstream for a "multi pipe". The multi pipe - /// are connected to generators (external commands generating - /// sequence). They are opened repeatedly, until they are unlinked - /// from the file system. - class pipe_stream : public std::ifstream { - const char* path_; - stream_manager& manager_; - public: - pipe_stream(const char* path, stream_manager& manager) : - std::ifstream(path), - path_(path), - manager_(manager) - { } - virtual ~pipe_stream() { manager_.release_pipe(path_); } - }; - friend class pipe_stream; - - typedef std::unique_ptr stream_type; - - PathIterator paths_cur_, paths_end_; - int files_open_; - const int concurrent_files_; - std::list free_pipes_; - std::set busy_pipes_; - locks::pthread::mutex_recursive mutex_; - -public: - define_error_class(Error); - - stream_manager(PathIterator paths_begin, PathIterator paths_end, int concurrent_files = 1) : - paths_cur_(paths_begin), paths_end_(paths_end), - files_open_(0), - concurrent_files_(concurrent_files) - { } - - stream_manager(PathIterator paths_begin, PathIterator paths_end, - PathIterator pipe_begin, PathIterator pipe_end, - int concurrent_files = 1) : - paths_cur_(paths_begin), paths_end_(paths_end), - files_open_(0), - concurrent_files_(concurrent_files), - free_pipes_(pipe_begin, pipe_end) - { } - - stream_type next() { - locks::pthread::mutex_lock lock(mutex_); - stream_type res; - open_next_file(res); - if(!res) - open_next_pipe(res); - return res; - } - - int concurrent_files() const { return concurrent_files_; } - // Number of pipes available. Not thread safe - int concurrent_pipes() const { return free_pipes_.size() + busy_pipes_.size(); } - // Number of streams available. Not thread safe - int nb_streams() const { return concurrent_files() + concurrent_pipes(); } - -protected: - void open_next_file(stream_type& res) { - if(files_open_ >= concurrent_files_) - return; - while(paths_cur_ != paths_end_) { - std::string path = *paths_cur_; - ++paths_cur_; - res.reset(new file_stream(path.c_str(), *this)); - if(res->good()) - return; - res.reset(); - throw std::runtime_error(err::msg() << "Can't open file '" << path << "'"); - } - } - - void open_next_pipe(stream_type& res) { - while(!free_pipes_.empty()) { - const char* path = free_pipes_.front(); - free_pipes_.pop_front(); - res.reset(new pipe_stream(path, *this)); - if(res->good()) { - busy_pipes_.insert(path); - return; - } - // The pipe failed to open, so it is not marked as busy. This - // reset will make us forget about this path. - res.reset(); - } - } - - void take_file() { - locks::pthread::mutex_lock lock(mutex_); - ++files_open_; - } - - void release_file() { - locks::pthread::mutex_lock lock(mutex_); - --files_open_; - } - - // void take_pipe(const char* path) { - // locks::pthread::mutex_lock lock(mutex_); - // } - void release_pipe(const char* path) { - locks::pthread::mutex_lock lock(mutex_); - if(busy_pipes_.erase(path) == 0) - return; // Nothing erased. We forget about that path - free_pipes_.push_back(path); - } -}; -} // namespace jellyfish diff --git a/src/modifiedJellyfish/include/jellyfish/text_dumper.hpp b/src/modifiedJellyfish/include/jellyfish/text_dumper.hpp deleted file mode 100644 index 334a491b..00000000 --- a/src/modifiedJellyfish/include/jellyfish/text_dumper.hpp +++ /dev/null @@ -1,88 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_TEXT_DUMPER_HPP__ -#define __JELLYFISH_TEXT_DUMPER_HPP__ - -#include - -namespace jellyfish { -template -class text_writer { -public: - void write(std::ostream& out, const Key& key, const Val val) { - out << key << " " << val << "\n"; - } -}; - -template -class text_dumper : public sorted_dumper, storage_t> { - typedef sorted_dumper, storage_t> super; - text_writer writer; - -public: - static const char* format; - - text_dumper(int nb_threads, const char* file_prefix, file_header* header = 0) : - super(nb_threads, file_prefix, header) - { } - - virtual void _dump(storage_t* ary) { - if(super::header_) { - super::header_->update_from_ary(*ary); - super::header_->format(format); - } - super::_dump(ary); - } - - void write_key_value_pair(std::ostream& out, typename super::heap_item item) { - writer.write(out, item->key_, item->val_); - } -}; -template -const char* jellyfish::text_dumper::format = "text/sorted"; - -template -class text_reader { - std::istream& is_; - char* buffer_; - Key key_; - Val val_; - const RectangularBinaryMatrix m_; - const size_t size_mask_; - -public: - text_reader(std::istream& is, - file_header* header) : - is_(is), - buffer_(new char[header->key_len() / 2 + 1]), - key_(header->key_len() / 2), - m_(header->matrix()), - size_mask_(header->size() - 1) - { } - - const Key& key() const { return key_; } - const Val& val() const { return val_; } - size_t pos() const { return m_.times(key()) & size_mask_; } - - bool next() { - is_ >> key_ >> val_; - return is_.good(); - } -}; -} - -#endif /* __JELLYFISH_TEXT_DUMPER_HPP__ */ diff --git a/src/modifiedJellyfish/include/jellyfish/thread_exec.hpp b/src/modifiedJellyfish/include/jellyfish/thread_exec.hpp deleted file mode 100644 index 0f6813b7..00000000 --- a/src/modifiedJellyfish/include/jellyfish/thread_exec.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_THREAD_EXEC_HPP__ -#define __JELLYFISH_THREAD_EXEC_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace jellyfish { -class thread_exec { - struct thread_info { - int id; - pthread_t thid; - thread_exec *self; - }; - static void *start_routine(void *); - std::vector infos; - -public: - define_error_class(Error); - thread_exec() {} - virtual ~thread_exec() {} - virtual void start(int id) = 0; - void exec(int nb_threads); - void join(); - void exec_join(int nb_threads) { - exec(nb_threads); - join(); - } -}; -} // namespace jellyfish { - -#endif // __THREAD_EXEC_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/time.hpp b/src/modifiedJellyfish/include/jellyfish/time.hpp deleted file mode 100644 index e490c1cd..00000000 --- a/src/modifiedJellyfish/include/jellyfish/time.hpp +++ /dev/null @@ -1,92 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_TIME_HPP__ -#define __JELLYFISH_TIME_HPP__ - -#include -#include -#include -#include - -class Time { - static const suseconds_t max_useconds = 1000000UL; - struct timeval tv; - - public: - static const Time zero; - explicit Time(bool init = true) { - if(init) - now(); - } - Time(time_t sec, suseconds_t usec) { - tv.tv_sec = sec; - tv.tv_usec = usec; - } - Time &operator=(const Time &o) { - if(&o != this) { - tv.tv_sec = o.tv.tv_sec; - tv.tv_usec = o.tv.tv_usec; - } - return *this; - } - - Time & operator-=(const Time &o) { - tv.tv_sec -= o.tv.tv_sec; - if(o.tv.tv_usec > tv.tv_usec) { - tv.tv_usec = (max_useconds + tv.tv_usec) - o.tv.tv_usec; - --tv.tv_sec; - } else { - tv.tv_usec -= o.tv.tv_usec; - } - return *this; - } - const Time operator-(const Time &o) const { - return Time(*this) -= o; - } - - Time & operator+=(const Time &o) { - tv.tv_sec += o.tv.tv_sec; - tv.tv_usec += o.tv.tv_usec; - if(tv.tv_usec >= max_useconds) { - ++tv.tv_sec; - tv.tv_usec -= max_useconds; - } - return *this; - } - const Time operator+(const Time &o) const { - return Time(*this) += o; - } - - bool operator<(const Time& o) const { - return tv.tv_sec < o.tv.tv_sec || (tv.tv_sec == o.tv.tv_sec && tv.tv_usec < o.tv.tv_usec); - } - - void now() { gettimeofday(&tv, NULL); } - Time elapsed() const { - return Time() - *this; - } - - - std::string str() const { - std::ostringstream res; - res << tv.tv_sec << "." - << std::setfill('0') << std::setw(6) << std::right << tv.tv_usec; - return res.str(); - } -}; - -#endif // __TIME_HPP__ diff --git a/src/modifiedJellyfish/include/jellyfish/token_ring.hpp b/src/modifiedJellyfish/include/jellyfish/token_ring.hpp deleted file mode 100644 index 7e78413e..00000000 --- a/src/modifiedJellyfish/include/jellyfish/token_ring.hpp +++ /dev/null @@ -1,87 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_TOKEN_RING_HPP__ -#define __JELLYFISH_TOKEN_RING_HPP__ - -#include -#include - -namespace jellyfish { -template -class token_ring { -public: - class token { - bool val; - cond_t cond; - token* next; - friend class token_ring; - - public: - void wait() { - cond.lock(); - while(!val) { cond.wait(); } - cond.unlock(); - } - - void pass() { - next->cond.lock(); - val = false; - next->val = true; - next->cond.signal(); - next->cond.unlock(); - } - }; - -protected: - typedef std::vector token_list; - typedef typename token_list::iterator token_iterator; - token_list tokens; - - void initialize() { - if(tokens.size() == 0) - return; - - tokens.front().val = true; - tokens.back().next = &tokens.front(); - - for(size_t i = 1; i < tokens.size(); ++i) { - tokens[i].val = false; - tokens[i-1].next = &tokens[i]; - } - } - -public: - token_ring(int nb_tokens) : - tokens(nb_tokens) - { initialize(); } - - ~token_ring() { } - - token& operator[](int i) { return tokens[i]; } - - void reset() { - if(tokens.size() == 0) - return; - - token_iterator it = tokens.begin(); - it->val = true; - for(++it; it != tokens.end(); ++it) - it->val = false; - } -}; -} // namespace jellyfish { -#endif diff --git a/src/modifiedJellyfish/include/jellyfish/whole_sequence_parser.hpp b/src/modifiedJellyfish/include/jellyfish/whole_sequence_parser.hpp deleted file mode 100644 index 46b0520e..00000000 --- a/src/modifiedJellyfish/include/jellyfish/whole_sequence_parser.hpp +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef __JELLYFISH_WHOLE_SEQUENCE_PARSER_HPP__ -#define __JELLYFISH_WHOLE_SEQUENCE_PARSER_HPP__ - -#include -#include - -#include -#include -#include - -namespace jellyfish { -struct header_sequence_qual { - std::string header; - std::string seq; - std::string qual; -}; -struct sequence_list { - size_t nb_filled; - std::vector data; -}; - -template -class whole_sequence_parser : public jellyfish::cooperative_pool2, sequence_list> { - typedef jellyfish::cooperative_pool2, sequence_list> super; - typedef std::unique_ptr stream_type; - enum file_type { DONE_TYPE, FASTA_TYPE, FASTQ_TYPE }; - - struct stream_status { - file_type type; - std::string buffer; - stream_type stream; - stream_status() : type(DONE_TYPE) { } - }; - cpp_array streams_; - StreamIterator& streams_iterator_; - size_t files_read_; // nb of files read - size_t reads_read_; // nb of reads read - - -public: - /// Size is the number of buffers to keep around. It should be - /// larger than the number of thread expected to read from this - /// class. nb_sequences is the number of sequences to read into a - /// buffer. 'begin' and 'end' are iterators to a range of istream. - whole_sequence_parser(uint32_t size, uint32_t nb_sequences, - uint32_t max_producers, StreamIterator& streams) : - super(max_producers, size), - streams_(max_producers), - streams_iterator_(streams), - files_read_(0), - reads_read_(0) - { - for(auto it = super::element_begin(); it != super::element_end(); ++it) { - it->nb_filled = 0; - it->data.resize(nb_sequences); - } - for(uint32_t i = 0; i < max_producers; ++i) { - streams_.init(i); - open_next_file(streams_[i]); - } - } - - inline bool produce(uint32_t i, sequence_list& buff) { - stream_status& st = streams_[i]; - - switch(st.type) { - case FASTA_TYPE: - read_fasta(st, buff); - break; - case FASTQ_TYPE: - read_fastq(st, buff); - break; - case DONE_TYPE: - return true; - } - - if(st.stream->good()) - return false; - - // Reach the end of file, close current and try to open the next one - open_next_file(st); - return false; - } - - size_t nb_files() const { return files_read_; } - size_t nb_reads() const { return reads_read_; } - -protected: - void open_next_file(stream_status& st) { - st.stream.reset(); - st.stream = streams_iterator_.next(); - if(!st.stream) { - st.type = DONE_TYPE; - return; - } - - ++files_read_; - // Update the type of the current file and move past first header - // to beginning of sequence. - switch(st.stream->peek()) { - case EOF: return open_next_file(st); - case '>': - st.type = FASTA_TYPE; - break; - case '@': - st.type = FASTQ_TYPE; - break; - default: - throw std::runtime_error("Unsupported format"); // Better error management - } - } - - void read_fasta(stream_status& st, sequence_list& buff) { - size_t& nb_filled = buff.nb_filled; - const size_t data_size = buff.data.size(); - - for(nb_filled = 0; nb_filled < data_size && st.stream->peek() != EOF; ++nb_filled) { - ++reads_read_; - header_sequence_qual& fill_buff = buff.data[nb_filled]; - st.stream->get(); // Skip '>' - std::getline(*st.stream, fill_buff.header); - fill_buff.seq.clear(); - for(int c = st.stream->peek(); c != '>' && c != EOF; c = st.stream->peek()) { - std::getline(*st.stream, st.buffer); // Wish there was an easy way to combine the - fill_buff.seq.append(st.buffer); // two lines avoiding copying - } - } - } - - void read_fastq(stream_status& st, sequence_list& buff) { - size_t& nb_filled = buff.nb_filled; - const size_t data_size = buff.data.size(); - - for(nb_filled = 0; nb_filled < data_size && st.stream->peek() != EOF; ++nb_filled) { - ++reads_read_; - header_sequence_qual& fill_buff = buff.data[nb_filled]; - st.stream->get(); // Skip '@' - std::getline(*st.stream, fill_buff.header); - - if(st.stream->peek() != '+') - std::getline(*st.stream, fill_buff.seq); - else - fill_buff.seq.clear(); - while(st.stream->peek() != '+' && st.stream->peek() != EOF) { - std::getline(*st.stream, st.buffer); // Wish there was an easy way to combine the - fill_buff.seq.append(st.buffer); // two lines avoiding copying - } - if(!st.stream->good()) - throw std::runtime_error("Truncated fastq file"); - st.stream->ignore(std::numeric_limits::max(), '\n'); - if(st.stream->peek() != '+') - std::getline(*st.stream, fill_buff.qual); - else - fill_buff.qual.clear(); - while(fill_buff.qual.size() < fill_buff.seq.size() && st.stream->good()) { - std::getline(*st.stream, st.buffer); - fill_buff.qual.append(st.buffer); - } - if(fill_buff.qual.size() != fill_buff.seq.size()) - throw std::runtime_error("Invalid fastq file: wrong number of quals"); - if(st.stream->peek() != EOF && st.stream->peek() != '@') - throw std::runtime_error("Invalid fastq file: header missing"); - } - } -}; -} // namespace jellyfish - -#endif /* __JELLYFISH_WHOLE_SEQUENCE_PARSER_HPP__ */ diff --git a/src/modifiedJellyfish/install-sh b/src/modifiedJellyfish/install-sh deleted file mode 100755 index 377bb868..00000000 --- a/src/modifiedJellyfish/install-sh +++ /dev/null @@ -1,527 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2011-11-20.07; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# 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 -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/src/modifiedJellyfish/jellyfish-2.0.pc.in b/src/modifiedJellyfish/jellyfish-2.0.pc.in deleted file mode 100644 index 8a549ec5..00000000 --- a/src/modifiedJellyfish/jellyfish-2.0.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: Jellyfish -Description: A multi-threaded hash based k-mer counter. -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -ljellyfish-2.0 -lpthread -Cflags: -I${includedir}/jellyfish-@PACKAGE_VERSION@ diff --git a/src/modifiedJellyfish/jellyfish/backtrace.cc b/src/modifiedJellyfish/jellyfish/backtrace.cc deleted file mode 100644 index be0ccffc..00000000 --- a/src/modifiedJellyfish/jellyfish/backtrace.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include - -#ifndef HAVE_EXECINFO_H - -void show_backtrace() {} - -#else - -#include -#include -#include -#include -#include -#include - -void print_backtrace() { - void *trace_elems[20]; - int trace_elem_count(backtrace(trace_elems, 20)); - backtrace_symbols_fd(trace_elems, trace_elem_count, 2); -} - -static void handler() { - // Display message of last thrown exception if any - try { throw; } - catch(const std::exception& e) { - int status; - size_t n = 0; - char *name = abi::__cxa_demangle(typeid(e).name(), 0, &n, &status); - std::cerr << "terminate called after throwing an instance of '" - << (status < 0 ? "UNKNOWN" : name) - << "'\n what(): " << e.what() << "\n"; - if(n) - free(name); - } - catch(...) {} - - print_backtrace(); - abort(); -} - -void show_backtrace() { - std::set_terminate(handler); -} - -#endif diff --git a/src/modifiedJellyfish/jellyfish/dbg.cc b/src/modifiedJellyfish/jellyfish/dbg.cc deleted file mode 100644 index b9532248..00000000 --- a/src/modifiedJellyfish/jellyfish/dbg.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include - -namespace dbg { - pthread_mutex_t print_t::_lock = PTHREAD_MUTEX_INITIALIZER; - volatile pid_t print_t::_print_tid = 0; - -#ifdef DEBUG - Time _tic_time; -#endif - - void tic() { -#ifdef DEBUG - _tic_time.now(); -#endif - } - Time toc() { -#ifdef DEBUG - Time t; - return t - _tic_time; -#else - return Time::zero; -#endif - } - -#ifdef SYS_gettid - pid_t gettid() { return (pid_t)syscall(SYS_gettid); } -#else - pid_t gettid() { return getpid(); } -#endif - - int print_t::set_signal(int signum) { - struct sigaction act; - memset(&act, '\0', sizeof(act)); - act.sa_sigaction = signal_handler; - act.sa_flags = SA_SIGINFO; - return sigaction(signum, &act, 0); - } - - void print_t::signal_handler(int signum, siginfo_t *info, void *context) { -#ifdef HAVE_SI_INT - if(info->si_code != SI_QUEUE) - return; - _print_tid = info->si_int; -#endif - } -} diff --git a/src/modifiedJellyfish/jellyfish/dbg.hpp b/src/modifiedJellyfish/jellyfish/dbg.hpp deleted file mode 100644 index d894696b..00000000 --- a/src/modifiedJellyfish/jellyfish/dbg.hpp +++ /dev/null @@ -1,153 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __DBG_HPP__ -#define __DBG_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace dbg { - pid_t gettid(); - - class stringbuf : public std::stringbuf { - public: - stringbuf() : std::stringbuf(std::ios_base::out) { } - explicit stringbuf(const std::string &str) : - std::stringbuf(str, std::ios_base::out) { } - - bool end_is_space() { - if(pptr() == pbase()) - return true; - return isspace(*(pptr() - 1)); - } - friend class print_t; - }; - - class str { - const char *_s; - const size_t _l; - public: - str(const char *s, size_t len) : _s(s), _l(len) {} - friend class print_t; - }; - - class xspace { }; - class no_flush { }; - - class print_t { - static pthread_mutex_t _lock; - static volatile pid_t _print_tid; - - stringbuf _strbuf; - std::ostream _buf; - bool _flush; - public: - print_t(const char *file, const char *function, int line) : - _buf(&_strbuf), _flush(true) - { - const char *file_basename = strrchr(file, '/'); - if(!file_basename) - file_basename = file; - _buf << pthread_self() << "/" << gettid() << ":" - << file_basename << ":" << function << ":" << line << ": "; - } - - ~print_t() { - if(_print_tid == 0 || gettid() == _print_tid) { - pthread_mutex_lock(&_lock); - std::cerr.write(_strbuf.pbase(), _strbuf.pptr() - _strbuf.pbase()); - if(_flush) - std::cerr << std::endl; - else - std::cerr << "\n"; - pthread_mutex_unlock(&_lock); - } - } - - static int set_signal(int signum = SIGUSR1); - static void signal_handler(int signum, siginfo_t *info, void *context); - static pid_t print_tid() { return _print_tid; } - static void print_tid(pid_t new_tid) { _print_tid = new_tid; } - - print_t & operator<<(const char *a[]) { - for(int i = 0; a[i]; i++) - _buf << (i ? "\n" : "") << a[i]; - return *this; - } - print_t & operator<<(const std::exception &e) { - _buf << e.what(); - return *this; - } - print_t & operator<<(const str &ss) { - _buf.write(ss._s, ss._l); - return *this; - } - print_t & operator<<(const xspace &xs) { - if(!_strbuf.end_is_space()) - _buf << " "; - return *this; - } - print_t &operator<<(const no_flush &nf) { - _flush = false; - return *this; - } - print_t & operator<<(const Time &t) { - _buf << t.str(); - return *this; - } - template - print_t & operator<<(const T &x) { - _buf << x; - return *this; - } - }; - - class no_print_t { - public: - no_print_t() {} - - template - no_print_t & operator<<(const T &x) { return *this; } - }; - - void tic(); - Time toc(); -} - -#ifdef DEBUG -#define DBG if(1) dbg::print_t(__FILE__, __FUNCTION__, __LINE__) -#define NFDBG if(1) dbg::print_t(__FILE__, __FUNCTION__, __LINE__) << dbg::no_flush() -#define V(v) dbg::xspace() << #v ":" << v -#else -#define DBG if(1) dbg::no_print_t() -#define NFDBG if(1) dbg::no_print_t() -#define V(v) v -#endif - -#endif /* __DBG_HPP__ */ diff --git a/src/modifiedJellyfish/jellyfish/fstream_default.hpp b/src/modifiedJellyfish/jellyfish/fstream_default.hpp deleted file mode 100644 index 0ac298ea..00000000 --- a/src/modifiedJellyfish/jellyfish/fstream_default.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_FSTREAM_WITH_DEFAULT_HPP__ -#define __JELLYFISH_FSTREAM_WITH_DEFAULT_HPP__ - -#include -#include - -template -class fstream_default : public Base { - typedef Base super; - static std::streambuf* open_file(const char* str, std::ios_base::openmode mode) { - std::filebuf* fb = new std::filebuf; - return fb->open(str, mode); - } - - static std::streambuf* get_streambuf(const char* str, Base& def, - std::ios_base::openmode mode) { - return (str != 0) ? open_file(str, mode) : def.rdbuf(); - } - static std::streambuf* get_streambuf(const char* str, std::streambuf* buf, - std::ios_base::openmode mode) { - return (str != 0) ? open_file(str, mode) : buf; - } - - bool do_close; -public: - fstream_default(const char* str, Base& def, std::ios_base::openmode mode = def_mode) : - Base(get_streambuf(str, def, mode)), do_close(str != 0) { - if(Base::rdbuf() == 0) - Base::setstate(std::ios_base::badbit); - } - fstream_default(const char* str, std::streambuf* def, std::ios_base::openmode mode = def_mode) : - Base(get_streambuf(str, def, mode)), do_close(str != 0) { - if(Base::rdbuf() == 0) - Base::setstate(std::ios_base::badbit); - } - - ~fstream_default() { - if(do_close) { - delete Base::rdbuf(0); - do_close = false; - } - } - // Close is a noop at this point as GCC 4.4 has a problem with - // Base::rdbuf in methods (breaks strict aliasing). Beats me! I - // think it is a false positive. - void close() {} -}; - -typedef fstream_default ofstream_default; -typedef fstream_default ifstream_default; - -#endif // __JELLYFISH_FSTREAM_WITH_DEFAULT_HPP__ diff --git a/src/modifiedJellyfish/jellyfish/generate_sequence.cc b/src/modifiedJellyfish/jellyfish/generate_sequence.cc deleted file mode 100644 index c1f4eb97..00000000 --- a/src/modifiedJellyfish/jellyfish/generate_sequence.cc +++ /dev/null @@ -1,182 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace err = jellyfish::err; - -class rDNAg_t { -public: - rDNAg_t(CRandomMersenne *_rng) : rng(_rng), i(15), buff(0) {} - char letter() { - i = (i+1) % 16; - if(i == 0) - buff = rng->BRandom(); - char res = letters[buff & 0x3]; - buff >>= 2; - return res; - } - char qual_Illumina() { - return rng->IRandom(66, 104); - } -private: - CRandomMersenne *rng; - int i; - uint32_t buff; - static const char letters[4]; -}; -const char rDNAg_t::letters[4] = { 'A', 'C', 'G', 'T' }; - -// Output matrix - // Generate matrices - // uint64_t lines[64]; - // for(unsigned int j = 0; j < args.mer_arg.size(); j++) { - // if(args.mer_arg[j] <= 0 || args.mer_arg[j] > 31) - // die << "Mer size (" << args.mer_arg[j] << ") must be between 1 and 31."; - // int matrix_size = args.mer_arg[j] << 1; - // SquareBinaryMatrix mat(matrix_size), inv(matrix_size); - // while(true) { - // for(int i = 0; i < matrix_size; i++) - // lines[i] = (uint64_t)rng.BRandom() | ((uint64_t)rng.BRandom() << 32); - // mat = SquareBinaryMatrix(lines, matrix_size); - // try { - // inv = mat.inverse(); - // break; - // } catch(SquareBinaryMatrix::SingularMatrix &e) {} - // } - - // char path[4096]; - // int len = snprintf(path, sizeof(path), "%s_matrix_%d", args.output_arg, - // args.mer_arg[j]); - // if(len < 0) - // die << "Error creating the matrix file '" << path << "'" << err::no; - // if((unsigned int)len >= sizeof(path)) - // die << "Output prefix too long '" << args.output_arg << "'"; - // std::ofstream fd(path); - // if(!fd.good()) - // die << "Can't open matrix file '" << path << "'" << err::no; - // if(args.verbose_flag) - // std::cout << "Creating matrix file '" << path << "'\n"; - // mat.dump(&fd); - // if(!fd.good()) - // die << "Error while writing matrix '" << path << "'" << err::no; - // fd.close(); - // } - - -void create_path(char *path, unsigned int path_size, const char *ext, bool many, int i, const char *output_arg) { - int len; - if(many) - len = snprintf(path, path_size, "%s_%d.%s", output_arg, i, ext); - else - len = snprintf(path, path_size, "%s.%s", output_arg, ext); - if(len < 0) - die(err::msg() << "Error creating the fasta file '" << path << "': " << err::no); - if((unsigned int)len >= path_size) - die(err::msg() << "Output prefix too long '" << output_arg << "'"); -} - -generate_sequence_args args; - -void output_fastq(size_t length, const char* path, CRandomMersenne& rng) { - rDNAg_t rDNAg(&rng); - std::ofstream fd(path); - if(!fd.good()) - die(err::msg() << "Can't open fasta file '" << path << "': " << jellyfish::err::no); - if(args.verbose_flag) - std::cout << "Creating fastq file '" << path << "'\n"; - - size_t total_len = 0; - unsigned long read_id = 0; - while(total_len < length) { - fd << "@read_" << (read_id++) << "\n"; - int base; - for(base = 0; base < 70 && total_len < length; base++, total_len++) - fd << rDNAg.letter(); - fd << "\n+\n"; - for(int j = 0; j < base; j++) - fd << rDNAg.qual_Illumina(); - fd << "\n"; - } - if(!fd.good()) - die(err::msg() << "Error while writing fasta file '" << path << "': " << jellyfish::err::no); - fd.close(); -} - -void output_fasta(size_t length, const char* path, CRandomMersenne& rng) { - rDNAg_t rDNAg(&rng); - std::ofstream fd(path); - if(!fd.good()) - die(err::msg() << "Can't open fasta file '" << path << "': " << jellyfish::err::no); - if(args.verbose_flag) - std::cout << "Creating fasta file '" << path << "'\n"; - - size_t read_length = args.read_length_given ? args.read_length_arg : length; - size_t total_len = 0; - size_t read = 0; - long rid = 0; - fd << ">read" << ++rid << "\n"; - while(total_len < length) { - for(int base = 0; base < 70 && total_len < length && read < read_length; - base++) { - fd << rDNAg.letter(); - total_len++; - read++; - } - fd << "\n"; - if(read >= read_length) { - fd << ">read" << ++rid << "\n"; - read = 0; - } - } - if(!fd.good()) - die(err::msg() << "Error while writing fasta file '" << path << "': " << jellyfish::err::no); - fd.close(); -} - -int main(int argc, char *argv[]) -{ - args.parse(argc, argv); - - if(args.verbose_flag) - std::cout << "Seed: " << args.seed_arg << "\n"; - CRandomMersenne rng(args.seed_arg); - - - // Output sequence - char path[4096]; - bool many = args.length_arg.size() > 1; - - for(unsigned int i = 0; i < args.length_arg.size(); ++i) { - if(args.fastq_flag) { - create_path(path, sizeof(path), "fq", many, i, args.output_arg); - output_fastq(args.length_arg[i], path, rng); - } else { - create_path(path, sizeof(path), "fa", many, i, args.output_arg); - output_fasta(args.length_arg[i], path, rng); - } - } - - return 0; -} diff --git a/src/modifiedJellyfish/jellyfish/generate_sequence_cmdline.hpp b/src/modifiedJellyfish/jellyfish/generate_sequence_cmdline.hpp deleted file mode 100644 index 0ead51b9..00000000 --- a/src/modifiedJellyfish/jellyfish/generate_sequence_cmdline.hpp +++ /dev/null @@ -1,475 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __GENERATE_SEQUENCE_ARGS_HPP__ -#define __GENERATE_SEQUENCE_ARGS_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class generate_sequence_args { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - long seed_arg; - bool seed_given; - ::std::vector mer_arg; - typedef ::std::vector::iterator mer_arg_it; - typedef ::std::vector::const_iterator mer_arg_const_it; - bool mer_given; - const char * output_arg; - bool output_given; - bool fastq_flag; - uint32_t read_length_arg; - bool read_length_given; - bool verbose_flag; - ::std::vector length_arg; - typedef ::std::vector::iterator length_arg_it; - typedef ::std::vector::const_iterator length_arg_const_it; - - enum { - START_OPT = 1000 - }; - - generate_sequence_args() : - seed_arg(0), seed_given(false), - mer_arg(), mer_given(false), - output_arg("output"), output_given(false), - fastq_flag(false), - read_length_arg(0), read_length_given(false), - verbose_flag(false), - length_arg() - { } - - generate_sequence_args(int argc, char* argv[]) : - seed_arg(0), seed_given(false), - mer_arg(), mer_given(false), - output_arg("output"), output_given(false), - fastq_flag(false), - read_length_arg(0), read_length_given(false), - verbose_flag(false), - length_arg() - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"seed", 1, 0, 's'}, - {"mer", 1, 0, 'm'}, - {"output", 1, 0, 'o'}, - {"fastq", 0, 0, 'q'}, - {"read-length", 1, 0, 'r'}, - {"verbose", 0, 0, 'v'}, - {"help", 0, 0, 'h'}, - {"usage", 0, 0, 'U'}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVUs:m:o:qr:v"; - - ::std::string err; -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case 'U': - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case 's': - seed_given = true; - seed_arg = conv_int((const char*)optarg, err, false); - CHECK_ERR(long_t, optarg, "-s, --seed=long") - break; - case 'm': - mer_given = true; - mer_arg.push_back(conv_uint((const char*)optarg, err, false)); - CHECK_ERR(uint32_t, optarg, "-m, --mer=uint32") - break; - case 'o': - output_given = true; - output_arg = optarg; - break; - case 'q': - fastq_flag = true; - break; - case 'r': - read_length_given = true; - read_length_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-r, --read-length=uint32") - break; - case 'v': - verbose_flag = true; - break; - } - } - - // Check that required switches are present - if(!seed_given) - error("[-s, --seed=long] required switch"); - - // Parse arguments - if(argc - optind < 1) - error("Requires at least 1 argument."); - for( ; optind < argc; ++optind) { - length_arg.push_back(conv_uint((const char*)argv[optind], err, false)); - CHECK_ERR(uint64_t, argv[optind], "length") - } - } - static const char * usage() { return "Usage: generate_sequence [options] length:uint64+"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Generate randome sequence of given lengths.\n\n" - "Options (default value in (), *required):\n" - " -s, --seed=long *Seed\n" - " -m, --mer=uint32 Mer length. Generate matrix of size 2*length\n" - " -o, --output=string Output prefix (output)\n" - " -q, --fastq Generate fastq file (false)\n" - " -r, --read-length=uint32 Read length for fasta format (default=size of sequence)\n" - " -v, --verbose Be verbose (false)\n" - " -U, --usage Usage\n" - " -h, --help This message\n" - " -V, --version Version"; - } - static const char* hidden() { return ""; } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "seed_given:" << seed_given << " seed_arg:" << seed_arg << "\n"; - os << "mer_given:" << mer_given << " mer_arg:" << vec_str(mer_arg) << "\n"; - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - os << "fastq_flag:" << fastq_flag << "\n"; - os << "read_length_given:" << read_length_given << " read_length_arg:" << read_length_arg << "\n"; - os << "verbose_flag:" << verbose_flag << "\n"; - os << "length_arg:" << vec_str(length_arg) << "\n"; - } -}; -#endif // __GENERATE_SEQUENCE_ARGS_HPP__" diff --git a/src/modifiedJellyfish/jellyfish/merge_files.cc b/src/modifiedJellyfish/jellyfish/merge_files.cc deleted file mode 100644 index cb79cfc4..00000000 --- a/src/modifiedJellyfish/jellyfish/merge_files.cc +++ /dev/null @@ -1,225 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -#include - -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include - -namespace err = jellyfish::err; - -using jellyfish::file_header; -using jellyfish::RectangularBinaryMatrix; -using jellyfish::mer_dna; -using jellyfish::cpp_array; -typedef std::auto_ptr binary_reader_ptr; -typedef std::auto_ptr text_reader_ptr; - -struct file_info { - std::ifstream is; - file_header header; - - file_info(const char* path) : - is(path), - header(is) - { } -}; -typedef std::auto_ptr matrix_ptr; - -template -void do_merge(cpp_array& files, std::ostream& out, writer_type& writer, - uint64_t min, uint64_t max) { - cpp_array readers(files.size()); - typedef jellyfish::mer_heap::heap heap_type; - typedef typename heap_type::const_item_t heap_item; - heap_type heap(files.size()); - - - for(size_t i = 0; i < files.size(); ++i) { - //cout << "&files[" <key_" << head->key_ << endl; - //cout << "vaoue = " << head->val_ << endl; - vector sum; - vectorids; - do { - sum.push_back( head->val_); - //cout << "head->val_ = " << head->val_ << '\t' << head->it_ << '\t' << head->pos_ << endl; - heap.pop(); - if(head->it_->next()) - heap.push(*head->it_); - head = heap.head(); - } while(head->key_ == key && heap.is_not_empty()); - bool unique = false; - int ucount = -1; - int check = 0; - unsigned int spot = 0; - //for (unsigned int i = 0; i 2) - //{ - // check++; - // spot = i; - //} - //} - /*if (sum.size() ==1) - { - if (sum[0] > 8) - { - //cout << "found singleton uniqe " << key << "\t" << sum[0] << endl; - unique = true; - ucount = sum[0]; - } - } - else - { - bool Iunique = false; - for (unsigned int i = 0; i < sum.size(); i++) - { - for(unsigned int j = 0; j < sum.size(); j++) - { - if (i != j) - { - if (sum[i] >8 and sum[j]>2) - {Iunique = false; } - - } - } - if (Iunique) - { - ucount = sum[i]; - unique = true; - break; - } - } - }*/ - //if (sum.size()== 1) -//{check = 1; spot = 0;} - //if (check == 1 and sum[spot] >=8 and sum[spot] < 300) - if (sum.size() ==1) - { - if (sum[0] >=5) - { - cout << key <<'\t' << sum[spot] << endl; - } - } - } -} - -// Merge files. Throws an error if unsuccessful. -void merge_files(std::vector input_files, - const char* out_file, - file_header& out_header, - uint64_t min, uint64_t max) { - unsigned int key_len = 0; - size_t max_reprobe_offset = 0; - size_t size = 0; - unsigned int out_counter_len = std::numeric_limits::max(); - std::string format; - matrix_ptr matrix; - - cpp_array files(input_files.size()); - - // create an iterator for each hash file - for(size_t i = 0; i < files.size(); i++) { - files.init(i, input_files[i]); - if(!files[i].is.good()) - throw MergeError(err::msg() << "Failed to open input file '" << input_files[i] << "'"); - - file_header& h = files[i].header; - if(i == 0) { - key_len = h.key_len(); - max_reprobe_offset = h.max_reprobe_offset(); - size = h.size(); - matrix.reset(new RectangularBinaryMatrix(h.matrix())); - out_header.size(size); - out_header.key_len(key_len); - format = h.format(); - out_header.matrix(*matrix); - out_header.max_reprobe(h.max_reprobe()); - size_t reprobes[h.max_reprobe() + 1]; - h.get_reprobes(reprobes); - out_header.set_reprobes(reprobes); - out_counter_len = std::min(out_counter_len, h.counter_len()); - } else { - if(format != h.format()) - throw MergeError(err::msg() << "Can't merge files with different formats (" << format << ", " << h.format() << ")"); - if(h.key_len() != key_len) - throw MergeError(err::msg() << "Can't merge hashes of different key lengths (" << key_len << ", " << h.key_len() << ")"); - if(h.max_reprobe_offset() != max_reprobe_offset) - throw MergeError("Can't merge hashes with different reprobing strategies"); - if(h.size() != size) - throw MergeError(err::msg() << "Can't merge hash with different size (" << size << ", " << h.size() << ")"); - if(h.matrix() != *matrix) - throw MergeError("Can't merge hash with different hash function"); - } - } - mer_dna::k(key_len / 2); - - std::ofstream out(out_file); - if(!out.good()) - throw MergeError(err::msg() << "Can't open out file '" << out_file << "'"); - out_header.format(format); - - if(!format.compare(binary_dumper::format)) { - out_header.counter_len(out_counter_len); - out_header.write(out); - binary_writer writer(out_counter_len, key_len); - do_merge(files, out, writer, min, max); - } else if(!format.compare(text_dumper::format)) { - out_header.write(out); - text_writer writer; - do_merge(files, out, writer, min, max); - } else { - throw MergeError(err::msg() << "Unknown format '" << format << "'"); - } - out.close(); -} diff --git a/src/modifiedJellyfish/jellyfish/merge_files.hpp b/src/modifiedJellyfish/jellyfish/merge_files.hpp deleted file mode 100644 index d717975f..00000000 --- a/src/modifiedJellyfish/jellyfish/merge_files.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __JELLYFISH_MERGE_FILES_HPP__ -#define __JELLYFISH_MERGE_FILES_HPP__ - -#include -#include -#include - -define_error_class(MergeError); - -/// Merge files. Throw a MergeError in case of error. -void merge_files(std::vector input_files, const char* out_file, - jellyfish::file_header& h, uint64_t min, uint64_t max); - -#endif /* __JELLYFISH_MERGE_FILES_HPP__ */ diff --git a/src/modifiedJellyfish/jellyfish/mersenne.cpp b/src/modifiedJellyfish/jellyfish/mersenne.cpp deleted file mode 100644 index ace7b95d..00000000 --- a/src/modifiedJellyfish/jellyfish/mersenne.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/************************** mersenne.cpp ********************************** -* Author: Agner Fog -* Date created: 2001 -* Last modified: 2008-11-16 -* Project: randomc.h -* Platform: Any C++ -* Description: -* Random Number generator of type 'Mersenne Twister' -* -* This random number generator is described in the article by -* M. Matsumoto & T. Nishimura, in: -* ACM Transactions on Modeling and Computer Simulation, -* vol. 8, no. 1, 1998, pp. 3-30. -* Details on the initialization scheme can be found at -* http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html -* -* Further documentation: -* The file ran-instructions.pdf contains further documentation and -* instructions. -* -* Copyright 2001-2008 by Agner Fog. -* GNU General Public License http://www.gnu.org/licenses/gpl.html -*******************************************************************************/ - -#include - -void CRandomMersenne::Init0(int seed) { - // Seed generator - const uint32_t factor = 1812433253UL; - mt[0]= seed; - for (mti=1; mti < MERS_N; mti++) { - mt[mti] = (factor * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti); - } -} - -void CRandomMersenne::RandomInit(int seed) { - // Initialize and seed - Init0(seed); - - // Randomize some more - for (int i = 0; i < 37; i++) BRandom(); -} - - -void CRandomMersenne::RandomInitByArray(int const seeds[], int NumSeeds) { - // Seed by more than 32 bits - int i, j, k; - - // Initialize - Init0(19650218); - - if (NumSeeds <= 0) return; - - // Randomize mt[] using whole seeds[] array - i = 1; j = 0; - k = (MERS_N > NumSeeds ? MERS_N : NumSeeds); - for (; k; k--) { - mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL)) + (uint32_t)seeds[j] + j; - i++; j++; - if (i >= MERS_N) {mt[0] = mt[MERS_N-1]; i=1;} - if (j >= NumSeeds) j=0;} - for (k = MERS_N-1; k; k--) { - mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL)) - i; - if (++i >= MERS_N) {mt[0] = mt[MERS_N-1]; i=1;}} - mt[0] = 0x80000000UL; // MSB is 1; assuring non-zero initial array - - // Randomize some more - mti = 0; - for (int i = 0; i <= MERS_N; i++) BRandom(); -} - - -uint32_t CRandomMersenne::BRandom() { - // Generate 32 random bits - uint32_t y; - - if (mti >= MERS_N) { - // Generate MERS_N words at one time - const uint32_t LOWER_MASK = (1LU << MERS_R) - 1; // Lower MERS_R bits - const uint32_t UPPER_MASK = 0xFFFFFFFF << MERS_R; // Upper (32 - MERS_R) bits - static const uint32_t mag01[2] = {0, MERS_A}; - - int kk; - for (kk=0; kk < MERS_N-MERS_M; kk++) { - y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK); - mt[kk] = mt[kk+MERS_M] ^ (y >> 1) ^ mag01[y & 1];} - - for (; kk < MERS_N-1; kk++) { - y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK); - mt[kk] = mt[kk+(MERS_M-MERS_N)] ^ (y >> 1) ^ mag01[y & 1];} - - y = (mt[MERS_N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK); - mt[MERS_N-1] = mt[MERS_M-1] ^ (y >> 1) ^ mag01[y & 1]; - mti = 0; - } - y = mt[mti++]; - - // Tempering (May be omitted): - y ^= y >> MERS_U; - y ^= (y << MERS_S) & MERS_B; - y ^= (y << MERS_T) & MERS_C; - y ^= y >> MERS_L; - - return y; -} - - -double CRandomMersenne::Random() { - // Output random float number in the interval 0 <= x < 1 - // Multiply by 2^(-32) - return (double)BRandom() * (1./(65536.*65536.)); -} - - -int CRandomMersenne::IRandom(int min, int max) { - // Output random integer in the interval min <= x <= max - // Relative error on frequencies < 2^-32 - if (max <= min) { - if (max == min) return min; else return 0x80000000; - } - // Multiply interval with random and truncate - int r = int((double)(uint32_t)(max - min + 1) * Random() + min); - if (r > max) r = max; - return r; -} - - -int CRandomMersenne::IRandomX(int min, int max) { - // Output random integer in the interval min <= x <= max - // Each output value has exactly the same probability. - // This is obtained by rejecting certain bit values so that the number - // of possible bit values is divisible by the interval length - if (max <= min) { - if (max == min) return min; else return 0x80000000; - } -#ifdef INT64_SUPPORTED - // 64 bit integers available. Use multiply and shift method - uint32_t interval; // Length of interval - uint64_t longran; // Random bits * interval - uint32_t iran; // Longran / 2^32 - uint32_t remainder; // Longran % 2^32 - - interval = uint32_t(max - min + 1); - if (interval != LastInterval) { - // Interval length has changed. Must calculate rejection limit - // Reject when remainder >= 2^32 / interval * interval - // RLimit will be 0 if interval is a power of 2. No rejection then - RLimit = uint32_t(((uint64_t)1 << 32) / interval) * interval - 1; - LastInterval = interval; - } - do { // Rejection loop - longran = (uint64_t)BRandom() * interval; - iran = (uint32_t)(longran >> 32); - remainder = (uint32_t)longran; - } while (remainder > RLimit); - // Convert back to signed and return result - return (int32_t)iran + min; - -#else - // 64 bit integers not available. Use modulo method - uint32_t interval; // Length of interval - uint32_t bran; // Random bits - uint32_t iran; // bran / interval - uint32_t remainder; // bran % interval - - interval = uint32_t(max - min + 1); - if (interval != LastInterval) { - // Interval length has changed. Must calculate rejection limit - // Reject when iran = 2^32 / interval - // We can't make 2^32 so we use 2^32-1 and correct afterwards - RLimit = (uint32_t)0xFFFFFFFF / interval; - if ((uint32_t)0xFFFFFFFF % interval == interval - 1) RLimit++; - } - do { // Rejection loop - bran = BRandom(); - iran = bran / interval; - remainder = bran % interval; - } while (iran >= RLimit); - // Convert back to signed and return result - return (int32_t)remainder + min; - -#endif -} diff --git a/src/modifiedJellyfish/jellyfish/randomc.h b/src/modifiedJellyfish/jellyfish/randomc.h deleted file mode 100644 index 39724f41..00000000 --- a/src/modifiedJellyfish/jellyfish/randomc.h +++ /dev/null @@ -1,198 +0,0 @@ -/***************************** randomc.h ********************************** -* Author: Agner Fog -* Date created: 1997 -* Last modified: 2008-11-16 -* Project: randomc.h -* Source URL: www.agner.org/random -* -* Description: -* This header file contains class declarations and other definitions for the -* randomc class library of uniform random number generators in C++ language. -* -* Overview of classes: -* ==================== -* -* class CRandomMersenne: -* Random number generator of type Mersenne twister. -* Source file mersenne.cpp -* -* class CRandomMother: -* Random number generator of type Mother-of-All (Multiply with carry). -* Source file mother.cpp -* -* class CRandomSFMT: -* Random number generator of type SIMD-oriented Fast Mersenne Twister. -* The class definition is not included here because it is not -* portable to all platforms. See sfmt.h and sfmt.cpp for details. -* -* Member functions (methods): -* =========================== -* -* All these classes have identical member functions: -* -* Constructor(int seed): -* The seed can be any integer. The time may be used as seed. -* Executing a program twice with the same seed will give the same sequence -* of random numbers. A different seed will give a different sequence. -* -* void RandomInit(int seed); -* Re-initializes the random number generator with a new seed. -* -* void RandomInitByArray(int const seeds[], int NumSeeds); -* In CRandomMersenne and CRandomSFMT only: Use this function if you want -* to initialize with a seed with more than 32 bits. All bits in the seeds[] -* array will influence the sequence of random numbers generated. NumSeeds -* is the number of entries in the seeds[] array. -* -* double Random(); -* Gives a floating point random number in the interval 0 <= x < 1. -* The resolution is 32 bits in CRandomMother and CRandomMersenne, and -* 52 bits in CRandomSFMT. -* -* int IRandom(int min, int max); -* Gives an integer random number in the interval min <= x <= max. -* (max-min < MAXINT). -* The precision is 2^-32 (defined as the difference in frequency between -* possible output values). The frequencies are exact if max-min+1 is a -* power of 2. -* -* int IRandomX(int min, int max); -* Same as IRandom, but exact. In CRandomMersenne and CRandomSFMT only. -* The frequencies of all output values are exactly the same for an -* infinitely long sequence. (Only relevant for extremely long sequences). -* -* uint32_t BRandom(); -* Gives 32 random bits. -* -* -* Example: -* ======== -* The file EX-RAN.CPP contains an example of how to generate random numbers. -* -* -* Library version: -* ================ -* Optimized versions of these random number generators are provided as function -* libraries in randoma.zip. These function libraries are coded in assembly -* language and support only x86 platforms, including 32-bit and 64-bit -* Windows, Linux, BSD, Mac OS-X (Intel based). Use randoma.h from randoma.zip -* -* -* Non-uniform random number generators: -* ===================================== -* Random number generators with various non-uniform distributions are -* available in stocc.zip (www.agner.org/random). -* -* -* Further documentation: -* ====================== -* The file ran-instructions.pdf contains further documentation and -* instructions for these random number generators. -* -* Copyright 1997-2008 by Agner Fog. -* GNU General Public License http://www.gnu.org/licenses/gpl.html -*******************************************************************************/ - -#ifndef RANDOMC_H -#define RANDOMC_H - -// Define integer types with known size: int32_t, uint32_t, int64_t, uint64_t. -// If this doesn't work then insert compiler-specific definitions here: -#if defined(__GNUC__) - // Compilers supporting C99 or C++0x have inttypes.h defining these integer types - #include - #define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers -#elif defined(_WIN16) || defined(__MSDOS__) || defined(_MSDOS) - // 16 bit systems use long int for 32 bit integer - typedef signed long int int32_t; - typedef unsigned long int uint32_t; -#elif defined(_MSC_VER) - // Microsoft have their own definition - typedef signed __int32 int32_t; - typedef unsigned __int32 uint32_t; - typedef signed __int64 int64_t; - typedef unsigned __int64 uint64_t; - #define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers -#else - // This works with most compilers - typedef signed int int32_t; - typedef unsigned int uint32_t; - typedef long long int64_t; - typedef unsigned long long uint64_t; - #define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers -#endif - - -/*********************************************************************** -System-specific user interface functions -***********************************************************************/ - -void EndOfProgram(void); // System-specific exit code (userintf.cpp) - -void FatalError(const char *ErrorText);// System-specific error reporting (userintf.cpp) - -#if defined(__cplusplus) // class definitions only in C++ -/*********************************************************************** -Define random number generator classes -***********************************************************************/ - -class CRandomMersenne { // Encapsulate random number generator -// Choose which version of Mersenne Twister you want: -#if 0 -// Define constants for type MT11213A: -#define MERS_N 351 -#define MERS_M 175 -#define MERS_R 19 -#define MERS_U 11 -#define MERS_S 7 -#define MERS_T 15 -#define MERS_L 17 -#define MERS_A 0xE4BD75F5 -#define MERS_B 0x655E5280 -#define MERS_C 0xFFD58000 -#else -// or constants for type MT19937: -#define MERS_N 624 -#define MERS_M 397 -#define MERS_R 31 -#define MERS_U 11 -#define MERS_S 7 -#define MERS_T 15 -#define MERS_L 18 -#define MERS_A 0x9908B0DF -#define MERS_B 0x9D2C5680 -#define MERS_C 0xEFC60000 -#endif - -public: - CRandomMersenne(int seed) { // Constructor - RandomInit(seed); LastInterval = 0;} - void RandomInit(int seed); // Re-seed - void RandomInitByArray(int const seeds[], int NumSeeds); // Seed by more than 32 bits - int IRandom (int min, int max); // Output random integer - int IRandomX(int min, int max); // Output random integer, exact - double Random(); // Output random float - uint32_t BRandom(); // Output random bits -private: - void Init0(int seed); // Basic initialization procedure - uint32_t mt[MERS_N]; // State vector - int mti; // Index into mt - uint32_t LastInterval; // Last interval length for IRandomX - uint32_t RLimit; // Rejection limit used by IRandomX -}; - - -class CRandomMother { // Encapsulate random number generator -public: - void RandomInit(int seed); // Initialization - int IRandom(int min, int max); // Get integer random number in desired interval - double Random(); // Get floating point random number - uint32_t BRandom(); // Output random bits - CRandomMother(int seed) { // Constructor - RandomInit(seed);} -protected: - uint32_t x[5]; // History buffer -}; - -#endif // __cplusplus -#endif // RANDOMC_H diff --git a/src/modifiedJellyfish/lib/allocators_mmap.cc b/src/modifiedJellyfish/lib/allocators_mmap.cc deleted file mode 100644 index f39853ac..00000000 --- a/src/modifiedJellyfish/lib/allocators_mmap.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include - -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif - -#ifdef HAVE_VALGRIND -#include -// TODO: this should really come from the valgrind switch -// --redzone-size. Don't know how to get access to that yet! -static size_t redzone_size = 128; -#endif - -void *allocators::mmap::realloc(size_t new_size) { - void *new_ptr = MAP_FAILED; - const size_t asize = new_size -#ifdef HAVE_VALGRIND - + 2 * redzone_size -#endif - ; - - if(ptr_ == MAP_FAILED) { - new_ptr = ::mmap(NULL, asize, PROT_WRITE|PROT_READ, - MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); - } - // mremap is Linux specific - // TODO: We must do something if it is not supported -#ifdef MREMAP_MAYMOVE - else { - new_ptr = ::mremap(ptr_, size_, new_size, MREMAP_MAYMOVE); - } -#endif - if(new_ptr == MAP_FAILED) - return NULL; - -#ifdef HAVE_VALGRIND - new_ptr = (char*)new_ptr + redzone_size; - if(ptr_ == MAP_FAILED) - VALGRIND_MALLOCLIKE_BLOCK(new_ptr, new_size, redzone_size, 1); - // TODO: resize not yet supported -#endif - - - size_ = new_size; - ptr_ = new_ptr; - - fast_zero(); - - return ptr_; -} - -size_t allocators::mmap::round_to_page(size_t _size) { - static const long pg_size = sysconf(_SC_PAGESIZE); - return (_size / pg_size + (_size % pg_size != 0)) * pg_size; -} - -void allocators::mmap::fast_zero() { - tinfo info[nb_threads]; - size_t pgsize = round_to_page(1); - size_t nb_pages = size_ / pgsize + (size_ % pgsize != 0); - int total_threads = 0; - - for(size_t i = 0; i < (size_t)nb_threads; ++i, ++total_threads) { - info[i].start = (char *)ptr_ + pgsize * ((i * nb_pages) / nb_threads); - info[i].end = (char *)ptr_ + std::min(pgsize * (((i + 1) * nb_pages) / nb_threads), size_); - info[i].pgsize = pgsize; - if(pthread_create(&info[i].thid, NULL, _fast_zero, &info[i])) - break; - } - - for(int i = 0; i < total_threads; i++) - pthread_join(info[i].thid, NULL); -} - -void * allocators::mmap::_fast_zero(void *_info) { - tinfo *info = (tinfo *)_info; - - for(char *cptr = info->start; cptr < info->end; cptr += info->pgsize) { - *cptr = 0; - } - - return NULL; -} - -void allocators::mmap::free() { - if(ptr_ == MAP_FAILED) - return; -#ifdef HAVE_VALGRIND - VALGRIND_FREELIKE_BLOCK(ptr_, redzone_size); - ptr_ = (char*)ptr_ - redzone_size; - size_ += 2 * redzone_size; -#endif - assert(::munmap(ptr_, size_) == 0); - ptr_ = MAP_FAILED; - size_ = 0; -} diff --git a/src/modifiedJellyfish/lib/generator_manager.cc b/src/modifiedJellyfish/lib/generator_manager.cc deleted file mode 100644 index a9b99cec..00000000 --- a/src/modifiedJellyfish/lib/generator_manager.cc +++ /dev/null @@ -1,280 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace jellyfish { -int open_cloexec(const char* path, int flags) { -#ifdef O_CLOEXEC - int fd = open(path, flags|O_CLOEXEC); -#else - int fd = open(path, flags); - if(fd != -1) - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - return fd; -} - -std::string tmp_pipes::create_tmp_dir() { - std::vector prefixes; - const char* tmpdir = getenv("TMPDIR"); - if(tmpdir) - prefixes.push_back(tmpdir); -#ifdef P_tmpdir - prefixes.push_back(P_tmpdir); -#endif - prefixes.push_back("."); - - for(auto it = prefixes.begin(); it != prefixes.end(); ++it) { - size_t len = strlen(*it) + 6 + 1; - std::unique_ptr tmppath(new char[len]); - sprintf(tmppath.get(), "%sXXXXXX", *it); - const char* res = mkdtemp(tmppath.get()); - if(res) - return std::string(res); - } - throw std::runtime_error(err::msg() << "Failed to create a temporary directory for the pipes. Set the variable TMPDIR properly: " << err::no); - return ""; -} - -std::vector tmp_pipes::create_pipes(const std::string& tmpdir, int nb_pipes) -{ - std::vector pipes; - for(int i = 0; i < nb_pipes; ++i) { - std::ostringstream path; - path << tmpdir << "/fifo" << i; - if(mkfifo(path.str().c_str(), S_IRUSR|S_IWUSR) == -1) - throw std::runtime_error(err::msg() << "Failed to create named fifos: " << err::no); - pipes.push_back(path.str()); - } - return pipes; -} - -void tmp_pipes::discard(int i) { - if(pipes_[i].empty()) - return; - // First rename the fifo so no new reader will open it, then open - // the fifo (with its new name for writing, in non-blocking mode. If - // we get a valid file descriptor, some readers are blocked reading - // on the fifo: we close the fifo and free the readers. Otherwise, - // no readers is blocked and no action is required. Finally we - // unlink the fifo for good. - std::string discarded_name(pipes_[i]); - discarded_name += "_discarded"; - if(rename(pipes_[i].c_str(), discarded_name.c_str()) == -1) - return; - pipes_[i].clear(); - pipes_paths_[i] = 0; - int fd = open(discarded_name.c_str(), O_WRONLY|O_NONBLOCK); - if(fd != -1) - close(fd); - unlink(discarded_name.c_str()); -} - -void tmp_pipes::cleanup() { - for(size_t i = 0; i < pipes_.size(); ++i) { - discard(i); - } - rmdir(tmpdir_.c_str()); -} - -void generator_manager_base::start() { - if(manager_pid_ != -1) - return; - manager_pid_ = fork(); - switch(manager_pid_) { - case -1: - throw std::runtime_error(err::msg() << "Failed to start manager process: " << err::no); - break; - case 0: - manager_pid_ = -1; - break; - default: - parent_cleanup(); - return; - } - - - // In child - if(setup_signal_handlers() == -1) - exit(EXIT_FAILURE); - start_commands(); // child start commands - int signal = kill_signal_; - if(signal == 0) - exit(EXIT_SUCCESS); - - // Got killed. Kill all children, cleanup and kill myself with the - // same signal (and die from it this time :). We do not wait on the - // dead children as we are going to die soon as well, and we don't - // care about the return value at that point. Let init take care of - // that for us... - cleanup(); - unset_signal_handlers(); - kill(getpid(), signal); // kill myself - exit(EXIT_FAILURE); // Should not be reached -} - -static generator_manager_base* manager = 0; -void generator_manager_base::signal_handler(int signal) { - manager->kill_signal_ = signal; -} -int generator_manager_base::setup_signal_handlers() { - struct sigaction act; - memset(&act, '\0', sizeof(act)); - act.sa_handler = signal_handler; - return sigaction(SIGTERM, &act, 0); - // Should we redefine other signals as well? Like SIGINT, SIGQUIT? -} - -void generator_manager_base::unset_signal_handlers() { - struct sigaction act; - memset(&act, '\0', sizeof(act)); - act.sa_handler = SIG_DFL; - sigaction(SIGTERM, &act, 0); -} - -bool generator_manager_base::wait() { - if(manager_pid_ == -1) return false; - pid_t pid = manager_pid_; - manager_pid_ = -1; - int status; - if(pid != waitpid(pid, &status, 0)) - return false; - return WIFEXITED(status) && (WEXITSTATUS(status) == 0); -} - -void generator_manager_base::cleanup() { - for(auto it = pid2pipe_.begin(); it != pid2pipe_.end(); ++it) { - kill(it->first, SIGTERM); - pipes_.discard(it->second.pipe); - } - pipes_.cleanup(); -} - -void generator_manager_base::start_one_command(const std::string& command, int pipe) -{ - cmd_info_type info = { command, pipe }; - pid_t child = fork(); - switch(child) { - case -1: - std::cerr << "Failed to fork. Command '" << command << "' not run" << std::endl; - return; - case 0: - break; - default: - pid2pipe_[child] = info; - return; - } - - // In child - int dev_null = open_cloexec("/dev/null", O_RDONLY); - if(dev_null != -1) - dup2(dev_null, 0); - - int pipe_fd = open_cloexec(pipes_[pipe], O_WRONLY); - if(pipe_fd == -1) { - std::cerr << "Failed to open output pipe. Command '" << command << "' not run" << std::endl; - exit(EXIT_FAILURE); - } - if(dup2(pipe_fd, 1) == -1) { - std::cerr << "Failed to dup pipe to stdout. Command '" << command << "' not run" << std::endl; - exit(EXIT_FAILURE); - } - execl(shell_, shell_, "-c", command.c_str(), (char*)0); - std::cerr << "Failed to exec. Command '" << command << "' not run" << std::endl; - exit(EXIT_FAILURE); -} - -std::string generator_manager::get_cmd() { - std::string command; - - while(std::getline(cmds_, command)) { - size_t pos = command.find_first_not_of(" \t\n\v\f\r"); - if(pos != std::string::npos && command[pos] != '#') - break; - command.clear(); - } - return command; -} - -void generator_manager_base::start_commands() -{ - std::string command; - size_t i; - for(i = 0; i < pipes_.size(); ++i) { - command = get_cmd(); - if(command.empty()) - break; - start_one_command(command, i); - } - for( ; i < pipes_.size(); ++i) - pipes_.discard(i); - - while(!pid2pipe_.empty()) { - int status; - int res = ::wait(&status); - if(res == -1) { - if(errno == EINTR) continue; - break; - } - cmd_info_type info = pid2pipe_[res]; - pid2pipe_.erase(info.pipe); - command = get_cmd(); - if(!command.empty()) { - start_one_command(command, info.pipe); - } else { - pipes_.discard(info.pipe); - } - if(!display_status(status, info.command)) { - cleanup(); - exit(EXIT_FAILURE); - } - } -} - -bool generator_manager_base::display_status(int status, const std::string& command) -{ - if(WIFEXITED(status) && WEXITSTATUS(status) != 0) { - std::cerr << "Command '" << command - << "' exited with error status " << WEXITSTATUS(status) << std::endl; - return false; - } else if(WIFSIGNALED(status)) { - std::cerr << "Command '" << command - << "' killed by signal " << WTERMSIG(status) << std::endl; - return false; - } - return true; -} - -} // namespace jellyfish diff --git a/src/modifiedJellyfish/lib/int128.cc b/src/modifiedJellyfish/lib/int128.cc deleted file mode 100644 index 6f2d1f4c..00000000 --- a/src/modifiedJellyfish/lib/int128.cc +++ /dev/null @@ -1,94 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_INT128 -#include - -void __int128_ns::__print_bases(std::ostream& prefix, std::ostream& os, - unsigned __int128 x, - const std::ios::fmtflags& ff) { - if(x == 0) { - os << "0"; - return; - } - if(ff & std::ios::showbase) { - if(ff & std::ios::hex) { - if(ff & std::ios::uppercase) - prefix << "0X"; - else - prefix << "0x"; - } else if(ff & std::ios::oct) { - prefix << "0"; - } - } - if(ff & std::ios::hex) { - __print_digits<16>(os, (unsigned __int128)x, - !(ff & std::ios::uppercase)); - } else if(ff & std::ios::oct) { - __print_digits<8>(os, (unsigned __int128)x); - } -} - -#ifndef HAVE_NUMERIC_LIMITS128 -const int std::numeric_limits<__int128>::digits; -const int std::numeric_limits<__int128>::digits10; -const bool std::numeric_limits<__int128>::is_signed; -const bool std::numeric_limits<__int128>::is_integer; -const bool std::numeric_limits<__int128>::is_exact; -const int std::numeric_limits<__int128>::radix; -const int std::numeric_limits<__int128>::min_exponent; -const int std::numeric_limits<__int128>::min_exponent10; -const int std::numeric_limits<__int128>::max_exponent; -const int std::numeric_limits<__int128>::max_exponent10; -const bool std::numeric_limits<__int128>::has_infinity; -const bool std::numeric_limits<__int128>::has_quiet_NaN; -const bool std::numeric_limits<__int128>::has_signaling_NaN; -const std::float_denorm_style std::numeric_limits<__int128>::has_denorm; -const bool std::numeric_limits<__int128>::has_denorm_loss; -const bool std::numeric_limits<__int128>::is_iec559; -const bool std::numeric_limits<__int128>::is_bounded; -const bool std::numeric_limits<__int128>::is_modulo; -const bool std::numeric_limits<__int128>::traps; -const bool std::numeric_limits<__int128>::tinyness_before; -const std::float_round_style std::numeric_limits<__int128>::round_style; - -const int std::numeric_limits::digits; -const int std::numeric_limits::digits10; -const bool std::numeric_limits::is_signed; -const bool std::numeric_limits::is_integer; -const bool std::numeric_limits::is_exact; -const int std::numeric_limits::radix; -const int std::numeric_limits::min_exponent; -const int std::numeric_limits::min_exponent10; -const int std::numeric_limits::max_exponent; -const int std::numeric_limits::max_exponent10; -const bool std::numeric_limits::has_infinity; -const bool std::numeric_limits::has_quiet_NaN; -const bool std::numeric_limits::has_signaling_NaN; -const std::float_denorm_style std::numeric_limits::has_denorm; -const bool std::numeric_limits::has_denorm_loss; -const bool std::numeric_limits::is_iec559; -const bool std::numeric_limits::is_bounded; -const bool std::numeric_limits::is_modulo; -const bool std::numeric_limits::traps; -const bool std::numeric_limits::tinyness_before; -const std::float_round_style std::numeric_limits::round_style; -#endif -#endif diff --git a/src/modifiedJellyfish/lib/jsoncpp.cpp b/src/modifiedJellyfish/lib/jsoncpp.cpp deleted file mode 100644 index 66650105..00000000 --- a/src/modifiedJellyfish/lib/jsoncpp.cpp +++ /dev/null @@ -1,4230 +0,0 @@ -/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/). -/// It is intented to be used with #include - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: LICENSE -// ////////////////////////////////////////////////////////////////////// - -/* -The JsonCpp library's source code, including accompanying documentation, -tests and demonstration applications, are licensed under the following -conditions... - -The author (Baptiste Lepilleur) explicitly disclaims copyright in all -jurisdictions which recognize such a disclaimer. In such jurisdictions, -this software is released into the Public Domain. - -In jurisdictions which do not recognize Public Domain property (e.g. Germany as of -2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is -released under the terms of the MIT License (see below). - -In jurisdictions which recognize Public Domain property, the user of this -software may choose to accept it either as 1) Public Domain, 2) under the -conditions of the MIT License (see below), or 3) under the terms of dual -Public Domain/MIT License conditions described here, as they choose. - -The MIT License is about as close to Public Domain as a license can get, and is -described in clear, concise terms at: - - http://en.wikipedia.org/wiki/MIT_License - -The full text of the MIT License follows: - -======================================================================== -Copyright (c) 2007-2010 Baptiste Lepilleur - -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. -======================================================================== -(END LICENSE TEXT) - -The MIT license is compatible with both the GPL and commercial -software, affording one all of the rights of Public Domain with the -minor nuisance of being required to keep the above copyright notice -and license text in the source code. Note also that by accepting the -Public Domain "license" you can re-license your copy using whatever -license you like. - -*/ - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: LICENSE -// ////////////////////////////////////////////////////////////////////// - - - - - - -#include - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_tool.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED -# define LIB_JSONCPP_JSON_TOOL_H_INCLUDED - -/* This header provides common string manipulation support, such as UTF-8, - * portable conversion from/to string... - * - * It is an internal header that must not be exposed. - */ - -namespace Json { - -/// Converts a unicode code-point to UTF-8. -static inline std::string -codePointToUTF8(unsigned int cp) -{ - std::string result; - - // based on description from http://en.wikipedia.org/wiki/UTF-8 - - if (cp <= 0x7f) - { - result.resize(1); - result[0] = static_cast(cp); - } - else if (cp <= 0x7FF) - { - result.resize(2); - result[1] = static_cast(0x80 | (0x3f & cp)); - result[0] = static_cast(0xC0 | (0x1f & (cp >> 6))); - } - else if (cp <= 0xFFFF) - { - result.resize(3); - result[2] = static_cast(0x80 | (0x3f & cp)); - result[1] = 0x80 | static_cast((0x3f & (cp >> 6))); - result[0] = 0xE0 | static_cast((0xf & (cp >> 12))); - } - else if (cp <= 0x10FFFF) - { - result.resize(4); - result[3] = static_cast(0x80 | (0x3f & cp)); - result[2] = static_cast(0x80 | (0x3f & (cp >> 6))); - result[1] = static_cast(0x80 | (0x3f & (cp >> 12))); - result[0] = static_cast(0xF0 | (0x7 & (cp >> 18))); - } - - return result; -} - - -/// Returns true if ch is a control character (in range [0,32[). -static inline bool -isControlCharacter(char ch) -{ - return ch > 0 && ch <= 0x1F; -} - - -enum { - /// Constant that specify the size of the buffer that must be passed to uintToString. - uintToStringBufferSize = 3*sizeof(LargestUInt)+1 -}; - -// Defines a char buffer for use with uintToString(). -typedef char UIntToStringBuffer[uintToStringBufferSize]; - - -/** Converts an unsigned integer to string. - * @param value Unsigned interger to convert to string - * @param current Input/Output string buffer. - * Must have at least uintToStringBufferSize chars free. - */ -static inline void -uintToString( LargestUInt value, - char *¤t ) -{ - *--current = 0; - do - { - *--current = char(value % 10) + '0'; - value /= 10; - } - while ( value != 0 ); -} - -} // namespace Json { - -#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_tool.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_reader.cpp -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#if !defined(JSON_IS_AMALGAMATION) -# include -# include -# include "json_tool.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#include -#include -#include - -#if _MSC_VER >= 1400 // VC++ 8.0 -#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. -#endif - -namespace Json { - -// Implementation of class Features -// //////////////////////////////// - -Features::Features() - : allowComments_( true ) - , strictRoot_( false ) -{ -} - - -Features -Features::all() -{ - return Features(); -} - - -Features -Features::strictMode() -{ - Features features; - features.allowComments_ = false; - features.strictRoot_ = true; - return features; -} - -// Implementation of class Reader -// //////////////////////////////// - - -static inline bool -in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4 ) -{ - return c == c1 || c == c2 || c == c3 || c == c4; -} - -static inline bool -in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4, Reader::Char c5 ) -{ - return c == c1 || c == c2 || c == c3 || c == c4 || c == c5; -} - - -static bool -containsNewLine( Reader::Location begin, - Reader::Location end ) -{ - for ( ;begin < end; ++begin ) - if ( *begin == '\n' || *begin == '\r' ) - return true; - return false; -} - - -// Class Reader -// ////////////////////////////////////////////////////////////////// - -Reader::Reader() - : features_( Features::all() ) -{ -} - - -Reader::Reader( const Features &features ) - : features_( features ) -{ -} - - -bool -Reader::parse( const std::string &document, - Value &root, - bool collectComments ) -{ - document_ = document; - const char *begin = document_.c_str(); - const char *end = begin + document_.length(); - return parse( begin, end, root, collectComments ); -} - - -bool -Reader::parse( std::istream& sin, - Value &root, - bool collectComments ) -{ - //std::istream_iterator begin(sin); - //std::istream_iterator end; - // Those would allow streamed input from a file, if parse() were a - // template function. - - // Since std::string is reference-counted, this at least does not - // create an extra copy. - std::string doc; - std::getline(sin, doc, (char)EOF); - return parse( doc, root, collectComments ); -} - -bool -Reader::parse( const char *beginDoc, const char *endDoc, - Value &root, - bool collectComments ) -{ - if ( !features_.allowComments_ ) - { - collectComments = false; - } - - begin_ = beginDoc; - end_ = endDoc; - collectComments_ = collectComments; - current_ = begin_; - lastValueEnd_ = 0; - lastValue_ = 0; - commentsBefore_ = ""; - errors_.clear(); - while ( !nodes_.empty() ) - nodes_.pop(); - nodes_.push( &root ); - - bool successful = readValue(); - Token token; - skipCommentTokens( token ); - if ( collectComments_ && !commentsBefore_.empty() ) - root.setComment( commentsBefore_, commentAfter ); - if ( features_.strictRoot_ ) - { - if ( !root.isArray() && !root.isObject() ) - { - // Set error location to start of doc, ideally should be first token found in doc - token.type_ = tokenError; - token.start_ = beginDoc; - token.end_ = endDoc; - addError( "A valid JSON document must be either an array or an object value.", - token ); - return false; - } - } - return successful; -} - - -bool -Reader::readValue() -{ - Token token; - skipCommentTokens( token ); - bool successful = true; - - if ( collectComments_ && !commentsBefore_.empty() ) - { - currentValue().setComment( commentsBefore_, commentBefore ); - commentsBefore_ = ""; - } - - - switch ( token.type_ ) - { - case tokenObjectBegin: - successful = readObject( token ); - break; - case tokenArrayBegin: - successful = readArray( token ); - break; - case tokenNumber: - successful = decodeNumber( token ); - break; - case tokenString: - successful = decodeString( token ); - break; - case tokenTrue: - currentValue() = true; - break; - case tokenFalse: - currentValue() = false; - break; - case tokenNull: - currentValue() = Value(); - break; - default: - return addError( "Syntax error: value, object or array expected.", token ); - } - - if ( collectComments_ ) - { - lastValueEnd_ = current_; - lastValue_ = ¤tValue(); - } - - return successful; -} - - -void -Reader::skipCommentTokens( Token &token ) -{ - if ( features_.allowComments_ ) - { - do - { - readToken( token ); - } - while ( token.type_ == tokenComment ); - } - else - { - readToken( token ); - } -} - - -bool -Reader::expectToken( TokenType type, Token &token, const char *message ) -{ - readToken( token ); - if ( token.type_ != type ) - return addError( message, token ); - return true; -} - - -bool -Reader::readToken( Token &token ) -{ - skipSpaces(); - token.start_ = current_; - Char c = getNextChar(); - bool ok = true; - switch ( c ) - { - case '{': - token.type_ = tokenObjectBegin; - break; - case '}': - token.type_ = tokenObjectEnd; - break; - case '[': - token.type_ = tokenArrayBegin; - break; - case ']': - token.type_ = tokenArrayEnd; - break; - case '"': - token.type_ = tokenString; - ok = readString(); - break; - case '/': - token.type_ = tokenComment; - ok = readComment(); - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '-': - token.type_ = tokenNumber; - readNumber(); - break; - case 't': - token.type_ = tokenTrue; - ok = match( "rue", 3 ); - break; - case 'f': - token.type_ = tokenFalse; - ok = match( "alse", 4 ); - break; - case 'n': - token.type_ = tokenNull; - ok = match( "ull", 3 ); - break; - case ',': - token.type_ = tokenArraySeparator; - break; - case ':': - token.type_ = tokenMemberSeparator; - break; - case 0: - token.type_ = tokenEndOfStream; - break; - default: - ok = false; - break; - } - if ( !ok ) - token.type_ = tokenError; - token.end_ = current_; - return true; -} - - -void -Reader::skipSpaces() -{ - while ( current_ != end_ ) - { - Char c = *current_; - if ( c == ' ' || c == '\t' || c == '\r' || c == '\n' ) - ++current_; - else - break; - } -} - - -bool -Reader::match( Location pattern, - int patternLength ) -{ - if ( end_ - current_ < patternLength ) - return false; - int index = patternLength; - while ( index-- ) - if ( current_[index] != pattern[index] ) - return false; - current_ += patternLength; - return true; -} - - -bool -Reader::readComment() -{ - Location commentBegin = current_ - 1; - Char c = getNextChar(); - bool successful = false; - if ( c == '*' ) - successful = readCStyleComment(); - else if ( c == '/' ) - successful = readCppStyleComment(); - if ( !successful ) - return false; - - if ( collectComments_ ) - { - CommentPlacement placement = commentBefore; - if ( lastValueEnd_ && !containsNewLine( lastValueEnd_, commentBegin ) ) - { - if ( c != '*' || !containsNewLine( commentBegin, current_ ) ) - placement = commentAfterOnSameLine; - } - - addComment( commentBegin, current_, placement ); - } - return true; -} - - -void -Reader::addComment( Location begin, - Location end, - CommentPlacement placement ) -{ - assert( collectComments_ ); - if ( placement == commentAfterOnSameLine ) - { - assert( lastValue_ != 0 ); - lastValue_->setComment( std::string( begin, end ), placement ); - } - else - { - if ( !commentsBefore_.empty() ) - commentsBefore_ += "\n"; - commentsBefore_ += std::string( begin, end ); - } -} - - -bool -Reader::readCStyleComment() -{ - while ( current_ != end_ ) - { - Char c = getNextChar(); - if ( c == '*' && *current_ == '/' ) - break; - } - return getNextChar() == '/'; -} - - -bool -Reader::readCppStyleComment() -{ - while ( current_ != end_ ) - { - Char c = getNextChar(); - if ( c == '\r' || c == '\n' ) - break; - } - return true; -} - - -void -Reader::readNumber() -{ - while ( current_ != end_ ) - { - if ( !(*current_ >= '0' && *current_ <= '9') && - !in( *current_, '.', 'e', 'E', '+', '-' ) ) - break; - ++current_; - } -} - -bool -Reader::readString() -{ - Char c = 0; - while ( current_ != end_ ) - { - c = getNextChar(); - if ( c == '\\' ) - getNextChar(); - else if ( c == '"' ) - break; - } - return c == '"'; -} - - -bool -Reader::readObject( Token &/*tokenStart*/ ) -{ - Token tokenName; - std::string name; - currentValue() = Value( objectValue ); - while ( readToken( tokenName ) ) - { - bool initialTokenOk = true; - while ( tokenName.type_ == tokenComment && initialTokenOk ) - initialTokenOk = readToken( tokenName ); - if ( !initialTokenOk ) - break; - if ( tokenName.type_ == tokenObjectEnd && name.empty() ) // empty object - return true; - if ( tokenName.type_ != tokenString ) - break; - - name = ""; - if ( !decodeString( tokenName, name ) ) - return recoverFromError( tokenObjectEnd ); - - Token colon; - if ( !readToken( colon ) || colon.type_ != tokenMemberSeparator ) - { - return addErrorAndRecover( "Missing ':' after object member name", - colon, - tokenObjectEnd ); - } - Value &value = currentValue()[ name ]; - nodes_.push( &value ); - bool ok = readValue(); - nodes_.pop(); - if ( !ok ) // error already set - return recoverFromError( tokenObjectEnd ); - - Token comma; - if ( !readToken( comma ) - || ( comma.type_ != tokenObjectEnd && - comma.type_ != tokenArraySeparator && - comma.type_ != tokenComment ) ) - { - return addErrorAndRecover( "Missing ',' or '}' in object declaration", - comma, - tokenObjectEnd ); - } - bool finalizeTokenOk = true; - while ( comma.type_ == tokenComment && - finalizeTokenOk ) - finalizeTokenOk = readToken( comma ); - if ( comma.type_ == tokenObjectEnd ) - return true; - } - return addErrorAndRecover( "Missing '}' or object member name", - tokenName, - tokenObjectEnd ); -} - - -bool -Reader::readArray( Token &/*tokenStart*/ ) -{ - currentValue() = Value( arrayValue ); - skipSpaces(); - if ( *current_ == ']' ) // empty array - { - Token endArray; - readToken( endArray ); - return true; - } - int index = 0; - for (;;) - { - Value &value = currentValue()[ index++ ]; - nodes_.push( &value ); - bool ok = readValue(); - nodes_.pop(); - if ( !ok ) // error already set - return recoverFromError( tokenArrayEnd ); - - Token token; - // Accept Comment after last item in the array. - ok = readToken( token ); - while ( token.type_ == tokenComment && ok ) - { - ok = readToken( token ); - } - bool badTokenType = ( token.type_ != tokenArraySeparator && - token.type_ != tokenArrayEnd ); - if ( !ok || badTokenType ) - { - return addErrorAndRecover( "Missing ',' or ']' in array declaration", - token, - tokenArrayEnd ); - } - if ( token.type_ == tokenArrayEnd ) - break; - } - return true; -} - - -bool -Reader::decodeNumber( Token &token ) -{ - bool isDouble = false; - for ( Location inspect = token.start_; inspect != token.end_; ++inspect ) - { - isDouble = isDouble - || in( *inspect, '.', 'e', 'E', '+' ) - || ( *inspect == '-' && inspect != token.start_ ); - } - if ( isDouble ) - return decodeDouble( token ); - // Attempts to parse the number as an integer. If the number is - // larger than the maximum supported value of an integer then - // we decode the number as a double. - Location current = token.start_; - bool isNegative = *current == '-'; - if ( isNegative ) - ++current; - Value::LargestUInt maxIntegerValue = isNegative ? Value::LargestUInt(-Value::minLargestInt) - : Value::maxLargestUInt; - Value::LargestUInt threshold = maxIntegerValue / 10; - Value::UInt lastDigitThreshold = Value::UInt( maxIntegerValue % 10 ); - assert( lastDigitThreshold <= 9 ); - Value::LargestUInt value = 0; - while ( current < token.end_ ) - { - Char c = *current++; - if ( c < '0' || c > '9' ) - return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); - Value::UInt digit(c - '0'); - if ( value >= threshold ) - { - // If the current digit is not the last one, or if it is - // greater than the last digit of the maximum integer value, - // the parse the number as a double. - if ( current != token.end_ || digit > lastDigitThreshold ) - { - return decodeDouble( token ); - } - } - value = value * 10 + digit; - } - if ( isNegative ) - currentValue() = -Value::LargestInt( value ); - else if ( value <= Value::LargestUInt(Value::maxInt) ) - currentValue() = Value::LargestInt( value ); - else - currentValue() = value; - return true; -} - - -bool -Reader::decodeDouble( Token &token ) -{ - double value = 0; - const int bufferSize = 32; - int count; - int length = int(token.end_ - token.start_); - if ( length <= bufferSize ) - { - Char buffer[bufferSize+1]; - memcpy( buffer, token.start_, length ); - buffer[length] = 0; - count = sscanf( buffer, "%lf", &value ); - } - else - { - std::string buffer( token.start_, token.end_ ); - count = sscanf( buffer.c_str(), "%lf", &value ); - } - - if ( count != 1 ) - return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); - currentValue() = value; - return true; -} - - -bool -Reader::decodeString( Token &token ) -{ - std::string decoded; - if ( !decodeString( token, decoded ) ) - return false; - currentValue() = decoded; - return true; -} - - -bool -Reader::decodeString( Token &token, std::string &decoded ) -{ - decoded.reserve( token.end_ - token.start_ - 2 ); - Location current = token.start_ + 1; // skip '"' - Location end = token.end_ - 1; // do not include '"' - while ( current != end ) - { - Char c = *current++; - if ( c == '"' ) - break; - else if ( c == '\\' ) - { - if ( current == end ) - return addError( "Empty escape sequence in string", token, current ); - Char escape = *current++; - switch ( escape ) - { - case '"': decoded += '"'; break; - case '/': decoded += '/'; break; - case '\\': decoded += '\\'; break; - case 'b': decoded += '\b'; break; - case 'f': decoded += '\f'; break; - case 'n': decoded += '\n'; break; - case 'r': decoded += '\r'; break; - case 't': decoded += '\t'; break; - case 'u': - { - unsigned int unicode; - if ( !decodeUnicodeCodePoint( token, current, end, unicode ) ) - return false; - decoded += codePointToUTF8(unicode); - } - break; - default: - return addError( "Bad escape sequence in string", token, current ); - } - } - else - { - decoded += c; - } - } - return true; -} - -bool -Reader::decodeUnicodeCodePoint( Token &token, - Location ¤t, - Location end, - unsigned int &unicode ) -{ - - if ( !decodeUnicodeEscapeSequence( token, current, end, unicode ) ) - return false; - if (unicode >= 0xD800 && unicode <= 0xDBFF) - { - // surrogate pairs - if (end - current < 6) - return addError( "additional six characters expected to parse unicode surrogate pair.", token, current ); - unsigned int surrogatePair; - if (*(current++) == '\\' && *(current++)== 'u') - { - if (decodeUnicodeEscapeSequence( token, current, end, surrogatePair )) - { - unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); - } - else - return false; - } - else - return addError( "expecting another \\u token to begin the second half of a unicode surrogate pair", token, current ); - } - return true; -} - -bool -Reader::decodeUnicodeEscapeSequence( Token &token, - Location ¤t, - Location end, - unsigned int &unicode ) -{ - if ( end - current < 4 ) - return addError( "Bad unicode escape sequence in string: four digits expected.", token, current ); - unicode = 0; - for ( int index =0; index < 4; ++index ) - { - Char c = *current++; - unicode *= 16; - if ( c >= '0' && c <= '9' ) - unicode += c - '0'; - else if ( c >= 'a' && c <= 'f' ) - unicode += c - 'a' + 10; - else if ( c >= 'A' && c <= 'F' ) - unicode += c - 'A' + 10; - else - return addError( "Bad unicode escape sequence in string: hexadecimal digit expected.", token, current ); - } - return true; -} - - -bool -Reader::addError( const std::string &message, - Token &token, - Location extra ) -{ - ErrorInfo info; - info.token_ = token; - info.message_ = message; - info.extra_ = extra; - errors_.push_back( info ); - return false; -} - - -bool -Reader::recoverFromError( TokenType skipUntilToken ) -{ - int errorCount = int(errors_.size()); - Token skip; - for (;;) - { - if ( !readToken(skip) ) - errors_.resize( errorCount ); // discard errors caused by recovery - if ( skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream ) - break; - } - errors_.resize( errorCount ); - return false; -} - - -bool -Reader::addErrorAndRecover( const std::string &message, - Token &token, - TokenType skipUntilToken ) -{ - addError( message, token ); - return recoverFromError( skipUntilToken ); -} - - -Value & -Reader::currentValue() -{ - return *(nodes_.top()); -} - - -Reader::Char -Reader::getNextChar() -{ - if ( current_ == end_ ) - return 0; - return *current_++; -} - - -void -Reader::getLocationLineAndColumn( Location location, - int &line, - int &column ) const -{ - Location current = begin_; - Location lastLineStart = current; - line = 0; - while ( current < location && current != end_ ) - { - Char c = *current++; - if ( c == '\r' ) - { - if ( *current == '\n' ) - ++current; - lastLineStart = current; - ++line; - } - else if ( c == '\n' ) - { - lastLineStart = current; - ++line; - } - } - // column & line start at 1 - column = int(location - lastLineStart) + 1; - ++line; -} - - -std::string -Reader::getLocationLineAndColumn( Location location ) const -{ - int line, column; - getLocationLineAndColumn( location, line, column ); - char buffer[18+16+16+1]; - sprintf( buffer, "Line %d, Column %d", line, column ); - return buffer; -} - - -// Deprecated. Preserved for backward compatibility -std::string -Reader::getFormatedErrorMessages() const -{ - return getFormattedErrorMessages(); -} - - -std::string -Reader::getFormattedErrorMessages() const -{ - std::string formattedMessage; - for ( Errors::const_iterator itError = errors_.begin(); - itError != errors_.end(); - ++itError ) - { - const ErrorInfo &error = *itError; - formattedMessage += "* " + getLocationLineAndColumn( error.token_.start_ ) + "\n"; - formattedMessage += " " + error.message_ + "\n"; - if ( error.extra_ ) - formattedMessage += "See " + getLocationLineAndColumn( error.extra_ ) + " for detail.\n"; - } - return formattedMessage; -} - - -std::istream& operator>>( std::istream &sin, Value &root ) -{ - Json::Reader reader; - bool ok = reader.parse(sin, root, true); - //JSON_ASSERT( ok ); - if (!ok) throw std::runtime_error(reader.getFormattedErrorMessages()); - return sin; -} - - -} // namespace Json - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_reader.cpp -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_batchallocator.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSONCPP_BATCHALLOCATOR_H_INCLUDED -# define JSONCPP_BATCHALLOCATOR_H_INCLUDED - -# include -# include - -# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - -namespace Json { - -/* Fast memory allocator. - * - * This memory allocator allocates memory for a batch of object (specified by - * the page size, the number of object in each page). - * - * It does not allow the destruction of a single object. All the allocated objects - * can be destroyed at once. The memory can be either released or reused for future - * allocation. - * - * The in-place new operator must be used to construct the object using the pointer - * returned by allocate. - */ -template -class BatchAllocator -{ -public: - typedef AllocatedType Type; - - BatchAllocator( unsigned int objectsPerPage = 255 ) - : freeHead_( 0 ) - , objectsPerPage_( objectsPerPage ) - { -// printf( "Size: %d => %s\n", sizeof(AllocatedType), typeid(AllocatedType).name() ); - assert( sizeof(AllocatedType) * objectPerAllocation >= sizeof(AllocatedType *) ); // We must be able to store a slist in the object free space. - assert( objectsPerPage >= 16 ); - batches_ = allocateBatch( 0 ); // allocated a dummy page - currentBatch_ = batches_; - } - - ~BatchAllocator() - { - for ( BatchInfo *batch = batches_; batch; ) - { - BatchInfo *nextBatch = batch->next_; - free( batch ); - batch = nextBatch; - } - } - - /// allocate space for an array of objectPerAllocation object. - /// @warning it is the responsability of the caller to call objects constructors. - AllocatedType *allocate() - { - if ( freeHead_ ) // returns node from free list. - { - AllocatedType *object = freeHead_; - freeHead_ = *(AllocatedType **)object; - return object; - } - if ( currentBatch_->used_ == currentBatch_->end_ ) - { - currentBatch_ = currentBatch_->next_; - while ( currentBatch_ && currentBatch_->used_ == currentBatch_->end_ ) - currentBatch_ = currentBatch_->next_; - - if ( !currentBatch_ ) // no free batch found, allocate a new one - { - currentBatch_ = allocateBatch( objectsPerPage_ ); - currentBatch_->next_ = batches_; // insert at the head of the list - batches_ = currentBatch_; - } - } - AllocatedType *allocated = currentBatch_->used_; - currentBatch_->used_ += objectPerAllocation; - return allocated; - } - - /// Release the object. - /// @warning it is the responsability of the caller to actually destruct the object. - void release( AllocatedType *object ) - { - assert( object != 0 ); - *(AllocatedType **)object = freeHead_; - freeHead_ = object; - } - -private: - struct BatchInfo - { - BatchInfo *next_; - AllocatedType *used_; - AllocatedType *end_; - AllocatedType buffer_[objectPerAllocation]; - }; - - // disabled copy constructor and assignement operator. - BatchAllocator( const BatchAllocator & ); - void operator =( const BatchAllocator &); - - static BatchInfo *allocateBatch( unsigned int objectsPerPage ) - { - const unsigned int mallocSize = sizeof(BatchInfo) - sizeof(AllocatedType)* objectPerAllocation - + sizeof(AllocatedType) * objectPerAllocation * objectsPerPage; - BatchInfo *batch = static_cast( malloc( mallocSize ) ); - batch->next_ = 0; - batch->used_ = batch->buffer_; - batch->end_ = batch->buffer_ + objectsPerPage; - return batch; - } - - BatchInfo *batches_; - BatchInfo *currentBatch_; - /// Head of a single linked list within the allocated space of freeed object - AllocatedType *freeHead_; - unsigned int objectsPerPage_; -}; - - -} // namespace Json - -# endif // ifndef JSONCPP_DOC_INCLUDE_IMPLEMENTATION - -#endif // JSONCPP_BATCHALLOCATOR_H_INCLUDED - - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_batchallocator.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_valueiterator.inl -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -// included by json_value.cpp - -namespace Json { - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class ValueIteratorBase -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -ValueIteratorBase::ValueIteratorBase() -#ifndef JSON_VALUE_USE_INTERNAL_MAP - : current_() - , isNull_( true ) -{ -} -#else - : isArray_( true ) - , isNull_( true ) -{ - iterator_.array_ = ValueInternalArray::IteratorState(); -} -#endif - - -#ifndef JSON_VALUE_USE_INTERNAL_MAP -ValueIteratorBase::ValueIteratorBase( const Value::ObjectValues::iterator ¤t ) - : current_( current ) - , isNull_( false ) -{ -} -#else -ValueIteratorBase::ValueIteratorBase( const ValueInternalArray::IteratorState &state ) - : isArray_( true ) -{ - iterator_.array_ = state; -} - - -ValueIteratorBase::ValueIteratorBase( const ValueInternalMap::IteratorState &state ) - : isArray_( false ) -{ - iterator_.map_ = state; -} -#endif - -Value & -ValueIteratorBase::deref() const -{ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - return current_->second; -#else - if ( isArray_ ) - return ValueInternalArray::dereference( iterator_.array_ ); - return ValueInternalMap::value( iterator_.map_ ); -#endif -} - - -void -ValueIteratorBase::increment() -{ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - ++current_; -#else - if ( isArray_ ) - ValueInternalArray::increment( iterator_.array_ ); - ValueInternalMap::increment( iterator_.map_ ); -#endif -} - - -void -ValueIteratorBase::decrement() -{ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - --current_; -#else - if ( isArray_ ) - ValueInternalArray::decrement( iterator_.array_ ); - ValueInternalMap::decrement( iterator_.map_ ); -#endif -} - - -ValueIteratorBase::difference_type -ValueIteratorBase::computeDistance( const SelfType &other ) const -{ -#ifndef JSON_VALUE_USE_INTERNAL_MAP -# ifdef JSON_USE_CPPTL_SMALLMAP - return current_ - other.current_; -# else - // Iterator for null value are initialized using the default - // constructor, which initialize current_ to the default - // std::map::iterator. As begin() and end() are two instance - // of the default std::map::iterator, they can not be compared. - // To allow this, we handle this comparison specifically. - if ( isNull_ && other.isNull_ ) - { - return 0; - } - - - // Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL, - // which is the one used by default). - // Using a portable hand-made version for non random iterator instead: - // return difference_type( std::distance( current_, other.current_ ) ); - difference_type myDistance = 0; - for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it ) - { - ++myDistance; - } - return myDistance; -# endif -#else - if ( isArray_ ) - return ValueInternalArray::distance( iterator_.array_, other.iterator_.array_ ); - return ValueInternalMap::distance( iterator_.map_, other.iterator_.map_ ); -#endif -} - - -bool -ValueIteratorBase::isEqual( const SelfType &other ) const -{ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - if ( isNull_ ) - { - return other.isNull_; - } - return current_ == other.current_; -#else - if ( isArray_ ) - return ValueInternalArray::equals( iterator_.array_, other.iterator_.array_ ); - return ValueInternalMap::equals( iterator_.map_, other.iterator_.map_ ); -#endif -} - - -void -ValueIteratorBase::copy( const SelfType &other ) -{ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - current_ = other.current_; -#else - if ( isArray_ ) - iterator_.array_ = other.iterator_.array_; - iterator_.map_ = other.iterator_.map_; -#endif -} - - -Value -ValueIteratorBase::key() const -{ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - const Value::CZString czstring = (*current_).first; - if ( czstring.c_str() ) - { - if ( czstring.isStaticString() ) - return Value( StaticString( czstring.c_str() ) ); - return Value( czstring.c_str() ); - } - return Value( czstring.index() ); -#else - if ( isArray_ ) - return Value( ValueInternalArray::indexOf( iterator_.array_ ) ); - bool isStatic; - const char *memberName = ValueInternalMap::key( iterator_.map_, isStatic ); - if ( isStatic ) - return Value( StaticString( memberName ) ); - return Value( memberName ); -#endif -} - - -UInt -ValueIteratorBase::index() const -{ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - const Value::CZString czstring = (*current_).first; - if ( !czstring.c_str() ) - return czstring.index(); - return Value::UInt( -1 ); -#else - if ( isArray_ ) - return Value::UInt( ValueInternalArray::indexOf( iterator_.array_ ) ); - return Value::UInt( -1 ); -#endif -} - - -const char * -ValueIteratorBase::memberName() const -{ -#ifndef JSON_VALUE_USE_INTERNAL_MAP - const char *name = (*current_).first.c_str(); - return name ? name : ""; -#else - if ( !isArray_ ) - return ValueInternalMap::key( iterator_.map_ ); - return ""; -#endif -} - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class ValueConstIterator -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -ValueConstIterator::ValueConstIterator() -{ -} - - -#ifndef JSON_VALUE_USE_INTERNAL_MAP -ValueConstIterator::ValueConstIterator( const Value::ObjectValues::iterator ¤t ) - : ValueIteratorBase( current ) -{ -} -#else -ValueConstIterator::ValueConstIterator( const ValueInternalArray::IteratorState &state ) - : ValueIteratorBase( state ) -{ -} - -ValueConstIterator::ValueConstIterator( const ValueInternalMap::IteratorState &state ) - : ValueIteratorBase( state ) -{ -} -#endif - -ValueConstIterator & -ValueConstIterator::operator =( const ValueIteratorBase &other ) -{ - copy( other ); - return *this; -} - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class ValueIterator -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -ValueIterator::ValueIterator() -{ -} - - -#ifndef JSON_VALUE_USE_INTERNAL_MAP -ValueIterator::ValueIterator( const Value::ObjectValues::iterator ¤t ) - : ValueIteratorBase( current ) -{ -} -#else -ValueIterator::ValueIterator( const ValueInternalArray::IteratorState &state ) - : ValueIteratorBase( state ) -{ -} - -ValueIterator::ValueIterator( const ValueInternalMap::IteratorState &state ) - : ValueIteratorBase( state ) -{ -} -#endif - -ValueIterator::ValueIterator( const ValueConstIterator &other ) - : ValueIteratorBase( other ) -{ -} - -ValueIterator::ValueIterator( const ValueIterator &other ) - : ValueIteratorBase( other ) -{ -} - -ValueIterator & -ValueIterator::operator =( const SelfType &other ) -{ - copy( other ); - return *this; -} - -} // namespace Json - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_valueiterator.inl -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_value.cpp -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#if !defined(JSON_IS_AMALGAMATION) -# include -# include -# ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR -# include "json_batchallocator.h" -# endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#include -#include -#ifdef JSON_USE_CPPTL -# include -#endif -#include // size_t - -#define JSON_ASSERT_UNREACHABLE assert( false ) -#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw -#define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message ); -#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) JSON_FAIL_MESSAGE( message ) - -namespace Json { - -const Value Value::null; -const Int Value::minInt = Int( ~(UInt(-1)/2) ); -const Int Value::maxInt = Int( UInt(-1)/2 ); -const UInt Value::maxUInt = UInt(-1); -const Int64 Value::minInt64 = Int64( ~(UInt64(-1)/2) ); -const Int64 Value::maxInt64 = Int64( UInt64(-1)/2 ); -const UInt64 Value::maxUInt64 = UInt64(-1); -const LargestInt Value::minLargestInt = LargestInt( ~(LargestUInt(-1)/2) ); -const LargestInt Value::maxLargestInt = LargestInt( LargestUInt(-1)/2 ); -const LargestUInt Value::maxLargestUInt = LargestUInt(-1); - - -/// Unknown size marker -static const unsigned int unknown = (unsigned)-1; - - -/** Duplicates the specified string value. - * @param value Pointer to the string to duplicate. Must be zero-terminated if - * length is "unknown". - * @param length Length of the value. if equals to unknown, then it will be - * computed using strlen(value). - * @return Pointer on the duplicate instance of string. - */ -static inline char * -duplicateStringValue( const char *value, - unsigned int length = unknown ) -{ - if ( length == unknown ) - length = (unsigned int)strlen(value); - char *newString = static_cast( malloc( length + 1 ) ); - JSON_ASSERT_MESSAGE( newString != 0, "Failed to allocate string value buffer" ); - memcpy( newString, value, length ); - newString[length] = 0; - return newString; -} - - -/** Free the string duplicated by duplicateStringValue(). - */ -static inline void -releaseStringValue( char *value ) -{ - if ( value ) - free( value ); -} - -} // namespace Json - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ValueInternals... -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -#if !defined(JSON_IS_AMALGAMATION) -# ifdef JSON_VALUE_USE_INTERNAL_MAP -# include "json_internalarray.inl" -# include "json_internalmap.inl" -# endif // JSON_VALUE_USE_INTERNAL_MAP - -# include "json_valueiterator.inl" -#endif // if !defined(JSON_IS_AMALGAMATION) - -namespace Json { - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class Value::CommentInfo -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - - -Value::CommentInfo::CommentInfo() - : comment_( 0 ) -{ -} - -Value::CommentInfo::~CommentInfo() -{ - if ( comment_ ) - releaseStringValue( comment_ ); -} - - -void -Value::CommentInfo::setComment( const char *text ) -{ - if ( comment_ ) - releaseStringValue( comment_ ); - JSON_ASSERT( text != 0 ); - JSON_ASSERT_MESSAGE( text[0]=='\0' || text[0]=='/', "Comments must start with /"); - // It seems that /**/ style comments are acceptable as well. - comment_ = duplicateStringValue( text ); -} - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class Value::CZString -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -# ifndef JSON_VALUE_USE_INTERNAL_MAP - -// Notes: index_ indicates if the string was allocated when -// a string is stored. - -Value::CZString::CZString( ArrayIndex index ) - : cstr_( 0 ) - , index_( index ) -{ -} - -Value::CZString::CZString( const char *cstr, DuplicationPolicy allocate ) - : cstr_( allocate == duplicate ? duplicateStringValue(cstr) - : cstr ) - , index_( allocate ) -{ -} - -Value::CZString::CZString( const CZString &other ) -: cstr_( other.index_ != noDuplication && other.cstr_ != 0 - ? duplicateStringValue( other.cstr_ ) - : other.cstr_ ) - , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate) - : other.index_ ) -{ -} - -Value::CZString::~CZString() -{ - if ( cstr_ && index_ == duplicate ) - releaseStringValue( const_cast( cstr_ ) ); -} - -void -Value::CZString::swap( CZString &other ) -{ - std::swap( cstr_, other.cstr_ ); - std::swap( index_, other.index_ ); -} - -Value::CZString & -Value::CZString::operator =( const CZString &other ) -{ - CZString temp( other ); - swap( temp ); - return *this; -} - -bool -Value::CZString::operator<( const CZString &other ) const -{ - if ( cstr_ ) - return strcmp( cstr_, other.cstr_ ) < 0; - return index_ < other.index_; -} - -bool -Value::CZString::operator==( const CZString &other ) const -{ - if ( cstr_ ) - return strcmp( cstr_, other.cstr_ ) == 0; - return index_ == other.index_; -} - - -ArrayIndex -Value::CZString::index() const -{ - return index_; -} - - -const char * -Value::CZString::c_str() const -{ - return cstr_; -} - -bool -Value::CZString::isStaticString() const -{ - return index_ == noDuplication; -} - -#endif // ifndef JSON_VALUE_USE_INTERNAL_MAP - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class Value::Value -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -/*! \internal Default constructor initialization must be equivalent to: - * memset( this, 0, sizeof(Value) ) - * This optimization is used in ValueInternalMap fast allocator. - */ -Value::Value( ValueType type ) - : type_( type ) - , allocated_( 0 ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - switch ( type ) - { - case nullValue: - break; - case intValue: - case uintValue: - value_.int_ = 0; - break; - case realValue: - value_.real_ = 0.0; - break; - case stringValue: - value_.string_ = 0; - break; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - value_.map_ = new ObjectValues(); - break; -#else - case arrayValue: - value_.array_ = arrayAllocator()->newArray(); - break; - case objectValue: - value_.map_ = mapAllocator()->newMap(); - break; -#endif - case booleanValue: - value_.bool_ = false; - break; - default: - JSON_ASSERT_UNREACHABLE; - } -} - - -#if defined(JSON_HAS_INT64) -Value::Value( UInt value ) - : type_( uintValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.uint_ = value; -} - -Value::Value( Int value ) - : type_( intValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.int_ = value; -} - -#endif // if defined(JSON_HAS_INT64) - - -Value::Value( Int64 value ) - : type_( intValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.int_ = value; -} - - -Value::Value( UInt64 value ) - : type_( uintValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.uint_ = value; -} - -Value::Value( double value ) - : type_( realValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.real_ = value; -} - -Value::Value( const char *value ) - : type_( stringValue ) - , allocated_( true ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = duplicateStringValue( value ); -} - - -Value::Value( const char *beginValue, - const char *endValue ) - : type_( stringValue ) - , allocated_( true ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = duplicateStringValue( beginValue, - (unsigned int)(endValue - beginValue) ); -} - - -Value::Value( const std::string &value ) - : type_( stringValue ) - , allocated_( true ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = duplicateStringValue( value.c_str(), - (unsigned int)value.length() ); - -} - -Value::Value( const StaticString &value ) - : type_( stringValue ) - , allocated_( false ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = const_cast( value.c_str() ); -} - - -# ifdef JSON_USE_CPPTL -Value::Value( const CppTL::ConstString &value ) - : type_( stringValue ) - , allocated_( true ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = duplicateStringValue( value, value.length() ); -} -# endif - -Value::Value( bool value ) - : type_( booleanValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.bool_ = value; -} - - -Value::Value( const Value &other ) - : type_( other.type_ ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - switch ( type_ ) - { - case nullValue: - case intValue: - case uintValue: - case realValue: - case booleanValue: - value_ = other.value_; - break; - case stringValue: - if ( other.value_.string_ ) - { - value_.string_ = duplicateStringValue( other.value_.string_ ); - allocated_ = true; - } - else - value_.string_ = 0; - break; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - value_.map_ = new ObjectValues( *other.value_.map_ ); - break; -#else - case arrayValue: - value_.array_ = arrayAllocator()->newArrayCopy( *other.value_.array_ ); - break; - case objectValue: - value_.map_ = mapAllocator()->newMapCopy( *other.value_.map_ ); - break; -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - if ( other.comments_ ) - { - comments_ = new CommentInfo[numberOfCommentPlacement]; - for ( int comment =0; comment < numberOfCommentPlacement; ++comment ) - { - const CommentInfo &otherComment = other.comments_[comment]; - if ( otherComment.comment_ ) - comments_[comment].setComment( otherComment.comment_ ); - } - } -} - - -Value::~Value() -{ - switch ( type_ ) - { - case nullValue: - case intValue: - case uintValue: - case realValue: - case booleanValue: - break; - case stringValue: - if ( allocated_ ) - releaseStringValue( value_.string_ ); - break; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - delete value_.map_; - break; -#else - case arrayValue: - arrayAllocator()->destructArray( value_.array_ ); - break; - case objectValue: - mapAllocator()->destructMap( value_.map_ ); - break; -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - - if ( comments_ ) - delete[] comments_; -} - -Value & -Value::operator=( const Value &other ) -{ - Value temp( other ); - swap( temp ); - return *this; -} - -void -Value::swap( Value &other ) -{ - ValueType temp = type_; - type_ = other.type_; - other.type_ = temp; - std::swap( value_, other.value_ ); - int temp2 = allocated_; - allocated_ = other.allocated_; - other.allocated_ = temp2; -} - -ValueType -Value::type() const -{ - return type_; -} - - -int -Value::compare( const Value &other ) const -{ - if ( *this < other ) - return -1; - if ( *this > other ) - return 1; - return 0; -} - - -bool -Value::operator <( const Value &other ) const -{ - int typeDelta = type_ - other.type_; - if ( typeDelta ) - return typeDelta < 0 ? true : false; - switch ( type_ ) - { - case nullValue: - return false; - case intValue: - return value_.int_ < other.value_.int_; - case uintValue: - return value_.uint_ < other.value_.uint_; - case realValue: - return value_.real_ < other.value_.real_; - case booleanValue: - return value_.bool_ < other.value_.bool_; - case stringValue: - return ( value_.string_ == 0 && other.value_.string_ ) - || ( other.value_.string_ - && value_.string_ - && strcmp( value_.string_, other.value_.string_ ) < 0 ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - { - int delta = int( value_.map_->size() - other.value_.map_->size() ); - if ( delta ) - return delta < 0; - return (*value_.map_) < (*other.value_.map_); - } -#else - case arrayValue: - return value_.array_->compare( *(other.value_.array_) ) < 0; - case objectValue: - return value_.map_->compare( *(other.value_.map_) ) < 0; -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - return false; // unreachable -} - -bool -Value::operator <=( const Value &other ) const -{ - return !(other < *this); -} - -bool -Value::operator >=( const Value &other ) const -{ - return !(*this < other); -} - -bool -Value::operator >( const Value &other ) const -{ - return other < *this; -} - -bool -Value::operator ==( const Value &other ) const -{ - //if ( type_ != other.type_ ) - // GCC 2.95.3 says: - // attempt to take address of bit-field structure member `Json::Value::type_' - // Beats me, but a temp solves the problem. - int temp = other.type_; - if ( type_ != temp ) - return false; - switch ( type_ ) - { - case nullValue: - return true; - case intValue: - return value_.int_ == other.value_.int_; - case uintValue: - return value_.uint_ == other.value_.uint_; - case realValue: - return value_.real_ == other.value_.real_; - case booleanValue: - return value_.bool_ == other.value_.bool_; - case stringValue: - return ( value_.string_ == other.value_.string_ ) - || ( other.value_.string_ - && value_.string_ - && strcmp( value_.string_, other.value_.string_ ) == 0 ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - return value_.map_->size() == other.value_.map_->size() - && (*value_.map_) == (*other.value_.map_); -#else - case arrayValue: - return value_.array_->compare( *(other.value_.array_) ) == 0; - case objectValue: - return value_.map_->compare( *(other.value_.map_) ) == 0; -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - return false; // unreachable -} - -bool -Value::operator !=( const Value &other ) const -{ - return !( *this == other ); -} - -const char * -Value::asCString() const -{ - JSON_ASSERT( type_ == stringValue ); - return value_.string_; -} - - -std::string -Value::asString() const -{ - switch ( type_ ) - { - case nullValue: - return ""; - case stringValue: - return value_.string_ ? value_.string_ : ""; - case booleanValue: - return value_.bool_ ? "true" : "false"; - case intValue: - case uintValue: - case realValue: - case arrayValue: - case objectValue: - JSON_FAIL_MESSAGE( "Type is not convertible to string" ); - default: - JSON_ASSERT_UNREACHABLE; - } - return ""; // unreachable -} - -# ifdef JSON_USE_CPPTL -CppTL::ConstString -Value::asConstString() const -{ - return CppTL::ConstString( asString().c_str() ); -} -# endif - - -Value::Int -Value::asInt() const -{ - switch ( type_ ) - { - case nullValue: - return 0; - case intValue: - JSON_ASSERT_MESSAGE( value_.int_ >= minInt && value_.int_ <= maxInt, "unsigned integer out of signed int range" ); - return Int(value_.int_); - case uintValue: - JSON_ASSERT_MESSAGE( value_.uint_ <= UInt(maxInt), "unsigned integer out of signed int range" ); - return Int(value_.uint_); - case realValue: - JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" ); - return Int( value_.real_ ); - case booleanValue: - return value_.bool_ ? 1 : 0; - case stringValue: - case arrayValue: - case objectValue: - JSON_FAIL_MESSAGE( "Type is not convertible to int" ); - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} - - -Value::UInt -Value::asUInt() const -{ - switch ( type_ ) - { - case nullValue: - return 0; - case intValue: - JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to unsigned integer" ); - JSON_ASSERT_MESSAGE( value_.int_ <= maxUInt, "signed integer out of UInt range" ); - return UInt(value_.int_); - case uintValue: - JSON_ASSERT_MESSAGE( value_.uint_ <= maxUInt, "unsigned integer out of UInt range" ); - return UInt(value_.uint_); - case realValue: - JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt, "Real out of unsigned integer range" ); - return UInt( value_.real_ ); - case booleanValue: - return value_.bool_ ? 1 : 0; - case stringValue: - case arrayValue: - case objectValue: - JSON_FAIL_MESSAGE( "Type is not convertible to uint" ); - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} - - -# if defined(JSON_HAS_INT64) - -Value::Int64 -Value::asInt64() const -{ - switch ( type_ ) - { - case nullValue: - return 0; - case intValue: - return value_.int_; - case uintValue: - JSON_ASSERT_MESSAGE( value_.uint_ <= UInt64(maxInt64), "unsigned integer out of Int64 range" ); - return value_.uint_; - case realValue: - JSON_ASSERT_MESSAGE( value_.real_ >= minInt64 && value_.real_ <= maxInt64, "Real out of Int64 range" ); - return Int( value_.real_ ); - case booleanValue: - return value_.bool_ ? 1 : 0; - case stringValue: - case arrayValue: - case objectValue: - JSON_FAIL_MESSAGE( "Type is not convertible to Int64" ); - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} - - -Value::UInt64 -Value::asUInt64() const -{ - switch ( type_ ) - { - case nullValue: - return 0; - case intValue: - JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to UInt64" ); - return value_.int_; - case uintValue: - return value_.uint_; - case realValue: - JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt64, "Real out of UInt64 range" ); - return UInt( value_.real_ ); - case booleanValue: - return value_.bool_ ? 1 : 0; - case stringValue: - case arrayValue: - case objectValue: - JSON_FAIL_MESSAGE( "Type is not convertible to UInt64" ); - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} -# endif // if defined(JSON_HAS_INT64) - - -LargestInt -Value::asLargestInt() const -{ -#if defined(JSON_NO_INT64) - return asInt(); -#else - return asInt64(); -#endif -} - - -LargestUInt -Value::asLargestUInt() const -{ -#if defined(JSON_NO_INT64) - return asUInt(); -#else - return asUInt64(); -#endif -} - - -double -Value::asDouble() const -{ - switch ( type_ ) - { - case nullValue: - return 0.0; - case intValue: - return static_cast( value_.int_ ); - case uintValue: -#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - return static_cast( value_.uint_ ); -#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - return static_cast( Int(value_.uint_/2) ) * 2 + Int(value_.uint_ & 1); -#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - case realValue: - return value_.real_; - case booleanValue: - return value_.bool_ ? 1.0 : 0.0; - case stringValue: - case arrayValue: - case objectValue: - JSON_FAIL_MESSAGE( "Type is not convertible to double" ); - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} - -float -Value::asFloat() const -{ - switch ( type_ ) - { - case nullValue: - return 0.0f; - case intValue: - return static_cast( value_.int_ ); - case uintValue: -#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - return static_cast( value_.uint_ ); -#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - return static_cast( Int(value_.uint_/2) ) * 2 + Int(value_.uint_ & 1); -#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - case realValue: - return static_cast( value_.real_ ); - case booleanValue: - return value_.bool_ ? 1.0f : 0.0f; - case stringValue: - case arrayValue: - case objectValue: - JSON_FAIL_MESSAGE( "Type is not convertible to float" ); - default: - JSON_ASSERT_UNREACHABLE; - } - return 0.0f; // unreachable; -} - -bool -Value::asBool() const -{ - switch ( type_ ) - { - case nullValue: - return false; - case intValue: - case uintValue: - return value_.int_ != 0; - case realValue: - return value_.real_ != 0.0; - case booleanValue: - return value_.bool_; - case stringValue: - return value_.string_ && value_.string_[0] != 0; - case arrayValue: - case objectValue: - return value_.map_->size() != 0; - default: - JSON_ASSERT_UNREACHABLE; - } - return false; // unreachable; -} - - -bool -Value::isConvertibleTo( ValueType other ) const -{ - switch ( type_ ) - { - case nullValue: - return true; - case intValue: - return ( other == nullValue && value_.int_ == 0 ) - || other == intValue - || ( other == uintValue && value_.int_ >= 0 ) - || other == realValue - || other == stringValue - || other == booleanValue; - case uintValue: - return ( other == nullValue && value_.uint_ == 0 ) - || ( other == intValue && value_.uint_ <= (unsigned)maxInt ) - || other == uintValue - || other == realValue - || other == stringValue - || other == booleanValue; - case realValue: - return ( other == nullValue && value_.real_ == 0.0 ) - || ( other == intValue && value_.real_ >= minInt && value_.real_ <= maxInt ) - || ( other == uintValue && value_.real_ >= 0 && value_.real_ <= maxUInt ) - || other == realValue - || other == stringValue - || other == booleanValue; - case booleanValue: - return ( other == nullValue && value_.bool_ == false ) - || other == intValue - || other == uintValue - || other == realValue - || other == stringValue - || other == booleanValue; - case stringValue: - return other == stringValue - || ( other == nullValue && (!value_.string_ || value_.string_[0] == 0) ); - case arrayValue: - return other == arrayValue - || ( other == nullValue && value_.map_->size() == 0 ); - case objectValue: - return other == objectValue - || ( other == nullValue && value_.map_->size() == 0 ); - default: - JSON_ASSERT_UNREACHABLE; - } - return false; // unreachable; -} - - -/// Number of values in array or object -ArrayIndex -Value::size() const -{ - switch ( type_ ) - { - case nullValue: - case intValue: - case uintValue: - case realValue: - case booleanValue: - case stringValue: - return 0; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: // size of the array is highest index + 1 - if ( !value_.map_->empty() ) - { - ObjectValues::const_iterator itLast = value_.map_->end(); - --itLast; - return (*itLast).first.index()+1; - } - return 0; - case objectValue: - return ArrayIndex( value_.map_->size() ); -#else - case arrayValue: - return Int( value_.array_->size() ); - case objectValue: - return Int( value_.map_->size() ); -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} - - -bool -Value::empty() const -{ - if ( isNull() || isArray() || isObject() ) - return size() == 0u; - else - return false; -} - - -bool -Value::operator!() const -{ - return isNull(); -} - - -void -Value::clear() -{ - JSON_ASSERT( type_ == nullValue || type_ == arrayValue || type_ == objectValue ); - - switch ( type_ ) - { -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - value_.map_->clear(); - break; -#else - case arrayValue: - value_.array_->clear(); - break; - case objectValue: - value_.map_->clear(); - break; -#endif - default: - break; - } -} - -void -Value::resize( ArrayIndex newSize ) -{ - JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); - if ( type_ == nullValue ) - *this = Value( arrayValue ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - ArrayIndex oldSize = size(); - if ( newSize == 0 ) - clear(); - else if ( newSize > oldSize ) - (*this)[ newSize - 1 ]; - else - { - for ( ArrayIndex index = newSize; index < oldSize; ++index ) - { - value_.map_->erase( index ); - } - assert( size() == newSize ); - } -#else - value_.array_->resize( newSize ); -#endif -} - - -Value & -Value::operator[]( ArrayIndex index ) -{ - JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); - if ( type_ == nullValue ) - *this = Value( arrayValue ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString key( index ); - ObjectValues::iterator it = value_.map_->lower_bound( key ); - if ( it != value_.map_->end() && (*it).first == key ) - return (*it).second; - - ObjectValues::value_type defaultValue( key, null ); - it = value_.map_->insert( it, defaultValue ); - return (*it).second; -#else - return value_.array_->resolveReference( index ); -#endif -} - - -Value & -Value::operator[]( int index ) -{ - JSON_ASSERT( index >= 0 ); - return (*this)[ ArrayIndex(index) ]; -} - - -const Value & -Value::operator[]( ArrayIndex index ) const -{ - JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); - if ( type_ == nullValue ) - return null; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString key( index ); - ObjectValues::const_iterator it = value_.map_->find( key ); - if ( it == value_.map_->end() ) - return null; - return (*it).second; -#else - Value *value = value_.array_->find( index ); - return value ? *value : null; -#endif -} - - -const Value & -Value::operator[]( int index ) const -{ - JSON_ASSERT( index >= 0 ); - return (*this)[ ArrayIndex(index) ]; -} - - -Value & -Value::operator[]( const char *key ) -{ - return resolveReference( key, false ); -} - - -Value & -Value::resolveReference( const char *key, - bool isStatic ) -{ - JSON_ASSERT( type_ == nullValue || type_ == objectValue ); - if ( type_ == nullValue ) - *this = Value( objectValue ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString actualKey( key, isStatic ? CZString::noDuplication - : CZString::duplicateOnCopy ); - ObjectValues::iterator it = value_.map_->lower_bound( actualKey ); - if ( it != value_.map_->end() && (*it).first == actualKey ) - return (*it).second; - - ObjectValues::value_type defaultValue( actualKey, null ); - it = value_.map_->insert( it, defaultValue ); - Value &value = (*it).second; - return value; -#else - return value_.map_->resolveReference( key, isStatic ); -#endif -} - - -Value -Value::get( ArrayIndex index, - const Value &defaultValue ) const -{ - const Value *value = &((*this)[index]); - return value == &null ? defaultValue : *value; -} - - -bool -Value::isValidIndex( ArrayIndex index ) const -{ - return index < size(); -} - - - -const Value & -Value::operator[]( const char *key ) const -{ - JSON_ASSERT( type_ == nullValue || type_ == objectValue ); - if ( type_ == nullValue ) - return null; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString actualKey( key, CZString::noDuplication ); - ObjectValues::const_iterator it = value_.map_->find( actualKey ); - if ( it == value_.map_->end() ) - return null; - return (*it).second; -#else - const Value *value = value_.map_->find( key ); - return value ? *value : null; -#endif -} - - -Value & -Value::operator[]( const std::string &key ) -{ - return (*this)[ key.c_str() ]; -} - - -const Value & -Value::operator[]( const std::string &key ) const -{ - return (*this)[ key.c_str() ]; -} - -Value & -Value::operator[]( const StaticString &key ) -{ - return resolveReference( key, true ); -} - - -# ifdef JSON_USE_CPPTL -Value & -Value::operator[]( const CppTL::ConstString &key ) -{ - return (*this)[ key.c_str() ]; -} - - -const Value & -Value::operator[]( const CppTL::ConstString &key ) const -{ - return (*this)[ key.c_str() ]; -} -# endif - - -Value & -Value::append( const Value &value ) -{ - return (*this)[size()] = value; -} - - -Value -Value::get( const char *key, - const Value &defaultValue ) const -{ - const Value *value = &((*this)[key]); - return value == &null ? defaultValue : *value; -} - - -Value -Value::get( const std::string &key, - const Value &defaultValue ) const -{ - return get( key.c_str(), defaultValue ); -} - -Value -Value::removeMember( const char* key ) -{ - JSON_ASSERT( type_ == nullValue || type_ == objectValue ); - if ( type_ == nullValue ) - return null; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString actualKey( key, CZString::noDuplication ); - ObjectValues::iterator it = value_.map_->find( actualKey ); - if ( it == value_.map_->end() ) - return null; - Value old(it->second); - value_.map_->erase(it); - return old; -#else - Value *value = value_.map_->find( key ); - if (value){ - Value old(*value); - value_.map_.remove( key ); - return old; - } else { - return null; - } -#endif -} - -Value -Value::removeMember( const std::string &key ) -{ - return removeMember( key.c_str() ); -} - -# ifdef JSON_USE_CPPTL -Value -Value::get( const CppTL::ConstString &key, - const Value &defaultValue ) const -{ - return get( key.c_str(), defaultValue ); -} -# endif - -bool -Value::isMember( const char *key ) const -{ - const Value *value = &((*this)[key]); - return value != &null; -} - - -bool -Value::isMember( const std::string &key ) const -{ - return isMember( key.c_str() ); -} - - -# ifdef JSON_USE_CPPTL -bool -Value::isMember( const CppTL::ConstString &key ) const -{ - return isMember( key.c_str() ); -} -#endif - -Value::Members -Value::getMemberNames() const -{ - JSON_ASSERT( type_ == nullValue || type_ == objectValue ); - if ( type_ == nullValue ) - return Value::Members(); - Members members; - members.reserve( value_.map_->size() ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - ObjectValues::const_iterator it = value_.map_->begin(); - ObjectValues::const_iterator itEnd = value_.map_->end(); - for ( ; it != itEnd; ++it ) - members.push_back( std::string( (*it).first.c_str() ) ); -#else - ValueInternalMap::IteratorState it; - ValueInternalMap::IteratorState itEnd; - value_.map_->makeBeginIterator( it ); - value_.map_->makeEndIterator( itEnd ); - for ( ; !ValueInternalMap::equals( it, itEnd ); ValueInternalMap::increment(it) ) - members.push_back( std::string( ValueInternalMap::key( it ) ) ); -#endif - return members; -} -// -//# ifdef JSON_USE_CPPTL -//EnumMemberNames -//Value::enumMemberNames() const -//{ -// if ( type_ == objectValue ) -// { -// return CppTL::Enum::any( CppTL::Enum::transform( -// CppTL::Enum::keys( *(value_.map_), CppTL::Type() ), -// MemberNamesTransform() ) ); -// } -// return EnumMemberNames(); -//} -// -// -//EnumValues -//Value::enumValues() const -//{ -// if ( type_ == objectValue || type_ == arrayValue ) -// return CppTL::Enum::anyValues( *(value_.map_), -// CppTL::Type() ); -// return EnumValues(); -//} -// -//# endif - - -bool -Value::isNull() const -{ - return type_ == nullValue; -} - - -bool -Value::isBool() const -{ - return type_ == booleanValue; -} - - -bool -Value::isInt() const -{ - return type_ == intValue; -} - - -bool -Value::isUInt() const -{ - return type_ == uintValue; -} - - -bool -Value::isIntegral() const -{ - return type_ == intValue - || type_ == uintValue - || type_ == booleanValue; -} - - -bool -Value::isDouble() const -{ - return type_ == realValue; -} - - -bool -Value::isNumeric() const -{ - return isIntegral() || isDouble(); -} - - -bool -Value::isString() const -{ - return type_ == stringValue; -} - - -bool -Value::isArray() const -{ - return type_ == nullValue || type_ == arrayValue; -} - - -bool -Value::isObject() const -{ - return type_ == nullValue || type_ == objectValue; -} - - -void -Value::setComment( const char *comment, - CommentPlacement placement ) -{ - if ( !comments_ ) - comments_ = new CommentInfo[numberOfCommentPlacement]; - comments_[placement].setComment( comment ); -} - - -void -Value::setComment( const std::string &comment, - CommentPlacement placement ) -{ - setComment( comment.c_str(), placement ); -} - - -bool -Value::hasComment( CommentPlacement placement ) const -{ - return comments_ != 0 && comments_[placement].comment_ != 0; -} - -std::string -Value::getComment( CommentPlacement placement ) const -{ - if ( hasComment(placement) ) - return comments_[placement].comment_; - return ""; -} - - -std::string -Value::toStyledString() const -{ - StyledWriter writer; - return writer.write( *this ); -} - - -Value::const_iterator -Value::begin() const -{ - switch ( type_ ) - { -#ifdef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - if ( value_.array_ ) - { - ValueInternalArray::IteratorState it; - value_.array_->makeBeginIterator( it ); - return const_iterator( it ); - } - break; - case objectValue: - if ( value_.map_ ) - { - ValueInternalMap::IteratorState it; - value_.map_->makeBeginIterator( it ); - return const_iterator( it ); - } - break; -#else - case arrayValue: - case objectValue: - if ( value_.map_ ) - return const_iterator( value_.map_->begin() ); - break; -#endif - default: - break; - } - return const_iterator(); -} - -Value::const_iterator -Value::end() const -{ - switch ( type_ ) - { -#ifdef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - if ( value_.array_ ) - { - ValueInternalArray::IteratorState it; - value_.array_->makeEndIterator( it ); - return const_iterator( it ); - } - break; - case objectValue: - if ( value_.map_ ) - { - ValueInternalMap::IteratorState it; - value_.map_->makeEndIterator( it ); - return const_iterator( it ); - } - break; -#else - case arrayValue: - case objectValue: - if ( value_.map_ ) - return const_iterator( value_.map_->end() ); - break; -#endif - default: - break; - } - return const_iterator(); -} - - -Value::iterator -Value::begin() -{ - switch ( type_ ) - { -#ifdef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - if ( value_.array_ ) - { - ValueInternalArray::IteratorState it; - value_.array_->makeBeginIterator( it ); - return iterator( it ); - } - break; - case objectValue: - if ( value_.map_ ) - { - ValueInternalMap::IteratorState it; - value_.map_->makeBeginIterator( it ); - return iterator( it ); - } - break; -#else - case arrayValue: - case objectValue: - if ( value_.map_ ) - return iterator( value_.map_->begin() ); - break; -#endif - default: - break; - } - return iterator(); -} - -Value::iterator -Value::end() -{ - switch ( type_ ) - { -#ifdef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - if ( value_.array_ ) - { - ValueInternalArray::IteratorState it; - value_.array_->makeEndIterator( it ); - return iterator( it ); - } - break; - case objectValue: - if ( value_.map_ ) - { - ValueInternalMap::IteratorState it; - value_.map_->makeEndIterator( it ); - return iterator( it ); - } - break; -#else - case arrayValue: - case objectValue: - if ( value_.map_ ) - return iterator( value_.map_->end() ); - break; -#endif - default: - break; - } - return iterator(); -} - - -// class PathArgument -// ////////////////////////////////////////////////////////////////// - -PathArgument::PathArgument() - : kind_( kindNone ) -{ -} - - -PathArgument::PathArgument( ArrayIndex index ) - : index_( index ) - , kind_( kindIndex ) -{ -} - - -PathArgument::PathArgument( const char *key ) - : key_( key ) - , kind_( kindKey ) -{ -} - - -PathArgument::PathArgument( const std::string &key ) - : key_( key.c_str() ) - , kind_( kindKey ) -{ -} - -// class Path -// ////////////////////////////////////////////////////////////////// - -Path::Path( const std::string &path, - const PathArgument &a1, - const PathArgument &a2, - const PathArgument &a3, - const PathArgument &a4, - const PathArgument &a5 ) -{ - InArgs in; - in.push_back( &a1 ); - in.push_back( &a2 ); - in.push_back( &a3 ); - in.push_back( &a4 ); - in.push_back( &a5 ); - makePath( path, in ); -} - - -void -Path::makePath( const std::string &path, - const InArgs &in ) -{ - const char *current = path.c_str(); - const char *end = current + path.length(); - InArgs::const_iterator itInArg = in.begin(); - while ( current != end ) - { - if ( *current == '[' ) - { - ++current; - if ( *current == '%' ) - addPathInArg( path, in, itInArg, PathArgument::kindIndex ); - else - { - ArrayIndex index = 0; - for ( ; current != end && *current >= '0' && *current <= '9'; ++current ) - index = index * 10 + ArrayIndex(*current - '0'); - args_.push_back( index ); - } - if ( current == end || *current++ != ']' ) - invalidPath( path, int(current - path.c_str()) ); - } - else if ( *current == '%' ) - { - addPathInArg( path, in, itInArg, PathArgument::kindKey ); - ++current; - } - else if ( *current == '.' ) - { - ++current; - } - else - { - const char *beginName = current; - while ( current != end && !strchr( "[.", *current ) ) - ++current; - args_.push_back( std::string( beginName, current ) ); - } - } -} - - -void -Path::addPathInArg( const std::string &path, - const InArgs &in, - InArgs::const_iterator &itInArg, - PathArgument::Kind kind ) -{ - if ( itInArg == in.end() ) - { - // Error: missing argument %d - } - else if ( (*itInArg)->kind_ != kind ) - { - // Error: bad argument type - } - else - { - args_.push_back( **itInArg ); - } -} - - -void -Path::invalidPath( const std::string &path, - int location ) -{ - // Error: invalid path. -} - - -const Value & -Path::resolve( const Value &root ) const -{ - const Value *node = &root; - for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) - { - const PathArgument &arg = *it; - if ( arg.kind_ == PathArgument::kindIndex ) - { - if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) - { - // Error: unable to resolve path (array value expected at position... - } - node = &((*node)[arg.index_]); - } - else if ( arg.kind_ == PathArgument::kindKey ) - { - if ( !node->isObject() ) - { - // Error: unable to resolve path (object value expected at position...) - } - node = &((*node)[arg.key_]); - if ( node == &Value::null ) - { - // Error: unable to resolve path (object has no member named '' at position...) - } - } - } - return *node; -} - - -Value -Path::resolve( const Value &root, - const Value &defaultValue ) const -{ - const Value *node = &root; - for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) - { - const PathArgument &arg = *it; - if ( arg.kind_ == PathArgument::kindIndex ) - { - if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) - return defaultValue; - node = &((*node)[arg.index_]); - } - else if ( arg.kind_ == PathArgument::kindKey ) - { - if ( !node->isObject() ) - return defaultValue; - node = &((*node)[arg.key_]); - if ( node == &Value::null ) - return defaultValue; - } - } - return *node; -} - - -Value & -Path::make( Value &root ) const -{ - Value *node = &root; - for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) - { - const PathArgument &arg = *it; - if ( arg.kind_ == PathArgument::kindIndex ) - { - if ( !node->isArray() ) - { - // Error: node is not an array at position ... - } - node = &((*node)[arg.index_]); - } - else if ( arg.kind_ == PathArgument::kindKey ) - { - if ( !node->isObject() ) - { - // Error: node is not an object at position... - } - node = &((*node)[arg.key_]); - } - } - return *node; -} - - -} // namespace Json - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_value.cpp -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_writer.cpp -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#if !defined(JSON_IS_AMALGAMATION) -# include -# include "json_tool.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#include -#include -#include -#include - -#if _MSC_VER >= 1400 // VC++ 8.0 -#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. -#endif - -namespace Json { - -static bool containsControlCharacter( const char* str ) -{ - while ( *str ) - { - if ( isControlCharacter( *(str++) ) ) - return true; - } - return false; -} - - -std::string valueToString( LargestInt value ) -{ - UIntToStringBuffer buffer; - char *current = buffer + sizeof(buffer); - bool isNegative = value < 0; - if ( isNegative ) - value = -value; - uintToString( LargestUInt(value), current ); - if ( isNegative ) - *--current = '-'; - assert( current >= buffer ); - return current; -} - - -std::string valueToString( LargestUInt value ) -{ - UIntToStringBuffer buffer; - char *current = buffer + sizeof(buffer); - uintToString( value, current ); - assert( current >= buffer ); - return current; -} - -#if defined(JSON_HAS_INT64) - -std::string valueToString( Int value ) -{ - return valueToString( LargestInt(value) ); -} - - -std::string valueToString( UInt value ) -{ - return valueToString( LargestUInt(value) ); -} - -#endif // # if defined(JSON_HAS_INT64) - - -std::string valueToString( double value ) -{ - char buffer[32]; -#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning. - sprintf_s(buffer, sizeof(buffer), "%#.16g", value); -#else - sprintf(buffer, "%#.16g", value); -#endif - char* ch = buffer + strlen(buffer) - 1; - if (*ch != '0') return buffer; // nothing to truncate, so save time - while(ch > buffer && *ch == '0'){ - --ch; - } - char* last_nonzero = ch; - while(ch >= buffer){ - switch(*ch){ - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - --ch; - continue; - case '.': - // Truncate zeroes to save bytes in output, but keep one. - *(last_nonzero+2) = '\0'; - return buffer; - default: - return buffer; - } - } - return buffer; -} - - -std::string valueToString( bool value ) -{ - return value ? "true" : "false"; -} - -std::string valueToQuotedString( const char *value ) -{ - // Not sure how to handle unicode... - if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value )) - return std::string("\"") + value + "\""; - // We have to walk value and escape any special characters. - // Appending to std::string is not efficient, but this should be rare. - // (Note: forward slashes are *not* rare, but I am not escaping them.) - std::string::size_type maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL - std::string result; - result.reserve(maxsize); // to avoid lots of mallocs - result += "\""; - for (const char* c=value; *c != 0; ++c) - { - switch(*c) - { - case '\"': - result += "\\\""; - break; - case '\\': - result += "\\\\"; - break; - case '\b': - result += "\\b"; - break; - case '\f': - result += "\\f"; - break; - case '\n': - result += "\\n"; - break; - case '\r': - result += "\\r"; - break; - case '\t': - result += "\\t"; - break; - //case '/': - // Even though \/ is considered a legal escape in JSON, a bare - // slash is also legal, so I see no reason to escape it. - // (I hope I am not misunderstanding something. - // blep notes: actually escaping \/ may be useful in javascript to avoid (*c); - result += oss.str(); - } - else - { - result += *c; - } - break; - } - } - result += "\""; - return result; -} - -// Class Writer -// ////////////////////////////////////////////////////////////////// -Writer::~Writer() -{ -} - - -// Class FastWriter -// ////////////////////////////////////////////////////////////////// - -FastWriter::FastWriter() - : yamlCompatiblityEnabled_( false ) -{ -} - - -void -FastWriter::enableYAMLCompatibility() -{ - yamlCompatiblityEnabled_ = true; -} - - -std::string -FastWriter::write( const Value &root ) -{ - document_ = ""; - writeValue( root ); - document_ += "\n"; - return document_; -} - - -void -FastWriter::writeValue( const Value &value ) -{ - switch ( value.type() ) - { - case nullValue: - document_ += "null"; - break; - case intValue: - document_ += valueToString( value.asLargestInt() ); - break; - case uintValue: - document_ += valueToString( value.asLargestUInt() ); - break; - case realValue: - document_ += valueToString( value.asDouble() ); - break; - case stringValue: - document_ += valueToQuotedString( value.asCString() ); - break; - case booleanValue: - document_ += valueToString( value.asBool() ); - break; - case arrayValue: - { - document_ += "["; - int size = value.size(); - for ( int index =0; index < size; ++index ) - { - if ( index > 0 ) - document_ += ","; - writeValue( value[index] ); - } - document_ += "]"; - } - break; - case objectValue: - { - Value::Members members( value.getMemberNames() ); - document_ += "{"; - for ( Value::Members::iterator it = members.begin(); - it != members.end(); - ++it ) - { - const std::string &name = *it; - if ( it != members.begin() ) - document_ += ","; - document_ += valueToQuotedString( name.c_str() ); - document_ += yamlCompatiblityEnabled_ ? ": " - : ":"; - writeValue( value[name] ); - } - document_ += "}"; - } - break; - } -} - - -// Class StyledWriter -// ////////////////////////////////////////////////////////////////// - -StyledWriter::StyledWriter() - : rightMargin_( 74 ) - , indentSize_( 3 ) -{ -} - - -std::string -StyledWriter::write( const Value &root ) -{ - document_ = ""; - addChildValues_ = false; - indentString_ = ""; - writeCommentBeforeValue( root ); - writeValue( root ); - writeCommentAfterValueOnSameLine( root ); - document_ += "\n"; - return document_; -} - - -void -StyledWriter::writeValue( const Value &value ) -{ - switch ( value.type() ) - { - case nullValue: - pushValue( "null" ); - break; - case intValue: - pushValue( valueToString( value.asLargestInt() ) ); - break; - case uintValue: - pushValue( valueToString( value.asLargestUInt() ) ); - break; - case realValue: - pushValue( valueToString( value.asDouble() ) ); - break; - case stringValue: - pushValue( valueToQuotedString( value.asCString() ) ); - break; - case booleanValue: - pushValue( valueToString( value.asBool() ) ); - break; - case arrayValue: - writeArrayValue( value); - break; - case objectValue: - { - Value::Members members( value.getMemberNames() ); - if ( members.empty() ) - pushValue( "{}" ); - else - { - writeWithIndent( "{" ); - indent(); - Value::Members::iterator it = members.begin(); - for (;;) - { - const std::string &name = *it; - const Value &childValue = value[name]; - writeCommentBeforeValue( childValue ); - writeWithIndent( valueToQuotedString( name.c_str() ) ); - document_ += " : "; - writeValue( childValue ); - if ( ++it == members.end() ) - { - writeCommentAfterValueOnSameLine( childValue ); - break; - } - document_ += ","; - writeCommentAfterValueOnSameLine( childValue ); - } - unindent(); - writeWithIndent( "}" ); - } - } - break; - } -} - - -void -StyledWriter::writeArrayValue( const Value &value ) -{ - unsigned size = value.size(); - if ( size == 0 ) - pushValue( "[]" ); - else - { - bool isArrayMultiLine = isMultineArray( value ); - if ( isArrayMultiLine ) - { - writeWithIndent( "[" ); - indent(); - bool hasChildValue = !childValues_.empty(); - unsigned index =0; - for (;;) - { - const Value &childValue = value[index]; - writeCommentBeforeValue( childValue ); - if ( hasChildValue ) - writeWithIndent( childValues_[index] ); - else - { - writeIndent(); - writeValue( childValue ); - } - if ( ++index == size ) - { - writeCommentAfterValueOnSameLine( childValue ); - break; - } - document_ += ","; - writeCommentAfterValueOnSameLine( childValue ); - } - unindent(); - writeWithIndent( "]" ); - } - else // output on a single line - { - assert( childValues_.size() == size ); - document_ += "[ "; - for ( unsigned index =0; index < size; ++index ) - { - if ( index > 0 ) - document_ += ", "; - document_ += childValues_[index]; - } - document_ += " ]"; - } - } -} - - -bool -StyledWriter::isMultineArray( const Value &value ) -{ - int size = value.size(); - bool isMultiLine = size*3 >= rightMargin_ ; - childValues_.clear(); - for ( int index =0; index < size && !isMultiLine; ++index ) - { - const Value &childValue = value[index]; - isMultiLine = isMultiLine || - ( (childValue.isArray() || childValue.isObject()) && - childValue.size() > 0 ); - } - if ( !isMultiLine ) // check if line length > max line length - { - childValues_.reserve( size ); - addChildValues_ = true; - int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' - for ( int index =0; index < size && !isMultiLine; ++index ) - { - writeValue( value[index] ); - lineLength += int( childValues_[index].length() ); - isMultiLine = isMultiLine && hasCommentForValue( value[index] ); - } - addChildValues_ = false; - isMultiLine = isMultiLine || lineLength >= rightMargin_; - } - return isMultiLine; -} - - -void -StyledWriter::pushValue( const std::string &value ) -{ - if ( addChildValues_ ) - childValues_.push_back( value ); - else - document_ += value; -} - - -void -StyledWriter::writeIndent() -{ - if ( !document_.empty() ) - { - char last = document_[document_.length()-1]; - if ( last == ' ' ) // already indented - return; - if ( last != '\n' ) // Comments may add new-line - document_ += '\n'; - } - document_ += indentString_; -} - - -void -StyledWriter::writeWithIndent( const std::string &value ) -{ - writeIndent(); - document_ += value; -} - - -void -StyledWriter::indent() -{ - indentString_ += std::string( indentSize_, ' ' ); -} - - -void -StyledWriter::unindent() -{ - assert( int(indentString_.size()) >= indentSize_ ); - indentString_.resize( indentString_.size() - indentSize_ ); -} - - -void -StyledWriter::writeCommentBeforeValue( const Value &root ) -{ - if ( !root.hasComment( commentBefore ) ) - return; - document_ += normalizeEOL( root.getComment( commentBefore ) ); - document_ += "\n"; -} - - -void -StyledWriter::writeCommentAfterValueOnSameLine( const Value &root ) -{ - if ( root.hasComment( commentAfterOnSameLine ) ) - document_ += " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); - - if ( root.hasComment( commentAfter ) ) - { - document_ += "\n"; - document_ += normalizeEOL( root.getComment( commentAfter ) ); - document_ += "\n"; - } -} - - -bool -StyledWriter::hasCommentForValue( const Value &value ) -{ - return value.hasComment( commentBefore ) - || value.hasComment( commentAfterOnSameLine ) - || value.hasComment( commentAfter ); -} - - -std::string -StyledWriter::normalizeEOL( const std::string &text ) -{ - std::string normalized; - normalized.reserve( text.length() ); - const char *begin = text.c_str(); - const char *end = begin + text.length(); - const char *current = begin; - while ( current != end ) - { - char c = *current++; - if ( c == '\r' ) // mac or dos EOL - { - if ( *current == '\n' ) // convert dos EOL - ++current; - normalized += '\n'; - } - else // handle unix EOL & other char - normalized += c; - } - return normalized; -} - - -// Class StyledStreamWriter -// ////////////////////////////////////////////////////////////////// - -StyledStreamWriter::StyledStreamWriter( std::string indentation ) - : document_(NULL) - , rightMargin_( 74 ) - , indentation_( indentation ) -{ -} - - -void -StyledStreamWriter::write( std::ostream &out, const Value &root ) -{ - document_ = &out; - addChildValues_ = false; - indentString_ = ""; - writeCommentBeforeValue( root ); - writeValue( root ); - writeCommentAfterValueOnSameLine( root ); - *document_ << "\n"; - document_ = NULL; // Forget the stream, for safety. -} - - -void -StyledStreamWriter::writeValue( const Value &value ) -{ - switch ( value.type() ) - { - case nullValue: - pushValue( "null" ); - break; - case intValue: - pushValue( valueToString( value.asLargestInt() ) ); - break; - case uintValue: - pushValue( valueToString( value.asLargestUInt() ) ); - break; - case realValue: - pushValue( valueToString( value.asDouble() ) ); - break; - case stringValue: - pushValue( valueToQuotedString( value.asCString() ) ); - break; - case booleanValue: - pushValue( valueToString( value.asBool() ) ); - break; - case arrayValue: - writeArrayValue( value); - break; - case objectValue: - { - Value::Members members( value.getMemberNames() ); - if ( members.empty() ) - pushValue( "{}" ); - else - { - writeWithIndent( "{" ); - indent(); - Value::Members::iterator it = members.begin(); - for (;;) - { - const std::string &name = *it; - const Value &childValue = value[name]; - writeCommentBeforeValue( childValue ); - writeWithIndent( valueToQuotedString( name.c_str() ) ); - *document_ << " : "; - writeValue( childValue ); - if ( ++it == members.end() ) - { - writeCommentAfterValueOnSameLine( childValue ); - break; - } - *document_ << ","; - writeCommentAfterValueOnSameLine( childValue ); - } - unindent(); - writeWithIndent( "}" ); - } - } - break; - } -} - - -void -StyledStreamWriter::writeArrayValue( const Value &value ) -{ - unsigned size = value.size(); - if ( size == 0 ) - pushValue( "[]" ); - else - { - bool isArrayMultiLine = isMultineArray( value ); - if ( isArrayMultiLine ) - { - writeWithIndent( "[" ); - indent(); - bool hasChildValue = !childValues_.empty(); - unsigned index =0; - for (;;) - { - const Value &childValue = value[index]; - writeCommentBeforeValue( childValue ); - if ( hasChildValue ) - writeWithIndent( childValues_[index] ); - else - { - writeIndent(); - writeValue( childValue ); - } - if ( ++index == size ) - { - writeCommentAfterValueOnSameLine( childValue ); - break; - } - *document_ << ","; - writeCommentAfterValueOnSameLine( childValue ); - } - unindent(); - writeWithIndent( "]" ); - } - else // output on a single line - { - assert( childValues_.size() == size ); - *document_ << "[ "; - for ( unsigned index =0; index < size; ++index ) - { - if ( index > 0 ) - *document_ << ", "; - *document_ << childValues_[index]; - } - *document_ << " ]"; - } - } -} - - -bool -StyledStreamWriter::isMultineArray( const Value &value ) -{ - int size = value.size(); - bool isMultiLine = size*3 >= rightMargin_ ; - childValues_.clear(); - for ( int index =0; index < size && !isMultiLine; ++index ) - { - const Value &childValue = value[index]; - isMultiLine = isMultiLine || - ( (childValue.isArray() || childValue.isObject()) && - childValue.size() > 0 ); - } - if ( !isMultiLine ) // check if line length > max line length - { - childValues_.reserve( size ); - addChildValues_ = true; - int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' - for ( int index =0; index < size && !isMultiLine; ++index ) - { - writeValue( value[index] ); - lineLength += int( childValues_[index].length() ); - isMultiLine = isMultiLine && hasCommentForValue( value[index] ); - } - addChildValues_ = false; - isMultiLine = isMultiLine || lineLength >= rightMargin_; - } - return isMultiLine; -} - - -void -StyledStreamWriter::pushValue( const std::string &value ) -{ - if ( addChildValues_ ) - childValues_.push_back( value ); - else - *document_ << value; -} - - -void -StyledStreamWriter::writeIndent() -{ - /* - Some comments in this method would have been nice. ;-) - - if ( !document_.empty() ) - { - char last = document_[document_.length()-1]; - if ( last == ' ' ) // already indented - return; - if ( last != '\n' ) // Comments may add new-line - *document_ << '\n'; - } - */ - *document_ << '\n' << indentString_; -} - - -void -StyledStreamWriter::writeWithIndent( const std::string &value ) -{ - writeIndent(); - *document_ << value; -} - - -void -StyledStreamWriter::indent() -{ - indentString_ += indentation_; -} - - -void -StyledStreamWriter::unindent() -{ - assert( indentString_.size() >= indentation_.size() ); - indentString_.resize( indentString_.size() - indentation_.size() ); -} - - -void -StyledStreamWriter::writeCommentBeforeValue( const Value &root ) -{ - if ( !root.hasComment( commentBefore ) ) - return; - *document_ << normalizeEOL( root.getComment( commentBefore ) ); - *document_ << "\n"; -} - - -void -StyledStreamWriter::writeCommentAfterValueOnSameLine( const Value &root ) -{ - if ( root.hasComment( commentAfterOnSameLine ) ) - *document_ << " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); - - if ( root.hasComment( commentAfter ) ) - { - *document_ << "\n"; - *document_ << normalizeEOL( root.getComment( commentAfter ) ); - *document_ << "\n"; - } -} - - -bool -StyledStreamWriter::hasCommentForValue( const Value &value ) -{ - return value.hasComment( commentBefore ) - || value.hasComment( commentAfterOnSameLine ) - || value.hasComment( commentAfter ); -} - - -std::string -StyledStreamWriter::normalizeEOL( const std::string &text ) -{ - std::string normalized; - normalized.reserve( text.length() ); - const char *begin = text.c_str(); - const char *end = begin + text.length(); - const char *current = begin; - while ( current != end ) - { - char c = *current++; - if ( c == '\r' ) // mac or dos EOL - { - if ( *current == '\n' ) // convert dos EOL - ++current; - normalized += '\n'; - } - else // handle unix EOL & other char - normalized += c; - } - return normalized; -} - - -std::ostream& operator<<( std::ostream &sout, const Value &root ) -{ - Json::StyledStreamWriter writer; - writer.write(sout, root); - return sout; -} - - -} // namespace Json - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_writer.cpp -// ////////////////////////////////////////////////////////////////////// - - - - - diff --git a/src/modifiedJellyfish/lib/mer_dna.cc b/src/modifiedJellyfish/lib/mer_dna.cc deleted file mode 100644 index c8751dd3..00000000 --- a/src/modifiedJellyfish/lib/mer_dna.cc +++ /dev/null @@ -1,23 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - - -#include - -namespace jellyfish { namespace mer_dna_ns { -const char* const error_different_k = "Length of k-mers are different"; -const char* const error_short_string = "Input string is to short"; -} } // namespace jellyfish { namespace mer_dna_ns diff --git a/src/modifiedJellyfish/lib/misc.cc b/src/modifiedJellyfish/lib/misc.cc deleted file mode 100644 index 31e7c8fe..00000000 --- a/src/modifiedJellyfish/lib/misc.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -n the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include -#include -#include - -namespace jellyfish { -uint64_t bogus_sum(void *data, size_t len) { - uint64_t res = 0, tmp = 0; - uint64_t *ptr = (uint64_t *)data; - - while(len >= sizeof(uint64_t)) { - res ^= *ptr++; - len -= sizeof(uint64_t); - } - - if(len > 0) { - memcpy(&tmp, ptr, len); - res ^= tmp; - } - return res; -} - -void disabled_misaligned_mem_access() { -#if defined(__GNUC__) -# if defined(__i386__) - /* Enable Alignment Checking on x86 */ - __asm__("pushf\norl $0x40000,(%esp)\npopf"); -# elif defined(__x86_64__) - /* Enable Alignment Checking on x86_64 */ - __asm__("pushf\norl $0x40000,(%rsp)\npopf"); -# endif -#endif -} - -// Return -1 if size cannot be obtained. -std::streamoff get_file_size(std::istream& is) { - if(!is.good()) return -1; - std::streampos cpos = is.tellg(); - if(!is.good()) { is.clear(); return -1; } - is.seekg(0, std::ios::end); - if(!is.good()) { is.clear(); return -1; } - std::streamoff res = is.tellg() - cpos; - if(!is.good()) { is.clear(); return -1; } - is.seekg(cpos); - return res; -} - -template -struct ConstFloorLog2 { - static const int val = ConstFloorLog2::val + 1; -}; -template<> -struct ConstFloorLog2<1> { - static const int val = 0; -}; -// Return length random bits -uint64_t random_bits(int length) { - uint64_t res = 0; - for(int i = 0; i < length; i += ConstFloorLog2::val) { - res ^= (uint64_t)random() << i; - } - return res & ((uint64_t)-1 >> (bsizeof(uint64_t) - length)); -} - -bool isblunt(char c) { - return isalnum(c) || c == '_' || c == '-' || c == '/' || c == '.'; -} -std::string quote_arg(const std::string& arg) { - if(std::all_of(arg.begin(), arg.end(), isblunt)) - return arg; - - std::string res("'"); - size_t pos = 0; - while(true) { - size_t qpos = arg.find_first_of("'", pos); - res += arg.substr(pos, qpos - pos); - if(qpos == std::string::npos) break; - res += "'\\''"; - pos = qpos + 1; - } - res += "'"; - return res; -} - -} // namespace jellyfish diff --git a/src/modifiedJellyfish/lib/rectangular_binary_matrix.cc b/src/modifiedJellyfish/lib/rectangular_binary_matrix.cc deleted file mode 100644 index 4eedb93f..00000000 --- a/src/modifiedJellyfish/lib/rectangular_binary_matrix.cc +++ /dev/null @@ -1,216 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include -#include -#include -#include - -uint64_t *jellyfish::RectangularBinaryMatrix::alloc(unsigned int r, unsigned int c) { - if(r > (sizeof(uint64_t) * 8) || r == 0 || c == 0) { - std::ostringstream err; - err << "Invalid matrix size " << r << "x" << c; - throw std::out_of_range(err.str()); - } - void *mem; - // Make sure the number of words allocated is a multiple of - // 8. Necessary for loop unrolling of vector multiplication - size_t alloc_columns = (c / 8 + (c % 8 != 0)) * 8; - if(posix_memalign(&mem, sizeof(uint64_t) * 2, alloc_columns * sizeof(uint64_t))) - throw std::bad_alloc(); - memset(mem, '\0', sizeof(uint64_t) * alloc_columns); - return (uint64_t *)mem; -} - -void jellyfish::RectangularBinaryMatrix::init_low_identity() { - memset(_columns, '\0', sizeof(uint64_t) * _c); - unsigned int row = std::min(_c, _r); - unsigned int col = _c - row; - _columns[col] = (uint64_t)1 << (row - 1); - for(unsigned int i = col + 1; i < _c; ++i) - _columns[i] = _columns[i - 1] >> 1; -} - -bool jellyfish::RectangularBinaryMatrix::is_low_identity() { - unsigned int row = std::min(_c, _r); - unsigned int col = _c - row; - - for(unsigned int i = 0; i < col; ++i) - if(_columns[i]) - return false; - if(_columns[col] != (uint64_t)1 << (row - 1)) - return false; - for(unsigned int i = col + 1; i < _c; ++i) - if(_columns[i] != _columns[i - 1] >> 1) - return false; - return true; -} - -jellyfish::RectangularBinaryMatrix jellyfish::RectangularBinaryMatrix::pseudo_multiplication(const jellyfish::RectangularBinaryMatrix &rhs) const { - if(_r != rhs._r || _c != rhs._c) - throw std::domain_error("Matrices of different size"); - RectangularBinaryMatrix res(_r, _c); - - // v is a vector. The lower part is equal to the given column of rhs - // and the high part is the identity matrix. - // uint64_t v[nb_words()]; - uint64_t *v = new uint64_t[nb_words()]; - memset(v, '\0', sizeof(uint64_t) * nb_words()); - unsigned int j = nb_words() - 1; - v[j] = msb(); - const unsigned int row = std::min(_c, _r); - const unsigned int col = _c - row; - - unsigned int i; - for(i = 0; i < col; ++i) { - // Set the lower part to rhs and do vector multiplication - v[0] ^= rhs[i]; - res.get(i) = this->times(&v[0]); - //res.get(i) = this->times_loop(v); - - // Zero the lower part and shift the one down the diagonal. - v[0] ^= rhs[i]; - v[j] >>= 1; - if(!v[j]) - v[--j] = (uint64_t)1 << (sizeof(uint64_t) * 8 - 1); - } - // No more identity part to deal with - memset(v, '\0', sizeof(uint64_t) * nb_words()); - for( ; i < _c; ++i) { - v[0] = rhs[i]; - res.get(i) = this->times(v); - //res.get(i) = this->times_loop(v); - } - - delete[] v; - return res; -} - -unsigned int jellyfish::RectangularBinaryMatrix::pseudo_rank() const { - unsigned int rank = _c; - RectangularBinaryMatrix pivot(*this); - - // Make the matrix lower triangular. - unsigned int srow = std::min(_r, _c); - unsigned int scol = _c - srow; - uint64_t mask = (uint64_t)1 << (srow - 1); - for(unsigned int i = scol; i < _c; ++i, mask >>= 1) { - if(!(pivot.get(i) & mask)) { - // current column has a 0 in the diagonal. XOR it with another - // column to get a 1. - unsigned int j; - for(j = i + 1; j < _c; ++j) - if(pivot.get(j) & mask) - break; - if(j == _c) { - // Did not find one, the matrix is not full rank. - rank = i; - break; - } - pivot.get(i) ^= pivot.get(j); - } - - // Zero out every ones on the ith row in the upper part of the - // matrix. - for(unsigned int j = i + 1; j < _c; ++j) - if(pivot.get(j) & mask) - pivot.get(j) ^= pivot.get(i); - } - - return rank; -} - -jellyfish::RectangularBinaryMatrix jellyfish::RectangularBinaryMatrix::pseudo_inverse() const { - RectangularBinaryMatrix pivot(*this); - RectangularBinaryMatrix res(_r, _c); res.init_low_identity(); - unsigned int i, j; - uint64_t mask; - - // Do gaussian elimination on the columns and apply the same - // operation to res. - - // Make pivot lower triangular. - unsigned int srow = std::min(_r, _c); - unsigned int scol = _c - srow; - mask = (uint64_t)1 << (srow - 1); - for(i = scol; i < _c; ++i, mask >>= 1) { - if(!(pivot.get(i) & mask)) { - // current column has a 0 in the diagonal. XOR it with another - // column to get a 1. - unsigned int j; - for(j = i + 1; j < _c; ++j) - if(pivot.get(j) & mask) - break; - if(j == _c) - throw std::domain_error("Matrix is singular"); - pivot.get(i) ^= pivot.get(j); - res.get(i) ^= res.get(j); - } - // Zero out every ones on the ith row in the upper part of the - // matrix. - for(j = i + 1; j < _c; ++j) { - if(pivot.get(j) & mask) { - pivot.get(j) ^= pivot.get(i); - res.get(j) ^= res.get(i); - } - } - } - - // Make pivot the lower identity - mask = (uint64_t)1 << (srow - 1); - for(i = scol; i < _c; ++i, mask >>= 1) { - for(j = 0; j < i; ++j) { - if(pivot.get(j) & mask) { - pivot.get(j) ^= pivot.get(i); - res.get(j) ^= res.get(i); - } - } - } - - return res; -} - -void jellyfish::RectangularBinaryMatrix::print(std::ostream &os) const { - uint64_t mask = (uint64_t)1 << (_r - 1); - for( ; mask; mask >>= 1) { - for(unsigned int j = 0; j < _c; ++j) { - os << (mask & _columns[j] ? "1" : "0"); - } - os << "\n"; - } -} - -template -void jellyfish::RectangularBinaryMatrix::print_vector(std::ostream &os, const T &v) const { - uint64_t mask = msb(); - for(int i = nb_words() - 1; i >= 0; --i) { - for( ; mask; mask >>= 1) - os << (v[i] & mask ? "1" : "0"); - mask = (uint64_t)1 << (sizeof(uint64_t) * 8 - 1); - } - os << "\n"; -} - -jellyfish::RectangularBinaryMatrix jellyfish::RectangularBinaryMatrix::randomize_pseudo_inverse(uint64_t (*rng)()) { - while(true) { - randomize(rng); - try { - return pseudo_inverse(); - } catch(std::domain_error &e) { } - } -} diff --git a/src/modifiedJellyfish/lib/storage.cc b/src/modifiedJellyfish/lib/storage.cc deleted file mode 100644 index 6c33f77b..00000000 --- a/src/modifiedJellyfish/lib/storage.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include "config.h" -#include - -namespace jellyfish { -const size_t _quadratic_reprobes[257] = { - 1, - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, - 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, - 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, - 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, - 861, 903, 946, 990, 1035, 1081, 1128, 1176, 1225, 1275, - 1326, 1378, 1431, 1485, 1540, 1596, 1653, 1711, 1770, 1830, - 1891, 1953, 2016, 2080, 2145, 2211, 2278, 2346, 2415, 2485, - 2556, 2628, 2701, 2775, 2850, 2926, 3003, 3081, 3160, 3240, - 3321, 3403, 3486, 3570, 3655, 3741, 3828, 3916, 4005, 4095, - 4186, 4278, 4371, 4465, 4560, 4656, 4753, 4851, 4950, 5050, - 5151, 5253, 5356, 5460, 5565, 5671, 5778, 5886, 5995, 6105, - 6216, 6328, 6441, 6555, 6670, 6786, 6903, 7021, 7140, 7260, - 7381, 7503, 7626, 7750, 7875, 8001, 8128, 8256, 8385, 8515, - 8646, 8778, 8911, 9045, 9180, 9316, 9453, 9591, 9730, 9870, - 10011, 10153, 10296, 10440, 10585, 10731, 10878, 11026, 11175, 11325, - 11476, 11628, 11781, 11935, 12090, 12246, 12403, 12561, 12720, 12880, - 13041, 13203, 13366, 13530, 13695, 13861, 14028, 14196, 14365, 14535, - 14706, 14878, 15051, 15225, 15400, 15576, 15753, 15931, 16110, 16290, - 16471, 16653, 16836, 17020, 17205, 17391, 17578, 17766, 17955, 18145, - 18336, 18528, 18721, 18915, 19110, 19306, 19503, 19701, 19900, 20100, - 20301, 20503, 20706, 20910, 21115, 21321, 21528, 21736, 21945, 22155, - 22366, 22578, 22791, 23005, 23220, 23436, 23653, 23871, 24090, 24310, - 24531, 24753, 24976, 25200, 25425, 25651, 25878, 26106, 26335, 26565, - 26796, 27028, 27261, 27495, 27730, 27966, 28203, 28441, 28680, 28920, - 29161, 29403, 29646, 29890, 30135, 30381, 30628, 30876, 31125, 31375, - 31626, 31878, 32131, 32385, 32640, 32896 -}; -const size_t *quadratic_reprobes = _quadratic_reprobes; -} diff --git a/src/modifiedJellyfish/lib/thread_exec.cc b/src/modifiedJellyfish/lib/thread_exec.cc deleted file mode 100644 index 8c6e4de1..00000000 --- a/src/modifiedJellyfish/lib/thread_exec.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include - -void jellyfish::thread_exec::exec(int nb_threads) { - struct thread_info empty = {0, 0, 0}; - infos.resize(nb_threads, empty); - - for(int i = 0; i < nb_threads; i++) { - infos[i].id = i; - infos[i].self = this; - int err = pthread_create(&infos[i].thid, NULL, start_routine, &infos[i]); - if(err) - throw Error(err::msg() << "Can't create thread: " << err::no); - } -} - -void jellyfish::thread_exec::join() { - for(unsigned int i = 0; i < infos.size(); i++) { - int err = pthread_join(infos[i].thid, NULL); - if(err) - throw Error(err::msg() << "Can't join thread '" << infos[i].thid << "': " << err::no); - } -} - -void *jellyfish::thread_exec::start_routine(void *_info) { - struct thread_info *info = (struct thread_info *)_info; - info->self->start(info->id); - return 0; -} diff --git a/src/modifiedJellyfish/lib/time.cc b/src/modifiedJellyfish/lib/time.cc deleted file mode 100644 index fa9f4e9e..00000000 --- a/src/modifiedJellyfish/lib/time.cc +++ /dev/null @@ -1,19 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include - -const Time Time::zero = Time(0, 0); diff --git a/src/modifiedJellyfish/ltmain.sh b/src/modifiedJellyfish/ltmain.sh deleted file mode 100644 index bffda541..00000000 --- a/src/modifiedJellyfish/ltmain.sh +++ /dev/null @@ -1,9661 +0,0 @@ - -# libtool (GNU libtool) 2.4.2 -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool 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 2 of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --no-warn don't display warning messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.11 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . - -PROGRAM=libtool -PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1.11" -TIMESTAMP="" -package_revision=1.3337 - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL - -$lt_unset CDPATH - - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation - - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation - - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=${PATH_SEPARATOR-:} - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $opt_debug - - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $opt_debug - - func_error "missing argument for $1." - exit_cmd=exit -} - - -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' - - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' - - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation - -exit_cmd=: - - - - - -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" - -# Global variables. -nonopt= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "${1}=\$${1}\${2}" -} # func_append may be replaced by extended shell implementation - -# func_append_quoted var value -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -func_append_quoted () -{ - func_quote_for_eval "${2}" - eval "${1}=\$${1}\\ \$func_quote_for_eval_result" -} # func_append_quoted may be replaced by extended shell implementation - - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "${@}"` -} # func_arith may be replaced by extended shell implementation - - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` -} # func_len may be replaced by extended shell implementation - - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} # func_lo2o may be replaced by extended shell implementation - - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} # func_xform may be replaced by extended shell implementation - - -# func_fatal_configuration arg... -# Echo program name prefixed message to standard error, followed by -# a configuration failure hint, and exit. -func_fatal_configuration () -{ - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." -} - - -# func_config -# Display the configuration for all the tags in this script. -func_config () -{ - re_begincf='^# ### BEGIN LIBTOOL' - re_endcf='^# ### END LIBTOOL' - - # Default configuration. - $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" - - # Now print the configurations for the tags. - for tagname in $taglist; do - $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" - done - - exit $? -} - -# func_features -# Display the features supported by this script. -func_features () -{ - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - - exit $? -} - -# func_enable_tag tagname -# Verify that TAGNAME is valid, and either flag an error and exit, or -# enable the TAGNAME tag. We also add TAGNAME to the global $taglist -# variable here. -func_enable_tag () -{ - # Global variable: - tagname="$1" - - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac - - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; - *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac - - - -# Option defaults: -opt_debug=: -opt_dry_run=false -opt_config=false -opt_preserve_dup_deps=false -opt_features=false -opt_finish=false -opt_help=false -opt_help_all=false -opt_silent=: -opt_warning=: -opt_verbose=: -opt_silent=false -opt_verbose=false - - -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - --config) - opt_config=: -func_config - ;; - --dlopen|-dlopen) - optarg="$1" - opt_dlopen="${opt_dlopen+$opt_dlopen -}$optarg" - shift - ;; - --preserve-dup-deps) - opt_preserve_dup_deps=: - ;; - --features) - opt_features=: -func_features - ;; - --finish) - opt_finish=: -set dummy --mode finish ${1+"$@"}; shift - ;; - --help) - opt_help=: - ;; - --help-all) - opt_help_all=: -opt_help=': help-all' - ;; - --mode) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_mode="$optarg" -case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; -esac - shift - ;; - --no-silent|--no-quiet) - opt_silent=false -func_append preserve_args " $opt" - ;; - --no-warning|--no-warn) - opt_warning=false -func_append preserve_args " $opt" - ;; - --no-verbose) - opt_verbose=false -func_append preserve_args " $opt" - ;; - --silent|--quiet) - opt_silent=: -func_append preserve_args " $opt" - opt_verbose=false - ;; - --verbose|-v) - opt_verbose=: -func_append preserve_args " $opt" -opt_silent=false - ;; - --tag) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_tag="$optarg" -func_append preserve_args " $opt $optarg" -func_enable_tag "$optarg" - shift - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-n*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - - # Validate options: - - # save first non-option argument - if test "$#" -gt 0; then - nonopt="$opt" - shift - fi - - # preserve --debug - test "$opt_debug" = : || func_append preserve_args " --debug" - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps - ;; - esac - - $opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test "$opt_mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$opt_mode' for more information." - } - - - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} - - - - -## ----------- ## -## Main. ## -## ----------- ## - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_resolve_sysroot PATH -# Replace a leading = in PATH with a sysroot. Store the result into -# func_resolve_sysroot_result -func_resolve_sysroot () -{ - func_resolve_sysroot_result=$1 - case $func_resolve_sysroot_result in - =*) - func_stripname '=' '' "$func_resolve_sysroot_result" - func_resolve_sysroot_result=$lt_sysroot$func_stripname_result - ;; - esac -} - -# func_replace_sysroot PATH -# If PATH begins with the sysroot, replace it with = and -# store the result into func_replace_sysroot_result. -func_replace_sysroot () -{ - case "$lt_sysroot:$1" in - ?*:"$lt_sysroot"*) - func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result="=$func_stripname_result" - ;; - *) - # Including no sysroot. - func_replace_sysroot_result=$1 - ;; - esac -} - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T </dev/null` - if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then - func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$lt_sed_naive_backslashify"` - else - func_convert_core_file_wine_to_w32_result= - fi - fi -} -# end: func_convert_core_file_wine_to_w32 - - -# func_convert_core_path_wine_to_w32 ARG -# Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. -# -# ARG is path to be converted from $build format to win32. -# Result is available in $func_convert_core_path_wine_to_w32_result. -# Unconvertible file (directory) names in ARG are skipped; if no directory names -# are convertible, then the result may be empty. -func_convert_core_path_wine_to_w32 () -{ - $opt_debug - # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result="" - if test -n "$1"; then - oldIFS=$IFS - IFS=: - for func_convert_core_path_wine_to_w32_f in $1; do - IFS=$oldIFS - func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result" ; then - if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" - else - func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" - fi - fi - done - IFS=$oldIFS - fi -} -# end: func_convert_core_path_wine_to_w32 - - -# func_cygpath ARGS... -# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when -# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) -# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or -# (2), returns the Cygwin file name or path in func_cygpath_result (input -# file name or path is assumed to be in w32 format, as previously converted -# from $build's *nix or MSYS format). In case (3), returns the w32 file name -# or path in func_cygpath_result (input file name or path is assumed to be in -# Cygwin format). Returns an empty string on error. -# -# ARGS are passed to cygpath, with the last one being the file name or path to -# be converted. -# -# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH -# environment variable; do not put it in $PATH. -func_cygpath () -{ - $opt_debug - if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then - func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` - if test "$?" -ne 0; then - # on failure, ensure result is empty - func_cygpath_result= - fi - else - func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" - fi -} -#end: func_cygpath - - -# func_convert_core_msys_to_w32 ARG -# Convert file name or path ARG from MSYS format to w32 format. Return -# result in func_convert_core_msys_to_w32_result. -func_convert_core_msys_to_w32 () -{ - $opt_debug - # awkward: cmd appends spaces to result - func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` -} -#end: func_convert_core_msys_to_w32 - - -# func_convert_file_check ARG1 ARG2 -# Verify that ARG1 (a file name in $build format) was converted to $host -# format in ARG2. Otherwise, emit an error message, but continue (resetting -# func_to_host_file_result to ARG1). -func_convert_file_check () -{ - $opt_debug - if test -z "$2" && test -n "$1" ; then - func_error "Could not determine host file name corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_file_result="$1" - fi -} -# end func_convert_file_check - - -# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH -# Verify that FROM_PATH (a path in $build format) was converted to $host -# format in TO_PATH. Otherwise, emit an error message, but continue, resetting -# func_to_host_file_result to a simplistic fallback value (see below). -func_convert_path_check () -{ - $opt_debug - if test -z "$4" && test -n "$3"; then - func_error "Could not determine the host path corresponding to" - func_error " \`$3'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This is a deliberately simplistic "conversion" and - # should not be "improved". See libtool.info. - if test "x$1" != "x$2"; then - lt_replace_pathsep_chars="s|$1|$2|g" - func_to_host_path_result=`echo "$3" | - $SED -e "$lt_replace_pathsep_chars"` - else - func_to_host_path_result="$3" - fi - fi -} -# end func_convert_path_check - - -# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG -# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT -# and appending REPL if ORIG matches BACKPAT. -func_convert_path_front_back_pathsep () -{ - $opt_debug - case $4 in - $1 ) func_to_host_path_result="$3$func_to_host_path_result" - ;; - esac - case $4 in - $2 ) func_append func_to_host_path_result "$3" - ;; - esac -} -# end func_convert_path_front_back_pathsep - - -################################################## -# $build to $host FILE NAME CONVERSION FUNCTIONS # -################################################## -# invoked via `$to_host_file_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# Result will be available in $func_to_host_file_result. - - -# func_to_host_file ARG -# Converts the file name ARG from $build format to $host format. Return result -# in func_to_host_file_result. -func_to_host_file () -{ - $opt_debug - $to_host_file_cmd "$1" -} -# end func_to_host_file - - -# func_to_tool_file ARG LAZY -# converts the file name ARG from $build format to toolchain format. Return -# result in func_to_tool_file_result. If the conversion in use is listed -# in (the comma separated) LAZY, no conversion takes place. -func_to_tool_file () -{ - $opt_debug - case ,$2, in - *,"$to_tool_file_cmd",*) - func_to_tool_file_result=$1 - ;; - *) - $to_tool_file_cmd "$1" - func_to_tool_file_result=$func_to_host_file_result - ;; - esac -} -# end func_to_tool_file - - -# func_convert_file_noop ARG -# Copy ARG to func_to_host_file_result. -func_convert_file_noop () -{ - func_to_host_file_result="$1" -} -# end func_convert_file_noop - - -# func_convert_file_msys_to_w32 ARG -# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_file_result. -func_convert_file_msys_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_to_host_file_result="$func_convert_core_msys_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_w32 - - -# func_convert_file_cygwin_to_w32 ARG -# Convert file name ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_file_cygwin_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # because $build is cygwin, we call "the" cygpath in $PATH; no need to use - # LT_CYGPATH in this case. - func_to_host_file_result=`cygpath -m "$1"` - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_cygwin_to_w32 - - -# func_convert_file_nix_to_w32 ARG -# Convert file name ARG from *nix to w32 format. Requires a wine environment -# and a working winepath. Returns result in func_to_host_file_result. -func_convert_file_nix_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_w32 - - -# func_convert_file_msys_to_cygwin ARG -# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_file_msys_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_cygwin - - -# func_convert_file_nix_to_cygwin ARG -# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed -# in a wine environment, working winepath, and LT_CYGPATH set. Returns result -# in func_to_host_file_result. -func_convert_file_nix_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. - func_convert_core_file_wine_to_w32 "$1" - func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_cygwin - - -############################################# -# $build to $host PATH CONVERSION FUNCTIONS # -############################################# -# invoked via `$to_host_path_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# The result will be available in $func_to_host_path_result. -# -# Path separators are also converted from $build format to $host format. If -# ARG begins or ends with a path separator character, it is preserved (but -# converted to $host format) on output. -# -# All path conversion functions are named using the following convention: -# file name conversion function : func_convert_file_X_to_Y () -# path conversion function : func_convert_path_X_to_Y () -# where, for any given $build/$host combination the 'X_to_Y' value is the -# same. If conversion functions are added for new $build/$host combinations, -# the two new functions must follow this pattern, or func_init_to_host_path_cmd -# will break. - - -# func_init_to_host_path_cmd -# Ensures that function "pointer" variable $to_host_path_cmd is set to the -# appropriate value, based on the value of $to_host_file_cmd. -to_host_path_cmd= -func_init_to_host_path_cmd () -{ - $opt_debug - if test -z "$to_host_path_cmd"; then - func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd="func_convert_path_${func_stripname_result}" - fi -} - - -# func_to_host_path ARG -# Converts the path ARG from $build format to $host format. Return result -# in func_to_host_path_result. -func_to_host_path () -{ - $opt_debug - func_init_to_host_path_cmd - $to_host_path_cmd "$1" -} -# end func_to_host_path - - -# func_convert_path_noop ARG -# Copy ARG to func_to_host_path_result. -func_convert_path_noop () -{ - func_to_host_path_result="$1" -} -# end func_convert_path_noop - - -# func_convert_path_msys_to_w32 ARG -# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_path_result. -func_convert_path_msys_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from ARG. MSYS - # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; - # and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_msys_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_msys_to_w32 - - -# func_convert_path_cygwin_to_w32 ARG -# Convert path ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_path_cygwin_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_cygwin_to_w32 - - -# func_convert_path_nix_to_w32 ARG -# Convert path ARG from *nix to w32 format. Requires a wine environment and -# a working winepath. Returns result in func_to_host_file_result. -func_convert_path_nix_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_nix_to_w32 - - -# func_convert_path_msys_to_cygwin ARG -# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_path_msys_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_msys_to_cygwin - - -# func_convert_path_nix_to_cygwin ARG -# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a -# a wine environment, working winepath, and LT_CYGPATH set. Returns result in -# func_to_host_file_result. -func_convert_path_nix_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_nix_to_cygwin - - -# func_mode_compile arg... -func_mode_compile () -{ - $opt_debug - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - pie_flag= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - test -n "$libobj" && \ - func_fatal_error "you cannot specify \`-o' more than once" - arg_mode=target - continue - ;; - - -pie | -fpie | -fPIE) - func_append pie_flag " $arg" - continue - ;; - - -shared | -static | -prefer-pic | -prefer-non-pic) - func_append later " $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - func_append_quoted lastarg "$arg" - done - IFS="$save_ifs" - func_stripname ' ' '' "$lastarg" - lastarg=$func_stripname_result - - # Add the arguments to base_compile. - func_append base_compile " $lastarg" - continue - ;; - - *) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - func_append_quoted base_compile "$lastarg" - done # for arg - - case $arg_mode in - arg) - func_fatal_error "you must specify an argument for -Xcompile" - ;; - target) - func_fatal_error "you must specify a target with \`-o'" - ;; - *) - # Get the name of the library object. - test -z "$libobj" && { - func_basename "$srcfile" - libobj="$func_basename_result" - } - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - case $libobj in - *.[cCFSifmso] | \ - *.ada | *.adb | *.ads | *.asm | \ - *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) - func_xform "$libobj" - libobj=$func_xform_result - ;; - esac - - case $libobj in - *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; - *) - func_fatal_error "cannot determine name of library object from \`$libobj'" - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - continue - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - func_quote_for_eval "$libobj" - test "X$libobj" != "X$func_quote_for_eval_result" \ - && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - func_append removelist " $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - func_append removelist " $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 - srcfile=$func_to_tool_file_result - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - func_append command " -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - func_append command " -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - func_append command "$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { - test "$opt_mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $opt_mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to build PIC objects only - -prefer-non-pic try to build non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$opt_mode'" - ;; - esac - - echo - $ECHO "Try \`$progname --help' for more information about other modes." -} - -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $opt_dlopen; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - func_append dir "/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -* | *.la | *.lo ) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_append_quoted args "$file" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libs= - libdirs= - admincmds= - - for opt in "$nonopt" ${1+"$@"} - do - if test -d "$opt"; then - func_append libdirs " $opt" - - elif test -f "$opt"; then - if func_lalib_unsafe_p "$opt"; then - func_append libs " $opt" - else - func_warning "\`$opt' is not a valid libtool archive" - fi - - else - func_fatal_error "invalid argument \`$opt'" - fi - done - - if test -n "$libs"; then - if test -n "$lt_sysroot"; then - sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` - sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" - else - sysroot_cmd= - fi - - # Remove sysroot references - if $opt_dry_run; then - for lib in $libs; do - echo "removing references to $lt_sysroot and \`=' prefixes from $lib" - done - else - tmpdir=`func_mktempdir` - for lib in $libs; do - sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ - > $tmpdir/tmp-la - mv -f $tmpdir/tmp-la $lib - done - ${RM}r "$tmpdir" - fi - fi - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || func_append admincmds " - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - - echo "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" - fi - exit $EXIT_SUCCESS -} - -test "$opt_mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - func_append install_prog "$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - no_mode=: - for arg - do - arg2= - if test -n "$dest"; then - func_append files " $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - if $install_cp; then :; else - prev=$arg - fi - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - func_append install_prog " $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - func_append install_shared_prog " $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - func_append install_shared_prog " -m $func_quote_for_eval_result" - fi - fi - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - func_append staticlibs " $file" - ;; - - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) func_append current_libdirs " $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) func_append future_libdirs " $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - func_append dir "$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && func_append staticlibs " $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 - tool_oldlib=$func_to_tool_file_result - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $tool_oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" - $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - case $host in - *cygwin* | *mingw* | *cegcc* ) - # if an import library, we need to obtain dlname - if func_win32_import_lib_p "$dlprefile"; then - func_tr_sh "$dlprefile" - eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename="" - if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then - # Use subshell, to avoid clobbering current variable values - dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname" ; then - func_basename "$dlprefile_dlname" - dlprefile_dlbasename="$func_basename_result" - else - # no lafile. user explicitly requested -dlpreopen . - $sharedlib_from_linklib_cmd "$dlprefile" - dlprefile_dlbasename=$sharedlib_from_linklib_result - fi - fi - $opt_dry_run || { - if test -n "$dlprefile_dlbasename" ; then - eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' - else - func_warning "Could not compute DLL name from $name" - eval '$ECHO ": $name " >> "$nlist"' - fi - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | - $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" - } - else # not an import lib - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - fi - ;; - *) - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - ;; - esac - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - echo >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -extern LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - echo >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) func_append symtab_cflags " $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -# Despite the name, also deal with 64 bit binaries. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - -# func_cygming_dll_for_implib ARG -# -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib () -{ - $opt_debug - sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` -} - -# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs -# -# The is the core of a fallback implementation of a -# platform-specific function to extract the name of the -# DLL associated with the specified import library LIBNAME. -# -# SECTION_NAME is either .idata$6 or .idata$7, depending -# on the platform and compiler that created the implib. -# -# Echos the name of the DLL associated with the -# specified import library. -func_cygming_dll_for_implib_fallback_core () -{ - $opt_debug - match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` - $OBJDUMP -s --section "$1" "$2" 2>/dev/null | - $SED '/^Contents of section '"$match_literal"':/{ - # Place marker at beginning of archive member dllname section - s/.*/====MARK====/ - p - d - } - # These lines can sometimes be longer than 43 characters, but - # are always uninteresting - /:[ ]*file format pe[i]\{,1\}-/d - /^In archive [^:]*:/d - # Ensure marker is printed - /^====MARK====/p - # Remove all lines with less than 43 characters - /^.\{43\}/!d - # From remaining lines, remove first 43 characters - s/^.\{43\}//' | - $SED -n ' - # Join marker and all lines until next marker into a single line - /^====MARK====/ b para - H - $ b para - b - :para - x - s/\n//g - # Remove the marker - s/^====MARK====// - # Remove trailing dots and whitespace - s/[\. \t]*$// - # Print - /./p' | - # we now have a list, one entry per line, of the stringified - # contents of the appropriate section of all members of the - # archive which possess that section. Heuristic: eliminate - # all those which have a first or second character that is - # a '.' (that is, objdump's representation of an unprintable - # character.) This should work for all archives with less than - # 0x302f exports -- but will fail for DLLs whose name actually - # begins with a literal '.' or a single character followed by - # a '.'. - # - # Of those that remain, print the first one. - $SED -e '/^\./d;/^.\./d;q' -} - -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - -# func_cygming_dll_for_implib_fallback ARG -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# -# This fallback implementation is for use when $DLLTOOL -# does not support the --identify-strict option. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib_fallback () -{ - $opt_debug - if func_cygming_gnu_implib_p "$1" ; then - # binutils import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1" ; then - # ms-generated import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` - else - # unknown - sharedlib_from_linklib_result="" - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=${1-no} - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's $0 value, followed by "$@". -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=\$0 - shift - for lt_opt - do - case \"\$lt_opt\" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` - test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. - lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` - cat \"\$lt_dump_D/\$lt_dump_F\" - exit 0 - ;; - --lt-*) - \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" - lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from \$@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - case \" \$* \" in - *\\ --lt-*) - for lt_wr_arg - do - case \$lt_wr_arg in - --lt-*) ;; - *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; - esac - shift - done ;; - esac - func_exec_program_core \${1+\"\$@\"} -} - - # Parse options - func_parse_lt_options \"\$0\" \${1+\"\$@\"} - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # fixup the dll searchpath if we need to. - # - # Fix the DLL searchpath if we need to. Do this before prepending - # to shlibpath, because on Windows, both are PATH and uninstalled - # libraries must come first. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` - - export $shlibpath_var -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - func_exec_program \${1+\"\$@\"} - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} - - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -#else -# include -# include -# ifdef __CYGWIN__ -# include -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -/* path handling portability macros */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#if defined(LT_DEBUGWRAPPER) -static int lt_debug = 1; -#else -static int lt_debug = 0; -#endif - -const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_debugprintf (const char *file, int line, const char *fmt, ...); -void lt_fatal (const char *file, int line, const char *message, ...); -static const char *nonnull (const char *s); -static const char *nonempty (const char *s); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); -EOF - - cat <= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", - nonempty (path)); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", - nonempty (wrapper)); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - lt_debugprintf (__FILE__, __LINE__, - "checking path component for symlinks: %s\n", - tmp_pathspec); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - lt_fatal (__FILE__, __LINE__, - "error accessing file \"%s\": %s", - tmp_pathspec, nonnull (strerror (errno))); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal (__FILE__, __LINE__, - "could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -void -lt_debugprintf (const char *file, int line, const char *fmt, ...) -{ - va_list args; - if (lt_debug) - { - (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); - } -} - -static void -lt_error_core (int exit_status, const char *file, - int line, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *file, int line, const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); - va_end (ap); -} - -static const char * -nonnull (const char *s) -{ - return s ? s : "(null)"; -} - -static const char * -nonempty (const char *s) -{ - return (s && !*s) ? "(empty)" : nonnull (s); -} - -void -lt_setenv (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_setenv) setting '%s' to '%s'\n", - nonnull (name), nonnull (value)); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -n -e ' -s/^\(.\{79\}\)\(..*\)/\1\ -\2/ -h -s/\([\\"]\)/\\\1/g -s/$/\\n/ -s/\([^\n]*\).*/ fputs ("\1", f);/p -g -D' - cat <<"EOF" -} -EOF -} -# end: func_emit_cwrapperexe_src - -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - bindir= - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append finalize_command " @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - func_append dlfiles " $arg" - else - func_append dlprefiles " $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) func_append deplibs " $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# func_append moreargs " $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) func_append rpath " $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) func_append xrpath " $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - func_append weak_libs " $arg" - prev= - continue - ;; - xcclinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -bindir) - prev=bindir - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname "-L" '' "$arg" - if test -z "$func_stripname_result"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "* | *" $arg "*) - # Will only happen for absolute or sysroot arguments - ;; - *) - # Preserve sysroot, but never include relative directories - case $dir in - [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; - *) func_append deplibs " -L$dir" ;; - esac - func_append lib_search_path " $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) func_append dllsearchpath ":$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - func_append deplibs " System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - func_append deplibs " $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot|--sysroot) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - =*) - func_stripname '=' '' "$dir" - dir=$lt_sysroot$func_stripname_result - ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $func_quote_for_eval_result" - func_append compiler_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $wl$func_quote_for_eval_result" - func_append compiler_flags " $wl$func_quote_for_eval_result" - func_append linker_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # Flags to be passed through unchanged, with rationale: - # -64, -mips[0-9] enable 64-bit mode for the SGI compiler - # -r[0-9][0-9]* specify processor for the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler - # +DA*, +DD* enable 64-bit mode for the HP compiler - # -q* compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* architecture-specific flags for GCC - # -F/path path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - # --sysroot=* for sysroot support - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-flto*|-fwhopr*|-fuse-linker-plugin) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - func_append compiler_flags " $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - func_append objs " $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - func_append deplibs " $arg" - func_append old_deplibs " $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - func_resolve_sysroot "$arg" - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - func_append dlfiles " $func_resolve_sysroot_result" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - func_append dlprefiles " $func_resolve_sysroot_result" - prev= - else - func_append deplibs " $func_resolve_sysroot_result" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - func_to_tool_file "$output_objdir/" - tool_output_objdir=$func_to_tool_file_result - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_preserve_dup_deps ; then - case "$libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append libs " $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; - esac - func_append pre_post_deps " $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) - libs="$deplibs %DEPLIBS%" - test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" - ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - func_resolve_sysroot "$lib" - case $lib in - *.la) func_source "$func_resolve_sysroot_result" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result - case " $weak_libs " in - *" $deplib_base "*) ;; - *) func_append deplibs " $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append compiler_flags " $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) - func_resolve_sysroot "$deplib" - lib=$func_resolve_sysroot_result - ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - echo - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - func_append newdlprefiles " $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append newdlfiles " $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && func_append dlfiles " $dlopen" - test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - if test -n "$old_library" && - { test "$prefer_static_libs" = yes || - test "$prefer_static_libs,$installed" = "built,no"; }; then - linklib=$old_library - else - for l in $old_library $library_names; do - linklib="$l" - done - fi - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - func_append dlprefiles " $lib $dependency_libs" - else - func_append newdlfiles " $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$lt_sysroot$libdir" - absdir="$lt_sysroot$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - case "$host" in - # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) - # Linker will automatically link against shared library if both - # static and shared are present. Therefore, ensure we extract - # symbols from the import library if a shared library is present - # (otherwise, the dlopen module name will be incorrect). We do - # this by putting the import library name into $newdlprefiles. - # We recover the dlopen module name by 'saving' the la file - # name in a special purpose variable, and (later) extracting the - # dlname from the la file. - if test -n "$dlname"; then - func_tr_sh "$dir/$linklib" - eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" - func_append newdlprefiles " $dir/$linklib" - else - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - fi - ;; - * ) - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - func_append newdlprefiles " $dir/$dlname" - else - func_append newdlprefiles " $dir/$linklib" - fi - ;; - esac - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - func_append newlib_search_path " $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) func_append temp_rpath "$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - func_append notinst_deplibs " $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - func_append notinst_deplibs " $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$opt_mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$absdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) func_append compile_shlibpath "$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$opt_mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) func_append xrpath " $temp_xrpath";; - esac;; - *) func_append temp_deplibs " $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - func_append newlib_search_path " $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result";; - *) func_resolve_sysroot "$deplib" ;; - esac - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $func_resolve_sysroot_result "*) - func_append specialdeplibs " $func_resolve_sysroot_result" ;; - esac - fi - func_append tmp_libs " $func_resolve_sysroot_result" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_resolve_sysroot "$deplib" - deplib=$func_resolve_sysroot_result - func_dirname "$deplib" "" "." - dir=$func_dirname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) func_append lib_search_path " $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) func_append tmp_libs " $deplib" ;; - esac - ;; - *) func_append tmp_libs " $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - func_append tmp_libs " $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - func_append objs "$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - func_append libobjs " $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - # correct linux to gnu/linux during the next big refactor - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - *) - func_fatal_configuration "$modename: unknown library version type \`$version_type'" - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) # correct to gnu/linux during the next big refactor - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - func_append verstring ":${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - func_append libobjs " $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$opt_mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - func_append removelist " $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - func_append oldlibs " $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - func_replace_sysroot "$libdir" - func_append temp_xrpath " -R$func_replace_sysroot_result" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) func_append dlfiles " $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) func_append dlprefiles " $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - func_append deplibs " System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - func_append deplibs " -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - $nocaseglob - else - potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` - fi - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - func_append newdeplibs " $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` - done - fi - case $tmp_deplibs in - *[!\ \ ]*) - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - ;; - esac - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - # Remove ${wl} instances when linking with ld. - # FIXME: should test the right _cmds variable. - case $archive_cmds in - *\$LD\ *) wl= ;; - esac - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$opt_mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append dep_rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - func_append linknames " $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - func_append delfiles " $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd1 in $cmds; do - IFS="$save_ifs" - # Take the normal branch if the nm_file_list_spec branch - # doesn't work or if tool conversion is not needed. - case $nm_file_list_spec~$to_tool_file_cmd in - *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) - try_normal_branch=yes - eval cmd=\"$cmd1\" - func_len " $cmd" - len=$func_len_result - ;; - *) - try_normal_branch=no - ;; - esac - if test "$try_normal_branch" = yes \ - && { test "$len" -lt "$max_cmd_len" \ - || test "$max_cmd_len" -le -1; } - then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - elif test -n "$nm_file_list_spec"; then - func_basename "$output" - output_la=$func_basename_result - save_libobjs=$libobjs - save_output=$output - output=${output_objdir}/${output_la}.nm - func_to_tool_file "$output" - libobjs=$nm_file_list_spec$func_to_tool_file_result - func_append delfiles " $output" - func_verbose "creating $NM input file list: $output" - for obj in $save_libobjs; do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > "$output" - eval cmd=\"$cmd1\" - func_show_eval "$cmd" 'exit $?' - output=$save_output - libobjs=$save_libobjs - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - func_append tmp_deplibs " $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - func_append linker_flags " $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - func_basename "$output" - output_la=$func_basename_result - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - echo ')' >> $output - func_append delfiles " $output" - func_to_tool_file "$output" - output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - func_append delfiles " $output" - func_to_tool_file "$output" - output=$firstobj\"$file_list_spec$func_to_tool_file_result\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval concat_cmds=\"$reload_cmds\" - else - # All subsequent reloadable object files will link in - # the last one created. - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - func_append delfiles " $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # If we're not building shared, we need to use non_pic_objs - test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - func_append compile_command " ${wl}-bind_at_load" - func_append finalize_command " ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - func_append compile_command " $compile_deplibs" - func_append finalize_command " $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) func_append dllsearchpath ":$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) func_append finalize_perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - func_append rpath "$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output_objdir/$outputname" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - func_append oldobjs " $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $addlibs - func_append oldobjs " $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append oldobjs " $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - func_append oldobjs " $gentop/$newobj" - ;; - *) func_append oldobjs " $obj" ;; - esac - done - fi - func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 - tool_oldlib=$func_to_tool_file_result - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - elif test -n "$archiver_list_spec"; then - func_verbose "using command file archive linking..." - for obj in $oldobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > $output_objdir/$libname.libcmd - func_to_tool_file "$output_objdir/$libname.libcmd" - oldobjs=" $archiver_list_spec$func_to_tool_file_result" - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - func_resolve_sysroot "$deplib" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" - ;; - -L*) - func_stripname -L '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -L$func_replace_sysroot_result" - ;; - -R*) - func_stripname -R '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -R$func_replace_sysroot_result" - ;; - *) func_append newdependency_libs " $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" - ;; - *) func_append newdlfiles " $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlfiles " $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlprefiles " $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$opt_mode" = link || test "$opt_mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) func_append RM " $arg"; rmforce=yes ;; - -*) func_append RM " $arg" ;; - *) func_append files " $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - odir="$objdir" - else - odir="$dir/$objdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$opt_mode" = uninstall && odir="$dir" - - # Remember odir for removal later, being careful to avoid duplicates - if test "$opt_mode" = clean; then - case " $rmdirs " in - *" $odir "*) ;; - *) func_append rmdirs " $odir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - func_append rmfiles " $odir/$n" - done - test -n "$old_library" && func_append rmfiles " $odir/$old_library" - - case "$opt_mode" in - clean) - case " $library_names " in - *" $dlname "*) ;; - *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; - esac - test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - func_append rmfiles " $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - func_append rmfiles " $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$opt_mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - func_append rmfiles " $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - func_append rmfiles " $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - func_append rmfiles " $odir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - func_append rmfiles " $odir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$opt_mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$opt_mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/src/modifiedJellyfish/m4/libtool.m4 b/src/modifiedJellyfish/m4/libtool.m4 deleted file mode 100644 index d7c043f4..00000000 --- a/src/modifiedJellyfish/m4/libtool.m4 +++ /dev/null @@ -1,7997 +0,0 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 57 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - -_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl -dnl -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_WITH_SYSROOT])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -]) - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - -## ------------------------------------- ## -## Accumulate code for creating libtool. ## -## ------------------------------------- ## - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - -## ------------------------ ## -## FIXME: Eliminate VARNAME ## -## ------------------------ ## - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$[]1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -_LT_OUTPUT_LIBTOOL_INIT -]) - -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2011 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_REPLACE_SHELLFNS - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Go], [_LT_LANG(GO)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -m4_ifndef([AC_PROG_GO], [ -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_GO. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ -m4_defun([AC_PROG_GO], -[AC_LANG_PUSH(Go)dnl -AC_ARG_VAR([GOC], [Go compiler command])dnl -AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl -_AC_ARG_VAR_LDFLAGS()dnl -AC_CHECK_TOOL(GOC, gccgo) -if test -z "$GOC"; then - if test -n "$ac_tool_prefix"; then - AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) - fi -fi -if test -z "$GOC"; then - AC_CHECK_PROG(GOC, gccgo, gccgo, false) -fi -])#m4_defun -])#m4_ifndef - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([AC_PROG_GO], - [LT_LANG(GO)], - [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&AS_MESSAGE_LOG_FD - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test $_lt_result -eq 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD - $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&AS_MESSAGE_LOG_FD - elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES([TAG]) -# --------------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], - [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) -# ---------------------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -# Store the results from the different compilers for each TAGNAME. -# Allow to override them for all tags through lt_cv_aix_libpath. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], - [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ - lt_aix_libpath_sed='[ - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }]' - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi],[]) - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" - fi - ]) - aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) -fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$[]1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -case "$ECHO" in - printf*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac - -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test "X`printf %s $ECHO`" = "X$ECHO" \ - || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) - -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_WITH_SYSROOT -# ---------------- -AC_DEFUN([_LT_WITH_SYSROOT], -[AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[ --with-sysroot[=DIR] Search for dependent libraries within DIR - (or the compiler's sysroot if not specified).], -[], [with_sysroot=no]) - -dnl lt_sysroot will always be passed unquoted. We quote it here -dnl in case the user passed a directory name. -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - AC_MSG_RESULT([${with_sysroot}]) - AC_MSG_ERROR([The sysroot must be an absolute path.]) - ;; -esac - - AC_MSG_RESULT([${lt_sysroot:-no}]) -_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and in which our libraries should be installed.])]) - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - case `/usr/bin/file conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac - ;; - powerpc64le-*) - LD="${LD-ld} -m elf32lppclinux" - ;; - powerpc64-*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - powerpcle-*) - LD="${LD-ld} -m elf64lppc" - ;; - powerpc-*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD="${LD-ld}_sol2" - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_PROG_AR -# ----------- -m4_defun([_LT_PROG_AR], -[AC_CHECK_TOOLS(AR, [ar], false) -: ${AR=ar} -: ${AR_FLAGS=cru} -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) - -AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], - [lt_cv_ar_at_file=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - ]) - ]) - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi -_LT_DECL([], [archiver_list_spec], [1], - [How to feed a file listing to the archiver]) -])# _LT_PROG_AR - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[_LT_PROG_AR - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[23]].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[[3-9]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method = "file_magic"]) -_LT_DECL([], [file_magic_glob], [1], - [How to find potential files when deplibs_check_method = "file_magic"]) -_LT_DECL([], [want_nocaseglob], [1], - [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - -# _LT_CHECK_SHAREDLIB_FROM_LINKLIB -# -------------------------------- -# how to determine the name of the shared library -# associated with a specific link library. -# -- PORTME fill in with the dynamic library characteristics -m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], -[m4_require([_LT_DECL_EGREP]) -m4_require([_LT_DECL_OBJDUMP]) -m4_require([_LT_DECL_DLLTOOL]) -AC_CACHE_CHECK([how to associate runtime and link libraries], -lt_cv_sharedlib_from_linklib_cmd, -[lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac -]) -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - -_LT_DECL([], [sharedlib_from_linklib_cmd], [1], - [Command to associate shared and link libraries]) -])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB - - -# _LT_PATH_MANIFEST_TOOL -# ---------------------- -# locate the manifest tool -m4_defun([_LT_PATH_MANIFEST_TOOL], -[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], - [lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&AS_MESSAGE_LOG_FD - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest*]) -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi -_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl -])# _LT_PATH_MANIFEST_TOOL - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT@&t@_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT@&t@_DLSYM_CONST -#else -# define LT@&t@_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT@&t@_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -_LT_DECL([], [nm_file_list_spec], [1], - [Specify filename containing input files for $NM]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - *Sun\ F* | *Sun*Fortran*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - *Intel*\ [[CF]]*Compiler*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - *Portland\ Group*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac - -AC_CACHE_CHECK([for $compiler option to produce PIC], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) - _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; - *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - _LT_TAGVAR(link_all_deplibs, $1)=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - esac - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - m4_if($1, [], [ - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], - [lt_cv_irix_exported_symbol], - [save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE( - [AC_LANG_SOURCE( - [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], - [C++], [[int foo (void) { return 0; }]], - [Fortran 77], [[ - subroutine foo - end]], - [Fortran], [[ - subroutine foo - end]])])], - [lt_cv_irix_exported_symbol=yes], - [lt_cv_irix_exported_symbol=no]) - LDFLAGS="$save_LDFLAGS"]) - if test "$lt_cv_irix_exported_symbol" = yes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [postlink_cmds], [2], - [Commands necessary for finishing linking programs]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd2.*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_FUNC_STRIPNAME_CNF -# ---------------------- -# func_stripname_cnf prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# -# This function is identical to the (non-XSI) version of func_stripname, -# except this one can be used by m4 code that may be executed by configure, -# rather than the libtool script. -m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl -AC_REQUIRE([_LT_DECL_SED]) -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf -])# _LT_FUNC_STRIPNAME_CNF - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF -package foo -func foo() { -} -_LT_EOF -]) - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; -esac - -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${F77-"f77"} - CFLAGS=$FFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" - CFLAGS="$lt_save_CFLAGS" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${FC-"f95"} - CFLAGS=$FCFLAGS - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -CFLAGS=$GCJFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_GO_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Go compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GO_CONFIG], -[AC_REQUIRE([LT_PROG_GO])dnl -AC_LANG_SAVE - -# Source file extension for Go test sources. -ac_ext=go - -# Object file extension for compiled Go test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="package main; func main() { }" - -# Code to be used in simple link tests -lt_simple_link_test_code='package main; func main() { }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GOC-"gccgo"} -CFLAGS=$GOFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# Go did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GO_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -CFLAGS= -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_GO -# ---------- -AC_DEFUN([LT_PROG_GO], -[AC_CHECK_TOOL(GOC, gccgo,) -]) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - -# _LT_DECL_DLLTOOL -# ---------------- -# Ensure DLLTOOL variable is set. -m4_defun([_LT_DECL_DLLTOOL], -[AC_CHECK_TOOL(DLLTOOL, dlltool, false) -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) -AC_SUBST([DLLTOOL]) -]) - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) -# ------------------------------------------------------ -# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and -# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. -m4_defun([_LT_PROG_FUNCTION_REPLACE], -[dnl { -sed -e '/^$1 ()$/,/^} # $1 /c\ -$1 ()\ -{\ -m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) -} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: -]) - - -# _LT_PROG_REPLACE_SHELLFNS -# ------------------------- -# Replace existing portable implementations of several shell functions with -# equivalent extended shell implementations where those features are available.. -m4_defun([_LT_PROG_REPLACE_SHELLFNS], -[if test x"$xsi_shell" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl - func_split_long_opt_name=${1%%=*} - func_split_long_opt_arg=${1#*=}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) - - _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) - - _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) - - _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) -fi - -if test x"$lt_shell_append" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) - - _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl - func_quote_for_eval "${2}" -dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ - eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) -fi -]) - -# _LT_PATH_CONVERSION_FUNCTIONS -# ----------------------------- -# Determine which file name conversion functions should be used by -# func_to_host_file (and, implicitly, by func_to_host_path). These are needed -# for certain cross-compile configurations and native mingw. -m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_MSG_CHECKING([how to convert $build file names to $host format]) -AC_CACHE_VAL(lt_cv_to_host_file_cmd, -[case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac -]) -to_host_file_cmd=$lt_cv_to_host_file_cmd -AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) -_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], - [0], [convert $build file names to $host format])dnl - -AC_MSG_CHECKING([how to convert $build file names to toolchain format]) -AC_CACHE_VAL(lt_cv_to_tool_file_cmd, -[#assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac -]) -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) -_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], - [0], [convert $build files to toolchain format])dnl -])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/src/modifiedJellyfish/m4/ltoptions.m4 b/src/modifiedJellyfish/m4/ltoptions.m4 deleted file mode 100644 index 5d9acd8e..00000000 --- a/src/modifiedJellyfish/m4/ltoptions.m4 +++ /dev/null @@ -1,384 +0,0 @@ -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 7 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - -## --------------------------------- ## -## Macros to handle LT_INIT options. ## -## --------------------------------- ## - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for lt_pkg in $withval; do - IFS="$lt_save_ifs" - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - -## ----------------- ## -## LTDL_INIT Options ## -## ----------------- ## - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/src/modifiedJellyfish/m4/ltsugar.m4 b/src/modifiedJellyfish/m4/ltsugar.m4 deleted file mode 100644 index 9000a057..00000000 --- a/src/modifiedJellyfish/m4/ltsugar.m4 +++ /dev/null @@ -1,123 +0,0 @@ -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) diff --git a/src/modifiedJellyfish/m4/ltversion.m4 b/src/modifiedJellyfish/m4/ltversion.m4 deleted file mode 100644 index 07a8602d..00000000 --- a/src/modifiedJellyfish/m4/ltversion.m4 +++ /dev/null @@ -1,23 +0,0 @@ -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# @configure_input@ - -# serial 3337 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.4.2]) -m4_define([LT_PACKAGE_REVISION], [1.3337]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.2' -macro_revision='1.3337' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) diff --git a/src/modifiedJellyfish/m4/lt~obsolete.m4 b/src/modifiedJellyfish/m4/lt~obsolete.m4 deleted file mode 100644 index c573da90..00000000 --- a/src/modifiedJellyfish/m4/lt~obsolete.m4 +++ /dev/null @@ -1,98 +0,0 @@ -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/src/modifiedJellyfish/m4/m4-ax_perl_ext.m4 b/src/modifiedJellyfish/m4/m4-ax_perl_ext.m4 deleted file mode 100644 index 32dae480..00000000 --- a/src/modifiedJellyfish/m4/m4-ax_perl_ext.m4 +++ /dev/null @@ -1,139 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_perl_ext.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PERL_EXT([prefix]) -# -# DESCRIPTION -# -# Fetches the linker flags and C compiler flags for compiling and linking -# Perl binary extensions. The macro substitutes PERL_EXT_PREFIX, -# PERL_EXT_INC, PERL_EXT_LIB, PERL_EXT_CPPFLAGS, PERL_EXT_LDFLAGS and -# PERL_EXT_DLEXT variables if Perl executable was found. It also checks -# the same variables before trying to retrieve them from the Perl -# configuration. -# -# PERL_EXT_PREFIX: top-level perl installation path (--prefix) -# PERL_EXT_INC: XS include directory -# PERL_EXT_LIB: Perl extensions destination directory -# PERL_EXT_CPPFLAGS: C preprocessor flags to compile extensions -# PERL_EXT_LDFLAGS: linker flags to build extensions -# PERL_EXT_DLEXT: extensions suffix for perl modules (e.g. ".so") -# -# Examples: -# -# AX_PERL_EXT -# if test x"$PERL" = x; then -# AC_ERROR(["cannot find Perl"]) -# fi -# -# LICENSE -# -# Copyright (c) 2011 Stanislav Sedov -# Copyright (c) 2014 Thomas Klausner -# -# 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. - -#serial 2 - -AC_DEFUN([AX_PERL_EXT],[ - - # - # Check if perl executable exists. - # - AC_PATH_PROGS(PERL, ["${PERL-perl}"], []) - - if test -n "$PERL" ; then - - # - # Check for Perl prefix. - # - AC_ARG_VAR(PERL_EXT_PREFIX, [Perl PREFIX]) - AC_MSG_CHECKING([for Perl prefix]) - if test -z "$PERL_EXT_PREFIX" ; then - [PERL_EXT_PREFIX=`$PERL -MConfig -e 'print $Config{prefix};'`]; - fi - AC_MSG_RESULT([$PERL_EXT_PREFIX]) - AC_SUBST(PERL_EXT_PREFIX) - - # - # Check for Perl extensions include path. - # - AC_ARG_VAR(PERL_EXT_INC, [Directory to include XS headers from]) - AC_MSG_CHECKING([for Perl extension include path]) - if test -z "$PERL_EXT_INC" ; then - [PERL_EXT_INC=`$PERL -MConfig -e 'print $Config{archlibexp}, "/CORE";'`]; - fi - AC_MSG_RESULT([$PERL_EXT_INC]) - AC_SUBST(PERL_EXT_INC) - - # - # Check for the extensions target directory. - # - AC_ARG_VAR(PERL_EXT_LIB, [Directory to install perl files into]) - AC_MSG_CHECKING([for Perl extension target directory]) - if test -z "$PERL_EXT_LIB" ; then - if test -z "$1" -o "x$1" = xNONE ; then - [PERL_EXT_LIB=`$PERL -MConfig -e 'print $Config{sitearch};'`]; - else - [PERL_EXT_LIB=`$PERL -MConfig -e 'print $ARGV.shift, "/lib/perl/", $Config{api_versionstring};' $1`] - fi - fi - AC_MSG_RESULT([$PERL_EXT_LIB]) - AC_SUBST(PERL_EXT_LIB) - - # - # Check for Perl CPP flags. - # - AC_ARG_VAR(PERL_EXT_CPPFLAGS, [CPPFLAGS to compile perl extensions]) - AC_MSG_CHECKING([for Perl extensions C preprocessor flags]) - if test -z "$PERL_EXT_CPPFLAGS" ; then - [PERL_EXT_CPPFLAGS=`$PERL -MConfig -e 'print $Config{cppflags};'`]; - fi - AC_MSG_RESULT([$PERL_EXT_CPPFLAGS]) - AC_SUBST(PERL_EXT_CPPFLAGS) - - # - # Check for Perl extension link flags. - # - AC_ARG_VAR(PERL_EXT_LDFLAGS, [LDFLAGS to build perl extensions]) - AC_MSG_CHECKING([for Perl extensions linker flags]) - if test -z "$PERL_EXT_LDFLAGS" ; then - [PERL_EXT_LDFLAGS=`$PERL -MConfig -e 'print $Config{lddlflags};'`]; - fi - # Fix LDFLAGS for OS X. We don't want any -arch flags here, otherwise - # linking will fail. Also, OS X Perl LDFLAGS contains "-arch ppc" which - # is not supported by XCode anymore. - case "${host}" in - *darwin*) - PERL_EXT_LDFLAGS=`echo ${PERL_EXT_LDFLAGS} | sed -e "s,-arch [[^ ]]*,,g"` - ;; - esac - AC_MSG_RESULT([$PERL_EXT_LDFLAGS]) - AC_SUBST(PERL_EXT_LDFLAGS) - - fi -]) diff --git a/src/modifiedJellyfish/m4/m4-ax_pkg_swig.m4 b/src/modifiedJellyfish/m4/m4-ax_pkg_swig.m4 deleted file mode 100644 index d836eec8..00000000 --- a/src/modifiedJellyfish/m4/m4-ax_pkg_swig.m4 +++ /dev/null @@ -1,135 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found]) -# -# DESCRIPTION -# -# This macro searches for a SWIG installation on your system. If found, -# then SWIG is AC_SUBST'd; if not found, then $SWIG is empty. If SWIG is -# found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd. -# -# You can use the optional first argument to check if the version of the -# available SWIG is greater than or equal to the value of the argument. It -# should have the format: N[.N[.N]] (N is a number between 0 and 999. Only -# the first N is mandatory.) If the version argument is given (e.g. -# 1.3.17), AX_PKG_SWIG checks that the swig package is this version number -# or higher. -# -# As usual, action-if-found is executed if SWIG is found, otherwise -# action-if-not-found is executed. -# -# In configure.in, use as: -# -# AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ]) -# AX_SWIG_ENABLE_CXX -# AX_SWIG_MULTI_MODULE_SUPPORT -# AX_SWIG_PYTHON -# -# LICENSE -# -# Copyright (c) 2008 Sebastian Huber -# Copyright (c) 2008 Alan W. Irwin -# Copyright (c) 2008 Rafael Laboissiere -# Copyright (c) 2008 Andrew Collier -# Copyright (c) 2011 Murray Cumming -# -# 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 2 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 . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 11 - -AC_DEFUN([AX_PKG_SWIG],[ - # Ubuntu has swig 2.0 as /usr/bin/swig2.0 - AC_PATH_PROGS([SWIG],[swig swig2.0]) - if test -z "$SWIG" ; then - m4_ifval([$3],[$3],[:]) - elif test -n "$1" ; then - AC_MSG_CHECKING([SWIG version]) - [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] - AC_MSG_RESULT([$swig_version]) - if test -n "$swig_version" ; then - # Calculate the required version number components - [required=$1] - [required_major=`echo $required | sed 's/[^0-9].*//'`] - if test -z "$required_major" ; then - [required_major=0] - fi - [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] - [required_minor=`echo $required | sed 's/[^0-9].*//'`] - if test -z "$required_minor" ; then - [required_minor=0] - fi - [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] - [required_patch=`echo $required | sed 's/[^0-9].*//'`] - if test -z "$required_patch" ; then - [required_patch=0] - fi - # Calculate the available version number components - [available=$swig_version] - [available_major=`echo $available | sed 's/[^0-9].*//'`] - if test -z "$available_major" ; then - [available_major=0] - fi - [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] - [available_minor=`echo $available | sed 's/[^0-9].*//'`] - if test -z "$available_minor" ; then - [available_minor=0] - fi - [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] - [available_patch=`echo $available | sed 's/[^0-9].*//'`] - if test -z "$available_patch" ; then - [available_patch=0] - fi - # Convert the version tuple into a single number for easier comparison. - # Using base 100 should be safe since SWIG internally uses BCD values - # to encode its version number. - required_swig_vernum=`expr $required_major \* 10000 \ - \+ $required_minor \* 100 \+ $required_patch` - available_swig_vernum=`expr $available_major \* 10000 \ - \+ $available_minor \* 100 \+ $available_patch` - - if test $available_swig_vernum -lt $required_swig_vernum; then - AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version.]) - SWIG='' - m4_ifval([$3],[$3],[]) - else - AC_MSG_CHECKING([for SWIG library]) - SWIG_LIB=`$SWIG -swiglib` - AC_MSG_RESULT([$SWIG_LIB]) - m4_ifval([$2],[$2],[]) - fi - else - AC_MSG_WARN([cannot determine SWIG version]) - SWIG='' - m4_ifval([$3],[$3],[]) - fi - fi - AC_SUBST([SWIG_LIB]) -]) diff --git a/src/modifiedJellyfish/m4/m4-ax_python_devel.m4 b/src/modifiedJellyfish/m4/m4-ax_python_devel.m4 deleted file mode 100644 index b3f1406b..00000000 --- a/src/modifiedJellyfish/m4/m4-ax_python_devel.m4 +++ /dev/null @@ -1,333 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_python_devel.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PYTHON_DEVEL([version], [prefix]) -# -# DESCRIPTION -# -# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it -# in your configure.ac. -# -# This macro checks for Python and tries to get the include path to -# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) -# output variables. It also exports $(PYTHON_EXTRA_LIBS) and -# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. -# -# You can search for some particular version of Python by passing a -# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please -# note that you *have* to pass also an operator along with the version to -# match, and pay special attention to the single quotes surrounding the -# version number. Don't use "PYTHON_VERSION" for this: that environment -# variable is declared as precious and thus reserved for the end-user. -# -# This macro should work for all versions of Python >= 2.1.0. As an end -# user, you can disable the check for the python version by setting the -# PYTHON_NOVERSIONCHECK environment variable to something else than the -# empty string. -# -# If you need to use this macro for an older Python version, please -# contact the authors. We're always open for feedback. -# -# LICENSE -# -# Copyright (c) 2009 Sebastian Huber -# Copyright (c) 2009 Alan W. Irwin -# Copyright (c) 2009 Rafael Laboissiere -# Copyright (c) 2009 Andrew Collier -# Copyright (c) 2009 Matteo Settenvini -# Copyright (c) 2009 Horst Knorr -# Copyright (c) 2013 Daniel Mullner -# -# 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 . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 17 - -AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) -AC_DEFUN([AX_PYTHON_DEVEL],[ - # - # Allow the use of a (user set) custom python version - # - AC_ARG_VAR([PYTHON_VERSION],[The installed Python - version to use, for example '2.3'. This string - will be appended to the Python interpreter - canonical name.]) - - AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) - if test -z "$PYTHON"; then - AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) - PYTHON_VERSION="" - fi - - # - # Check for a version of Python >= 2.1.0 - # - AC_MSG_CHECKING([for a version of Python >= '2.1.0']) - ac_supports_python_ver=`$PYTHON -c "import sys; \ - ver = sys.version.split ()[[0]]; \ - print (ver >= '2.1.0')"` - if test "$ac_supports_python_ver" != "True"; then - if test -z "$PYTHON_NOVERSIONCHECK"; then - AC_MSG_RESULT([no]) - AC_MSG_FAILURE([ -This version of the AC@&t@_PYTHON_DEVEL macro -doesn't work properly with versions of Python before -2.1.0. You may need to re-run configure, setting the -variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, -PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. -Moreover, to disable this check, set PYTHON_NOVERSIONCHECK -to something else than an empty string. -]) - else - AC_MSG_RESULT([skip at user request]) - fi - else - AC_MSG_RESULT([yes]) - fi - - # - # if the macro parameter ``version'' is set, honour it - # - if test -n "$1"; then - AC_MSG_CHECKING([for a version of Python $1]) - ac_supports_python_ver=`$PYTHON -c "import sys; \ - ver = sys.version.split ()[[0]]; \ - print (ver $1)"` - if test "$ac_supports_python_ver" = "True"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_ERROR([this package requires Python $1. -If you have it installed, but it isn't the default Python -interpreter in your system path, please pass the PYTHON_VERSION -variable to configure. See ``configure --help'' for reference. -]) - PYTHON_VERSION="" - fi - fi - - if test -n "$2" -a "x$2" != xNONE; then - prefix=$2 - else - prefix= - fi - - # - # Check if you have distutils, else fail - # - AC_MSG_CHECKING([for the distutils Python package]) - ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` - if test -z "$ac_distutils_result"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_ERROR([cannot import Python module "distutils". -Please check your Python installation. The error was: -$ac_distutils_result]) - PYTHON_VERSION="" - fi - - # - # Check for Python include path - # - AC_MSG_CHECKING([for Python include path]) - if test -z "$PYTHON_CPPFLAGS"; then - python_path=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_inc ());"` - plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_inc (plat_specific=1));"` - if test -n "${python_path}"; then - if test "${plat_python_path}" != "${python_path}"; then - python_path="-I$python_path -I$plat_python_path" - else - python_path="-I$python_path" - fi - fi - PYTHON_CPPFLAGS=$python_path - fi - AC_MSG_RESULT([$PYTHON_CPPFLAGS]) - AC_SUBST([PYTHON_CPPFLAGS]) - - # - # Check for Python library path - # - AC_MSG_CHECKING([for Python library path]) - if test -z "$PYTHON_LDFLAGS"; then - # (makes two attempts to ensure we've got a version number - # from the interpreter) - ac_python_version=`cat< 0 and pref != '-c' else None; \ - print(distutils.sysconfig.get_python_lib(0,0,pref));" $prefix` - fi - AC_MSG_RESULT([$PYTHON_SITE_PKG]) - AC_SUBST([PYTHON_SITE_PKG]) - - # - # libraries which must be linked in when embedding - # - AC_MSG_CHECKING(python extra libraries) - if test -z "$PYTHON_EXTRA_LIBS"; then - PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ - print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` - fi - AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) - AC_SUBST(PYTHON_EXTRA_LIBS) - - # - # linking flags needed when embedding - # - AC_MSG_CHECKING(python extra linking flags) - if test -z "$PYTHON_EXTRA_LDFLAGS"; then - PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ - print (conf('LINKFORSHARED'))"` - fi - AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) - AC_SUBST(PYTHON_EXTRA_LDFLAGS) - - # - # final check to see if everything compiles alright - # - AC_MSG_CHECKING([consistency of all components of python development environment]) - # save current global flags - ac_save_LIBS="$LIBS" - ac_save_CPPFLAGS="$CPPFLAGS" - LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS" - CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" - AC_LANG_PUSH([C]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[#include ]], - [[Py_Initialize();]]) - ],[pythonexists=yes],[pythonexists=no]) - AC_LANG_POP([C]) - # turn back to default flags - CPPFLAGS="$ac_save_CPPFLAGS" - LIBS="$ac_save_LIBS" - - AC_MSG_RESULT([$pythonexists]) - - if test ! "x$pythonexists" = "xyes"; then - AC_MSG_FAILURE([ - Could not link test program to Python. Maybe the main Python library has been - installed in some non-standard library path. If so, pass it to configure, - via the LDFLAGS environment variable. - Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" - ============================================================================ - ERROR! - You probably have to install the development version of the Python package - for your distribution. The exact name of this package varies among them. - ============================================================================ - ]) - PYTHON_VERSION="" - fi - - # - # all done! - # -]) diff --git a/src/modifiedJellyfish/m4/m4-ax_ruby_ext.m4 b/src/modifiedJellyfish/m4/m4-ax_ruby_ext.m4 deleted file mode 100644 index 02077720..00000000 --- a/src/modifiedJellyfish/m4/m4-ax_ruby_ext.m4 +++ /dev/null @@ -1,119 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_ruby_ext.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_RUBY_EXT([prefix]) -# -# DESCRIPTION -# -# Fetches the linker flags and C compiler flags for compiling and linking -# Ruby binary extensions. The macro substitutes RUBY_VERSION, -# RUBY_EXT_INC, RUBY_EXT_LIB, RUBY_EXT_CPPFLAGS, RUBY_EXT_LDFLAGS and -# RUBY_EXT_DLEXT variables if Ruby executable has been found. It also -# checks the same variables before trying to retrieve them from the Ruby -# configuration. -# -# RUBY_VERSION: version of the Ruby interpreter -# RUBY_EXT_INC: Ruby include directory -# RUBY_EXT_LIB: Ruby extensions destination directory -# RUBY_EXT_CPPFLAGS: C preprocessor flags to compile extensions -# RUBY_EXT_LDFLAGS: linker flags to build extensions -# RUBY_EXT_DLEXT: extensions suffix for ruby modules (e.g. "so") -# -# Examples: -# -# AX_RUBY_EXT -# if test x"$RUBY" = x; then -# AC_ERROR(["cannot find Ruby"]) -# fi -# -# LICENSE -# -# Copyright (c) 2011 Stanislav Sedov -# -# 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. - -#serial 2 - -AC_DEFUN([AX_RUBY_EXT],[ - # - # Check if ruby executable exists. - # - AC_ARG_VAR([RUBY], [the Ruby interpreter]) - AC_PATH_PROGS(RUBY, ["${RUBY-ruby}"], []) - - if test -n "$RUBY" ; then - # - # Check Ruby version. - # - AC_MSG_CHECKING([for Ruby version]) - [RUBY_VERSION=`$RUBY -e 'print RUBY_VERSION'`]; - AC_MSG_RESULT([$RUBY_VERSION]) - AC_SUBST(RUBY_VERSION) - - # - # Check for the extensions target directory. - # - AC_MSG_CHECKING([for Ruby extensions target directory]) - AS_IF([test -z "$RUBY_EXT_LIB"], - AS_IF([test -z "$1" -o "x$1" = xNONE], [RUBY_EXT_LIB=`$RUBY -rrbconfig -e 'print RbConfig::expand(RbConfig::CONFIG.fetch("sitearchdir"))'`], - [RUBY_EXT_LIB=`$RUBY -rrbconfig -e 'print(ARGV.fetch(0), "/lib/ruby/", RbConfig::CONFIG.fetch("ruby_version"))' $1`])) - AC_MSG_RESULT([$RUBY_EXT_LIB]) - AC_SUBST(RUBY_EXT_LIB) - - # - # Check for include flags - # - AC_MSG_CHECKING([for Ruby include directory]) - AS_IF([test -z "$RUBY_EXT_CFLAGS"], - [RUBY_EXT_CFLAGS="-I`$RUBY -rrbconfig -e 'print RbConfig::expand(RbConfig::CONFIG.fetch("rubyhdrdir"))'`"] - [RUBY_EXT_CFLAGS="$RUBY_EXT_CFLAGS -I`$RUBY -rrbconfig -e 'print RbConfig::CONFIG.has_key?("rubyarchhdrdir") ? RbConfig::expand(RbConfig::CONFIG.fetch("rubyarchhdrdir")) : File.join(RbConfig::expand(RbConfig::CONFIG.fetch("rubyhdrdir")), RbConfig::CONFIG.fetch("arch"))'`"]) - AC_MSG_RESULT([$RUBY_EXT_CFLAGS]) - AC_SUBST(RUBY_EXT_CFLAGS) - - # - # Check for lib flags - # - AC_MSG_CHECKING([for Ruby libs]) - AS_IF([test -z "$RUBY_EXT_LIBS"], - [RUBY_EXT_LIBS="`$RUBY -rrbconfig -e 'print RbConfig::expand(RbConfig::CONFIG.fetch("LIBRUBYARG_SHARED"))'` `$RUBY -rrbconfig -e 'print RbConfig::expand(RbConfig::CONFIG.fetch("LIBS"))'`"]) - AC_MSG_RESULT([$RUBY_EXT_LIBS]) - AC_SUBST(RUBY_EXT_LIBS) - - - # Fix LDFLAGS for OS X. We don't want any -arch flags here, otherwise - # linking might fail. We also including the proper flags to create a bundle. - AC_MSG_CHECKING([for Ruby extra LDFLAGS]) - case "$host" in - *darwin*) - RUBY_EXT_LDFLAGS=`echo ${RUBY_EXT_LDFLAGS} | sed -e "s,-arch [[^ ]]*,,g"` - RUBY_EXT_LDFLAGS="${RUBY_EXT_LDFLAGS} -bundle -undefined dynamic_lookup" - ;; - esac - AC_MSG_RESULT([$RUBY_EXT_LDFLAGS]) - AC_SUBST(RUBY_EXT_LDFLAGS) - fi -]) diff --git a/src/modifiedJellyfish/m4/m4-ax_swig_enable_cxx.m4 b/src/modifiedJellyfish/m4/m4-ax_swig_enable_cxx.m4 deleted file mode 100644 index f2cb90b3..00000000 --- a/src/modifiedJellyfish/m4/m4-ax_swig_enable_cxx.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_swig_enable_cxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_SWIG_ENABLE_CXX -# -# DESCRIPTION -# -# Enable SWIG C++ support. This affects all invocations of $(SWIG). -# -# LICENSE -# -# Copyright (c) 2008 Sebastian Huber -# Copyright (c) 2008 Alan W. Irwin -# Copyright (c) 2008 Rafael Laboissiere -# Copyright (c) 2008 Andrew Collier -# -# 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 2 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 . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 9 - -AU_ALIAS([SWIG_ENABLE_CXX], [AX_SWIG_ENABLE_CXX]) -AC_DEFUN([AX_SWIG_ENABLE_CXX],[ - AC_REQUIRE([AX_PKG_SWIG]) - AC_REQUIRE([AC_PROG_CXX]) - SWIG="$SWIG -c++" -]) diff --git a/src/modifiedJellyfish/missing b/src/modifiedJellyfish/missing deleted file mode 100755 index db98974f..00000000 --- a/src/modifiedJellyfish/missing +++ /dev/null @@ -1,215 +0,0 @@ -#! /bin/sh -# Common wrapper for a few potentially missing GNU programs. - -scriptversion=2013-10-28.13; # UTC - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# Originally written by Fran,cois Pinard , 1996. - -# 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 2, 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 . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try '$0 --help' for more information" - exit 1 -fi - -case $1 in - - --is-lightweight) - # Used by our autoconf macros to check whether the available missing - # script is modern enough. - exit 0 - ;; - - --run) - # Back-compat with the calling convention used by older automake. - shift - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due -to PROGRAM being missing or too old. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - -Supported PROGRAM values: - aclocal autoconf autoheader autom4te automake makeinfo - bison yacc flex lex help2man - -Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and -'g' are ignored when checking the name. - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: unknown '$1' option" - echo 1>&2 "Try '$0 --help' for more information" - exit 1 - ;; - -esac - -# Run the given program, remember its exit status. -"$@"; st=$? - -# If it succeeded, we are done. -test $st -eq 0 && exit 0 - -# Also exit now if we it failed (or wasn't found), and '--version' was -# passed; such an option is passed most likely to detect whether the -# program is present and works. -case $2 in --version|--help) exit $st;; esac - -# Exit code 63 means version mismatch. This often happens when the user -# tries to use an ancient version of a tool on a file that requires a -# minimum version. -if test $st -eq 63; then - msg="probably too old" -elif test $st -eq 127; then - # Program was missing. - msg="missing on your system" -else - # Program was found and executed, but failed. Give up. - exit $st -fi - -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software - -program_details () -{ - case $1 in - aclocal|automake) - echo "The '$1' program is part of the GNU Automake package:" - echo "<$gnu_software_URL/automake>" - echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/autoconf>" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - autoconf|autom4te|autoheader) - echo "The '$1' program is part of the GNU Autoconf package:" - echo "<$gnu_software_URL/autoconf/>" - echo "It also requires GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - esac -} - -give_advice () -{ - # Normalize program name to check for. - normalized_program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - - printf '%s\n' "'$1' is $msg." - - configure_deps="'configure.ac' or m4 files included by 'configure.ac'" - case $normalized_program in - autoconf*) - echo "You should only need it if you modified 'configure.ac'," - echo "or m4 files included by it." - program_details 'autoconf' - ;; - autoheader*) - echo "You should only need it if you modified 'acconfig.h' or" - echo "$configure_deps." - program_details 'autoheader' - ;; - automake*) - echo "You should only need it if you modified 'Makefile.am' or" - echo "$configure_deps." - program_details 'automake' - ;; - aclocal*) - echo "You should only need it if you modified 'acinclude.m4' or" - echo "$configure_deps." - program_details 'aclocal' - ;; - autom4te*) - echo "You might have modified some maintainer files that require" - echo "the 'autom4te' program to be rebuilt." - program_details 'autom4te' - ;; - bison*|yacc*) - echo "You should only need it if you modified a '.y' file." - echo "You may want to install the GNU Bison package:" - echo "<$gnu_software_URL/bison/>" - ;; - lex*|flex*) - echo "You should only need it if you modified a '.l' file." - echo "You may want to install the Fast Lexical Analyzer package:" - echo "<$flex_URL>" - ;; - help2man*) - echo "You should only need it if you modified a dependency" \ - "of a man page." - echo "You may want to install the GNU Help2man package:" - echo "<$gnu_software_URL/help2man/>" - ;; - makeinfo*) - echo "You should only need it if you modified a '.texi' file, or" - echo "any other file indirectly affecting the aspect of the manual." - echo "You might want to install the Texinfo package:" - echo "<$gnu_software_URL/texinfo/>" - echo "The spurious makeinfo call might also be the consequence of" - echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" - echo "want to install GNU make:" - echo "<$gnu_software_URL/make/>" - ;; - *) - echo "You might have modified some files without having the proper" - echo "tools for further handling them. Check the 'README' file, it" - echo "often tells you about the needed prerequisites for installing" - echo "this package. You may also peek at any GNU archive site, in" - echo "case some other package contains this missing '$1' program." - ;; - esac -} - -give_advice "$1" | sed -e '1s/^/WARNING: /' \ - -e '2,$s/^/ /' >&2 - -# Propagate the correct exit status (expected to be 127 for a program -# not found, 63 for a program that failed due to version mismatch). -exit $st - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/src/modifiedJellyfish/sub_commands/bc_main.cc b/src/modifiedJellyfish/sub_commands/bc_main.cc deleted file mode 100644 index 20bdcf67..00000000 --- a/src/modifiedJellyfish/sub_commands/bc_main.cc +++ /dev/null @@ -1,161 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace err = jellyfish::err; - -using std::chrono::system_clock; -using std::chrono::duration; -using std::chrono::duration_cast; - -template -inline double as_seconds(DtnType dtn) { return duration_cast>(dtn).count(); } - -static bc_main_cmdline args; // Command line switches and arguments -typedef std::vector file_vector; -using jellyfish::mer_dna; -using jellyfish::mer_dna_bloom_counter; -typedef jellyfish::mer_overlap_sequence_parser > sequence_parser; -typedef jellyfish::mer_iterator mer_iterator; - -template -class mer_bloom_counter : public jellyfish::thread_exec { - int nb_threads_; - mer_dna_bloom_counter& filter_; - jellyfish::stream_manager streams_; - sequence_parser parser_; - -public: - mer_bloom_counter(int nb_threads, mer_dna_bloom_counter& filter, - PathIterator file_begin, PathIterator file_end, - PathIterator pipe_begin, PathIterator pipe_end, - uint32_t concurent_files) : - filter_(filter), - streams_(file_begin, file_end, pipe_begin, pipe_end, concurent_files), - parser_(jellyfish::mer_dna::k(), streams_.nb_streams(), 3 * nb_threads, 4096, streams_) - { } - - virtual void start(int thid) { - for(mer_iterator mers(parser_, args.canonical_flag) ; mers; ++mers) { - filter_.insert(*mers); - } - } -}; - -// If get a termination signal, kill the manager and then kill myself. -static pid_t manager_pid = 0; -static void signal_handler(int sig) { - if(manager_pid) - kill(manager_pid, SIGTERM); - signal(sig, SIG_DFL); - kill(getpid(), sig); - _exit(EXIT_FAILURE); // Should not be reached -} - -int bc_main(int argc, char *argv[]) -{ - auto start_time = system_clock::now(); - - jellyfish::file_header header; - header.fill_standard(); - header.set_cmdline(argc, argv); - - args.parse(argc, argv); - mer_dna::k(args.mer_len_arg); - - std::unique_ptr generator_manager; - if(args.generator_given) { - auto gm = - new jellyfish::generator_manager(args.generator_arg, args.Generators_arg, - args.shell_given ? args.shell_arg : (const char*)0); - generator_manager.reset(gm); - generator_manager->start(); - manager_pid = generator_manager->pid(); - struct sigaction act; - memset(&act, '\0', sizeof(act)); - act.sa_handler = signal_handler; - assert(sigaction(SIGTERM, &act, 0) == 0); - } - - header.canonical(args.canonical_flag); - std::ofstream output(args.output_arg); - if(!output.good()) - err::die(err::msg() << "Can't open output file '" << args.output_arg << "'"); - - header.format("bloomcounter"); - header.key_len(args.mer_len_arg * 2); - jellyfish::hash_pair hash_fns; - header.matrix(hash_fns.m1, 1); - header.matrix(hash_fns.m2, 2); - - mer_dna_bloom_counter filter(args.fpr_arg, args.size_arg, hash_fns); - header.size(filter.m()); - header.nb_hashes(filter.k()); - header.write(output); - - auto after_init_time = system_clock::now(); - - // Iterators to the multi pipe paths. If no generator manager, - // generate an empty range. - auto pipes_begin = generator_manager.get() ? generator_manager->pipes().begin() : args.file_arg.end(); - auto pipes_end = (bool)generator_manager ? generator_manager->pipes().end() : args.file_arg.end(); - - mer_bloom_counter counter(args.threads_arg, filter, - args.file_arg.begin(), args.file_arg.end(), - pipes_begin, pipes_end, args.Files_arg); - counter.exec_join(args.threads_arg); - - // If we have a manager, wait for it - if(generator_manager) { - signal(SIGTERM, SIG_DFL); - manager_pid = 0; - if(!generator_manager->wait()) - err::die("Some generator commands failed"); - generator_manager.reset(); - } - - auto after_count_time = system_clock::now(); - - filter.write_bits(output); - output.close(); - - auto after_dump_time = system_clock::now(); - - if(args.timing_given) { - std::ofstream timing_file(args.timing_arg); - timing_file << "Init " << as_seconds(after_init_time - start_time) << "\n" - << "Counting " << as_seconds(after_count_time - after_init_time) << "\n" - << "Writing " << as_seconds(after_dump_time - after_count_time) << "\n"; - } - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/bc_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/bc_main_cmdline.hpp deleted file mode 100644 index 518705ed..00000000 --- a/src/modifiedJellyfish/sub_commands/bc_main_cmdline.hpp +++ /dev/null @@ -1,540 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __BC_MAIN_CMDLINE_HPP__ -#define __BC_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class bc_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - uint64_t size_arg; - bool size_given; - uint32_t mer_len_arg; - bool mer_len_given; - double fpr_arg; - bool fpr_given; - bool canonical_flag; - uint32_t threads_arg; - bool threads_given; - const char * output_arg; - bool output_given; - uint32_t Files_arg; - bool Files_given; - const char * generator_arg; - bool generator_given; - uint32_t Generators_arg; - bool Generators_given; - const char * shell_arg; - bool shell_given; - const char * timing_arg; - bool timing_given; - ::std::vector file_arg; - typedef ::std::vector::iterator file_arg_it; - typedef ::std::vector::const_iterator file_arg_const_it; - - enum { - START_OPT = 1000, - TIMING_OPT - }; - - bc_main_cmdline() : - size_arg(0), size_given(false), - mer_len_arg(0), mer_len_given(false), - fpr_arg((double)0.001), fpr_given(false), - canonical_flag(false), - threads_arg((uint32_t)1), threads_given(false), - output_arg("mer_bloom_filter"), output_given(false), - Files_arg((uint32_t)1), Files_given(false), - generator_arg(""), generator_given(false), - Generators_arg((uint32_t)1), Generators_given(false), - shell_arg(""), shell_given(false), - timing_arg(""), timing_given(false), - file_arg() - { } - - bc_main_cmdline(int argc, char* argv[]) : - size_arg(0), size_given(false), - mer_len_arg(0), mer_len_given(false), - fpr_arg((double)0.001), fpr_given(false), - canonical_flag(false), - threads_arg((uint32_t)1), threads_given(false), - output_arg("mer_bloom_filter"), output_given(false), - Files_arg((uint32_t)1), Files_given(false), - generator_arg(""), generator_given(false), - Generators_arg((uint32_t)1), Generators_given(false), - shell_arg(""), shell_given(false), - timing_arg(""), timing_given(false), - file_arg() - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"size", 1, 0, 's'}, - {"mer-len", 1, 0, 'm'}, - {"fpr", 1, 0, 'f'}, - {"canonical", 0, 0, 'C'}, - {"threads", 1, 0, 't'}, - {"output", 1, 0, 'o'}, - {"Files", 1, 0, 'F'}, - {"generator", 1, 0, 'g'}, - {"Generators", 1, 0, 'G'}, - {"shell", 1, 0, 'S'}, - {"timing", 1, 0, TIMING_OPT}, - {"help", 0, 0, 'h'}, - {"usage", 0, 0, 'U'}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVUs:m:f:Ct:o:F:g:G:S:"; - - ::std::string err; -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case 'U': - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case 's': - size_given = true; - size_arg = conv_uint((const char*)optarg, err, true); - CHECK_ERR(uint64_t, optarg, "-s, --size=uint64") - break; - case 'm': - mer_len_given = true; - mer_len_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-m, --mer-len=uint32") - break; - case 'f': - fpr_given = true; - fpr_arg = conv_double((const char*)optarg, err, false); - CHECK_ERR(double_t, optarg, "-f, --fpr=double") - break; - case 'C': - canonical_flag = true; - break; - case 't': - threads_given = true; - threads_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-t, --threads=uint32") - break; - case 'o': - output_given = true; - output_arg = optarg; - break; - case 'F': - Files_given = true; - Files_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-F, --Files=uint32") - break; - case 'g': - generator_given = true; - generator_arg = optarg; - break; - case 'G': - Generators_given = true; - Generators_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-G, --Generators=uint32") - break; - case 'S': - shell_given = true; - shell_arg = optarg; - break; - case TIMING_OPT: - timing_given = true; - timing_arg = optarg; - break; - } - } - - // Check that required switches are present - if(!size_given) - error("[-s, --size=uint64] required switch"); - if(!mer_len_given) - error("[-m, --mer-len=uint32] required switch"); - - // Parse arguments - if(argc - optind < 0) - error("Requires at least 0 argument."); - for( ; optind < argc; ++optind) { - file_arg.push_back(argv[optind]); - } - } - static const char * usage() { return "Usage: jellyfish bc [options] file:path+"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Create a bloom filter from the input k-mers\n\nHere, a bloom filter is a data structure than can tell if\n" \ - "a k-mer has been since 0 times, once, or at least twice. The data\n" \ - "structure is very memory efficient but has some probability of error.\n" \ - "\n" \ - "After creating the bloom filter, it can be passed to the count\n" \ - "subcommand to avoid counting most k-mers which occur only once.\n\n" - "Options (default value in (), *required):\n" - " -s, --size=uint64 *Expected number of k-mers in input\n" - " -m, --mer-len=uint32 *Length of mer\n" - " -f, --fpr=double False positive rate (0.001)\n" - " -C, --canonical Count both strand, canonical representation (false)\n" - " -t, --threads=uint32 Number of threads (1)\n" - " -o, --output=string Output file (mer_bloom_filter)\n" - " -F, --Files=uint32 Number files open simultaneously (1)\n" - " -g, --generator=path File of commands generating fast[aq]\n" - " -G, --Generators=uint32 Number of generators run simultaneously (1)\n" - " -S, --shell=string Shell used to run generator commands ($SHELL or /bin/sh)\n" - " --timing=Timing file Print timing information\n" - " -U, --usage Usage\n" - " -h, --help This message\n" - " -V, --version Version"; - } - static const char* hidden() { return ""; } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "size_given:" << size_given << " size_arg:" << size_arg << "\n"; - os << "mer_len_given:" << mer_len_given << " mer_len_arg:" << mer_len_arg << "\n"; - os << "fpr_given:" << fpr_given << " fpr_arg:" << fpr_arg << "\n"; - os << "canonical_flag:" << canonical_flag << "\n"; - os << "threads_given:" << threads_given << " threads_arg:" << threads_arg << "\n"; - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - os << "Files_given:" << Files_given << " Files_arg:" << Files_arg << "\n"; - os << "generator_given:" << generator_given << " generator_arg:" << generator_arg << "\n"; - os << "Generators_given:" << Generators_given << " Generators_arg:" << Generators_arg << "\n"; - os << "shell_given:" << shell_given << " shell_arg:" << shell_arg << "\n"; - os << "timing_given:" << timing_given << " timing_arg:" << timing_arg << "\n"; - os << "file_arg:" << vec_str(file_arg) << "\n"; - } -}; -#endif // __BC_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/sub_commands/cite_main.cc b/src/modifiedJellyfish/sub_commands/cite_main.cc deleted file mode 100644 index 06481a4c..00000000 --- a/src/modifiedJellyfish/sub_commands/cite_main.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -const char *cite = - "A fast, lock-free approach for efficient parallel counting of occurrences of k-mers\n" - "Guillaume Marcais; Carl Kingsford\n" - "Bioinformatics (2011) 27(6): 764-770 first published online January 7, 2011 doi:10.1093/bioinformatics/btr011\n"; - -const char *url = - "http://www.cbcb.umd.edu/software/jellyfish\n" - "http://bioinformatics.oxfordjournals.org/content/early/2011/01/07/bioinformatics.btr011"; - -const char *bibtex = - "@article{Jellyfish2010,\n" - " author = {Mar\\c{c}ais, Guillaume and Kingsford, Carl},\n" - " title = {A fast, lock-free approach for efficient parallel counting of occurrences of k-mers},\n" - " volume = {27},\n" - " number = {6},\n" - " pages = {764-770},\n" - " year = {2011},\n" - " doi = {10.1093/bioinformatics/btr011},\n" - " URL = {http://bioinformatics.oxfordjournals.org/content/27/6/764.abstract},\n" - " eprint = {http://bioinformatics.oxfordjournals.org/content/27/6/764.full.pdf+html},\n" - " journal = {Bioinformatics}\n" - "}"; - -#include -#include -#include -#include -#include -#include -#include - -namespace err = jellyfish::err; - -int cite_main(int argc, char *argv[]) -{ - cite_main_cmdline args(argc, argv); - - ofstream_default out(args.output_given ? args.output_arg : 0, std::cout); - if(!out.good()) - err::die(err::msg() << "Can't open output file '" << args.output_arg << "'"); - - if(args.bibtex_flag) { - out << bibtex << std::endl; - } else { - out << "This software has been published. If you use it for your research, cite:\n\n" - << cite << "\n\n" << url << std::endl; - } - out.close(); - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/cite_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/cite_main_cmdline.hpp deleted file mode 100644 index aada76f8..00000000 --- a/src/modifiedJellyfish/sub_commands/cite_main_cmdline.hpp +++ /dev/null @@ -1,413 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __CITE_MAIN_CMDLINE_HPP__ -#define __CITE_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class cite_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - bool bibtex_flag; - const char * output_arg; - bool output_given; - - enum { - START_OPT = 1000 - }; - - cite_main_cmdline() : - bibtex_flag(false), - output_arg(""), output_given(false) - { } - - cite_main_cmdline(int argc, char* argv[]) : - bibtex_flag(false), - output_arg(""), output_given(false) - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"bibtex", 0, 0, 'b'}, - {"output", 1, 0, 'o'}, - {"help", 0, 0, 'h'}, - {"usage", 0, 0, 'U'}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVUbo:"; - -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case 'U': - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case 'b': - bibtex_flag = true; - break; - case 'o': - output_given = true; - output_arg = optarg; - break; - } - } - - // Parse arguments - if(argc - optind != 0) - error("Requires exactly 0 argument."); - } - static const char * usage() { return "Usage: jellyfish cite [options]"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "How to cite Jellyfish's paper\n\nCitation of paper\n\n" - "Options (default value in (), *required):\n" - " -b, --bibtex Bibtex format (false)\n" - " -o, --output=string Output file\n" - " -U, --usage Usage\n" - " -h, --help This message\n" - " -V, --version Version"; - } - static const char* hidden() { return ""; } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "bibtex_flag:" << bibtex_flag << "\n"; - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - } -}; -#endif // __CITE_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/sub_commands/count_main.cc b/src/modifiedJellyfish/sub_commands/count_main.cc deleted file mode 100644 index cdfc7f4d..00000000 --- a/src/modifiedJellyfish/sub_commands/count_main.cc +++ /dev/null @@ -1,354 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static count_main_cmdline args; // Command line switches and arguments - -namespace err = jellyfish::err; - -using std::chrono::system_clock; -using std::chrono::duration; -using std::chrono::duration_cast; - -template -inline double as_seconds(DtnType dtn) { return duration_cast>(dtn).count(); } - -using jellyfish::mer_dna; -using jellyfish::mer_dna_bloom_counter; -using jellyfish::mer_dna_bloom_filter; -typedef std::vector file_vector; - -// Types for parsing arbitrary sequence ignoring quality scores -typedef jellyfish::mer_overlap_sequence_parser > sequence_parser; -typedef jellyfish::mer_iterator mer_iterator; - -// Types for parsing reads with quality score. Interface match type -// above. -class sequence_qual_parser : - public jellyfish::whole_sequence_parser > -{ - typedef jellyfish::stream_manager StreamIterator; - typedef jellyfish::whole_sequence_parser super; -public: - sequence_qual_parser(uint16_t mer_len, uint32_t max_producers, uint32_t size, size_t buf_size, - StreamIterator& streams) : - super(size, 100, max_producers, streams) - { } -}; - -class mer_qual_iterator : public jellyfish::mer_qual_iterator { - typedef jellyfish::mer_qual_iterator super; -public: - mer_qual_iterator(sequence_qual_parser& parser, bool canonical = false) : - super(parser, args.min_qual_char_arg[0], canonical) - { } -}; - -// k-mer filters. Organized in a linked list, interpreted as a && -// (logical and). I.e. all filter must return true for the result to -// be true. By default, filter returns true. -struct filter { - filter* prev_; - filter(filter* prev = 0) : prev_(prev) { } - virtual ~filter() { } - virtual bool operator()(const mer_dna& x) { return and_res(true, x); } - bool and_res(bool r, const mer_dna& x) const { - return r ? (prev_ ? (*prev_)(x) : true) : false; - } -}; - -struct filter_bc : public filter { - const mer_dna_bloom_counter& counter_; - filter_bc(const mer_dna_bloom_counter& counter, filter* prev = 0) : - filter(prev), - counter_(counter) - { } - bool operator()(const mer_dna& m) { - unsigned int c = counter_.check(m); - return and_res(c > 1, m); - } -}; - -struct filter_bf : public filter { - mer_dna_bloom_filter& bf_; - filter_bf(mer_dna_bloom_filter& bf, filter* prev = 0) : - filter(prev), - bf_(bf) - { } - bool operator()(const mer_dna& m) { - unsigned int c = bf_.insert(m); - return and_res(c > 0, m); - } -}; - -enum OPERATION { COUNT, PRIME, UPDATE }; -template -class mer_counter_base : public jellyfish::thread_exec { - int nb_threads_; - mer_hash& ary_; - jellyfish::stream_manager streams_; - ParserType parser_; - filter* filter_; - OPERATION op_; - -public: - mer_counter_base(int nb_threads, mer_hash& ary, - PathIterator file_begin, PathIterator file_end, - PathIterator pipe_begin, PathIterator pipe_end, - uint32_t concurent_files, - OPERATION op, filter* filter = new struct filter) : - ary_(ary), - streams_(file_begin, file_end, pipe_begin, pipe_end, concurent_files), - parser_(mer_dna::k(), streams_.nb_streams(), 3 * nb_threads, 4096, streams_), - filter_(filter), - op_(op) - { } - - virtual void start(int thid) { - size_t count = 0; - MerIteratorType mers(parser_, args.canonical_flag); - - switch(op_) { - case COUNT: - for( ; mers; ++mers) { - if((*filter_)(*mers)) - ary_.add(*mers, 1); - ++count; - } - break; - - case PRIME: - for( ; mers; ++mers) { - if((*filter_)(*mers)) - ary_.set(*mers); - ++count; - } - break; - - case UPDATE: - mer_dna tmp; - for( ; mers; ++mers) { - if((*filter_)(*mers)) - ary_.update_add(*mers, 1, tmp); - ++count; - } - break; - } - - ary_.done(); - } -}; - -// Counter with and without quality value -typedef mer_counter_base mer_counter; -typedef mer_counter_base mer_qual_counter; - -mer_dna_bloom_counter* load_bloom_filter(const char* path) { - std::ifstream in(path, std::ios::in|std::ios::binary); - jellyfish::file_header header(in); - if(!in.good()) - err::die(err::msg() << "Failed to parse bloom filter file '" << path << "'"); - if(header.format() != "bloomcounter") - err::die(err::msg() << "Invalid format '" << header.format() << "'. Expected 'bloomcounter'"); - if(header.key_len() != mer_dna::k() * 2) - err::die("Invalid mer length in bloom filter"); - jellyfish::hash_pair fns(header.matrix(1), header.matrix(2)); - auto res = new mer_dna_bloom_counter(header.size(), header.nb_hashes(), in, fns); - if(!in.good()) - err::die("Bloom filter file is truncated"); - in.close(); - return res; -} - -// If get a termination signal, kill the manager and then kill myself. -static pid_t manager_pid = 0; -static void signal_handler(int sig) { - if(manager_pid) - kill(manager_pid, SIGTERM); - signal(sig, SIG_DFL); - kill(getpid(), sig); - _exit(EXIT_FAILURE); // Should not be reached -} - -int count_main(int argc, char *argv[]) -{ - auto start_time = system_clock::now(); - - jellyfish::file_header header; - header.fill_standard(); - header.set_cmdline(argc, argv); - - args.parse(argc, argv); - - if(args.min_qual_char_given && args.min_qual_char_arg.size() != 1) - count_main_cmdline::error("[-Q, --min-qual-char] must be one character."); - - mer_dna::k(args.mer_len_arg); - - std::unique_ptr generator_manager; - if(args.generator_given) { - auto gm = - new jellyfish::generator_manager(args.generator_arg, args.Generators_arg, - args.shell_given ? args.shell_arg : (const char*)0); - generator_manager.reset(gm); - generator_manager->start(); - manager_pid = generator_manager->pid(); - struct sigaction act; - memset(&act, '\0', sizeof(act)); - act.sa_handler = signal_handler; - assert(sigaction(SIGTERM, &act, 0) == 0); - } - - header.canonical(args.canonical_flag); - mer_hash ary(args.size_arg, args.mer_len_arg * 2, args.counter_len_arg, args.threads_arg, args.reprobes_arg); - if(args.disk_flag) - ary.do_size_doubling(false); - - std::auto_ptr > dumper; - if(args.text_flag) - dumper.reset(new text_dumper(args.threads_arg, args.output_arg, &header)); - else - dumper.reset(new binary_dumper(args.out_counter_len_arg, ary.key_len(), args.threads_arg, args.output_arg, &header)); - ary.dumper(dumper.get()); - - auto after_init_time = system_clock::now(); - - OPERATION do_op = COUNT; - if(args.if_given) { - mer_counter counter(args.threads_arg, ary, - args.if_arg.begin(), args.if_arg.end(), - args.if_arg.end(), args.if_arg.end(), // no multi pipes - args.Files_arg, PRIME); - counter.exec_join(args.threads_arg); - do_op = UPDATE; - } - - // Iterators to the multi pipe paths. If no generator manager, - // generate an empty range. - auto pipes_begin = generator_manager.get() ? generator_manager->pipes().begin() : args.file_arg.end(); - auto pipes_end = (bool)generator_manager ? generator_manager->pipes().end() : args.file_arg.end(); - - // Bloom counter read from file to filter out low frequency - // k-mers. Two pass algorithm. - std::unique_ptr mer_filter(new filter); - std::unique_ptr bc; - if(args.bc_given) { - bc.reset(load_bloom_filter(args.bc_arg)); - mer_filter.reset(new filter_bc(*bc)); - } - - // Bloom filter to filter out low frequency k-mers. One pass - // algorithm. - std::unique_ptr bf; - if(args.bf_size_given) { - bf.reset(new mer_dna_bloom_filter(args.bf_fp_arg, args.bf_size_arg)); - mer_filter.reset(new filter_bf(*bf)); - } - - if(args.min_qual_char_given) { - mer_qual_counter counter(args.threads_arg, ary, - args.file_arg.begin(), args.file_arg.end(), - pipes_begin, pipes_end, - args.Files_arg, - do_op, mer_filter.get()); - counter.exec_join(args.threads_arg); - } else { - mer_counter counter(args.threads_arg, ary, - args.file_arg.begin(), args.file_arg.end(), - pipes_begin, pipes_end, - args.Files_arg, - do_op, mer_filter.get()); - counter.exec_join(args.threads_arg); - } - - // If we have a manager, wait for it - if(generator_manager) { - signal(SIGTERM, SIG_DFL); - manager_pid = 0; - if(!generator_manager->wait()) - err::die("Some generator commands failed"); - generator_manager.reset(); - } - - auto after_count_time = system_clock::now(); - - // If no intermediate files, dump directly into output file. If not, will do a round of merging - if(!args.no_write_flag) { - if(dumper->nb_files() == 0) { - dumper->one_file(true); - if(args.lower_count_given) - dumper->min(args.lower_count_arg); - if(args.upper_count_given) - dumper->max(args.upper_count_arg); - dumper->dump(ary.ary()); - } else { - dumper->dump(ary.ary()); - if(!args.no_merge_flag) { - std::vector files = dumper->file_names_cstr(); - uint64_t min = args.lower_count_given ? args.lower_count_arg : 0; - uint64_t max = args.upper_count_given ? args.upper_count_arg : std::numeric_limits::max(); - try { - merge_files(files, args.output_arg, header, min, max); - } catch(MergeError e) { - err::die(err::msg() << e.what()); - } - if(!args.no_unlink_flag) { - for(int i =0; i < dumper->nb_files(); ++i) - unlink(files[i]); - } - } // if(!args.no_merge_flag - } // if(!args.no_merge_flag - } - - auto after_dump_time = system_clock::now(); - - if(args.timing_given) { - std::ofstream timing_file(args.timing_arg); - timing_file << "Init " << as_seconds(after_init_time - start_time) << "\n" - << "Counting " << as_seconds(after_count_time - after_init_time) << "\n" - << "Writing " << as_seconds(after_dump_time - after_count_time) << "\n"; - } - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/count_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/count_main_cmdline.hpp deleted file mode 100644 index 93c633b0..00000000 --- a/src/modifiedJellyfish/sub_commands/count_main_cmdline.hpp +++ /dev/null @@ -1,711 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __COUNT_MAIN_CMDLINE_HPP__ -#define __COUNT_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class count_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - uint32_t mer_len_arg; - bool mer_len_given; - uint64_t size_arg; - bool size_given; - uint32_t threads_arg; - bool threads_given; - uint32_t Files_arg; - bool Files_given; - const char * generator_arg; - bool generator_given; - uint32_t Generators_arg; - bool Generators_given; - const char * shell_arg; - bool shell_given; - const char * output_arg; - bool output_given; - uint32_t counter_len_arg; - bool counter_len_given; - uint32_t out_counter_len_arg; - bool out_counter_len_given; - bool canonical_flag; - const char * bc_arg; - bool bc_given; - uint64_t bf_size_arg; - bool bf_size_given; - double bf_fp_arg; - bool bf_fp_given; - ::std::vector if_arg; - typedef ::std::vector::iterator if_arg_it; - typedef ::std::vector::const_iterator if_arg_const_it; - bool if_given; - string min_qual_char_arg; - bool min_qual_char_given; - uint32_t reprobes_arg; - bool reprobes_given; - bool text_flag; - bool disk_flag; - bool no_merge_flag; - bool no_unlink_flag; - uint64_t lower_count_arg; - bool lower_count_given; - uint64_t upper_count_arg; - bool upper_count_given; - const char * timing_arg; - bool timing_given; - bool no_write_flag; - ::std::vector file_arg; - typedef ::std::vector::iterator file_arg_it; - typedef ::std::vector::const_iterator file_arg_const_it; - - enum { - START_OPT = 1000, - FULL_HELP_OPT, - USAGE_OPT, - OUT_COUNTER_LEN_OPT, - BC_OPT, - BF_SIZE_OPT, - BF_FP_OPT, - IF_OPT, - TEXT_OPT, - DISK_OPT, - NO_MERGE_OPT, - NO_UNLINK_OPT, - TIMING_OPT, - NO_WRITE_OPT - }; - - count_main_cmdline() : - mer_len_arg(0), mer_len_given(false), - size_arg(0), size_given(false), - threads_arg((uint32_t)1), threads_given(false), - Files_arg((uint32_t)1), Files_given(false), - generator_arg(""), generator_given(false), - Generators_arg((uint32_t)1), Generators_given(false), - shell_arg(""), shell_given(false), - output_arg("mer_counts.jf"), output_given(false), - counter_len_arg((uint32_t)7), counter_len_given(false), - out_counter_len_arg((uint32_t)4), out_counter_len_given(false), - canonical_flag(false), - bc_arg(""), bc_given(false), - bf_size_arg(0), bf_size_given(false), - bf_fp_arg((double)0.01), bf_fp_given(false), - if_arg(), if_given(false), - min_qual_char_arg(""), min_qual_char_given(false), - reprobes_arg((uint32_t)126), reprobes_given(false), - text_flag(false), - disk_flag(false), - no_merge_flag(false), - no_unlink_flag(false), - lower_count_arg(0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - timing_arg(""), timing_given(false), - no_write_flag(false), - file_arg() - { } - - count_main_cmdline(int argc, char* argv[]) : - mer_len_arg(0), mer_len_given(false), - size_arg(0), size_given(false), - threads_arg((uint32_t)1), threads_given(false), - Files_arg((uint32_t)1), Files_given(false), - generator_arg(""), generator_given(false), - Generators_arg((uint32_t)1), Generators_given(false), - shell_arg(""), shell_given(false), - output_arg("mer_counts.jf"), output_given(false), - counter_len_arg((uint32_t)7), counter_len_given(false), - out_counter_len_arg((uint32_t)4), out_counter_len_given(false), - canonical_flag(false), - bc_arg(""), bc_given(false), - bf_size_arg(0), bf_size_given(false), - bf_fp_arg((double)0.01), bf_fp_given(false), - if_arg(), if_given(false), - min_qual_char_arg(""), min_qual_char_given(false), - reprobes_arg((uint32_t)126), reprobes_given(false), - text_flag(false), - disk_flag(false), - no_merge_flag(false), - no_unlink_flag(false), - lower_count_arg(0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - timing_arg(""), timing_given(false), - no_write_flag(false), - file_arg() - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"mer-len", 1, 0, 'm'}, - {"size", 1, 0, 's'}, - {"threads", 1, 0, 't'}, - {"Files", 1, 0, 'F'}, - {"generator", 1, 0, 'g'}, - {"Generators", 1, 0, 'G'}, - {"shell", 1, 0, 'S'}, - {"output", 1, 0, 'o'}, - {"counter-len", 1, 0, 'c'}, - {"out-counter-len", 1, 0, OUT_COUNTER_LEN_OPT}, - {"canonical", 0, 0, 'C'}, - {"bc", 1, 0, BC_OPT}, - {"bf-size", 1, 0, BF_SIZE_OPT}, - {"bf-fp", 1, 0, BF_FP_OPT}, - {"if", 1, 0, IF_OPT}, - {"min-qual-char", 1, 0, 'Q'}, - {"reprobes", 1, 0, 'p'}, - {"text", 0, 0, TEXT_OPT}, - {"disk", 0, 0, DISK_OPT}, - {"no-merge", 0, 0, NO_MERGE_OPT}, - {"no-unlink", 0, 0, NO_UNLINK_OPT}, - {"lower-count", 1, 0, 'L'}, - {"upper-count", 1, 0, 'U'}, - {"timing", 1, 0, TIMING_OPT}, - {"no-write", 0, 0, NO_WRITE_OPT}, - {"help", 0, 0, 'h'}, - {"full-help", 0, 0, FULL_HELP_OPT}, - {"usage", 0, 0, USAGE_OPT}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVm:s:t:F:g:G:S:o:c:CQ:p:L:U:"; - - ::std::string err; -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case USAGE_OPT: - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case FULL_HELP_OPT: - ::std::cout << usage() << "\n\n" << help() << "\n\n" << hidden() << std::flush; - exit(0); - case 'm': - mer_len_given = true; - mer_len_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-m, --mer-len=uint32") - break; - case 's': - size_given = true; - size_arg = conv_uint((const char*)optarg, err, true); - CHECK_ERR(uint64_t, optarg, "-s, --size=uint64") - break; - case 't': - threads_given = true; - threads_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-t, --threads=uint32") - break; - case 'F': - Files_given = true; - Files_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-F, --Files=uint32") - break; - case 'g': - generator_given = true; - generator_arg = optarg; - break; - case 'G': - Generators_given = true; - Generators_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-G, --Generators=uint32") - break; - case 'S': - shell_given = true; - shell_arg = optarg; - break; - case 'o': - output_given = true; - output_arg = optarg; - break; - case 'c': - counter_len_given = true; - counter_len_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-c, --counter-len=Length in bits") - break; - case OUT_COUNTER_LEN_OPT: - out_counter_len_given = true; - out_counter_len_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, " --out-counter-len=Length in bytes") - break; - case 'C': - canonical_flag = true; - break; - case BC_OPT: - bc_given = true; - bc_arg = optarg; - break; - case BF_SIZE_OPT: - bf_size_given = true; - bf_size_arg = conv_uint((const char*)optarg, err, true); - CHECK_ERR(uint64_t, optarg, " --bf-size=uint64") - break; - case BF_FP_OPT: - bf_fp_given = true; - bf_fp_arg = conv_double((const char*)optarg, err, false); - CHECK_ERR(double_t, optarg, " --bf-fp=double") - break; - case IF_OPT: - if_given = true; - if_arg.push_back(optarg); - break; - case 'Q': - min_qual_char_given = true; - min_qual_char_arg.assign(optarg); - break; - case 'p': - reprobes_given = true; - reprobes_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-p, --reprobes=uint32") - break; - case TEXT_OPT: - text_flag = true; - break; - case DISK_OPT: - disk_flag = true; - break; - case NO_MERGE_OPT: - no_merge_flag = true; - break; - case NO_UNLINK_OPT: - no_unlink_flag = true; - break; - case 'L': - lower_count_given = true; - lower_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-L, --lower-count=uint64") - break; - case 'U': - upper_count_given = true; - upper_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-U, --upper-count=uint64") - break; - case TIMING_OPT: - timing_given = true; - timing_arg = optarg; - break; - case NO_WRITE_OPT: - no_write_flag = true; - break; - } - } - - // Check that required switches are present - if(!mer_len_given) - error("[-m, --mer-len=uint32] required switch"); - if(!size_given) - error("[-s, --size=uint64] required switch"); - - // Check mutually exlusive switches - if(bf_size_given && bc_given) - error("Switches [ --bf-size=uint64] and [ --bc=peath] are mutually exclusive"); - - // Parse arguments - if(argc - optind < 0) - error("Requires at least 0 argument."); - for( ; optind < argc; ++optind) { - file_arg.push_back(argv[optind]); - } - } - static const char * usage() { return "Usage: jellyfish count [options] file:path+"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Count k-mers in fasta or fastq files\n\n" - "Options (default value in (), *required):\n" - " -m, --mer-len=uint32 *Length of mer\n" - " -s, --size=uint64 *Initial hash size\n" - " -t, --threads=uint32 Number of threads (1)\n" - " -F, --Files=uint32 Number files open simultaneously (1)\n" - " -g, --generator=path File of commands generating fast[aq]\n" - " -G, --Generators=uint32 Number of generators run simultaneously (1)\n" - " -S, --shell=string Shell used to run generator commands ($SHELL or /bin/sh)\n" - " -o, --output=string Output file (mer_counts.jf)\n" - " -c, --counter-len=Length in bits Length bits of counting field (7)\n" - " --out-counter-len=Length in bytes Length in bytes of counter field in output (4)\n" - " -C, --canonical Count both strand, canonical representation (false)\n" - " --bc=peath Bloom counter to filter out singleton mers\n" - " --bf-size=uint64 Use bloom filter to count high-frequency mers\n" - " --bf-fp=double False positive rate of bloom filter (0.01)\n" - " --if=path Count only k-mers in this files\n" - " -Q, --min-qual-char=string Any base with quality below this character is changed to N\n" - " -p, --reprobes=uint32 Maximum number of reprobes (126)\n" - " --text Dump in text format (false)\n" - " --disk Disk operation. Do not do size doubling (false)\n" - " -L, --lower-count=uint64 Don't output k-mer with count < lower-count\n" - " -U, --upper-count=uint64 Don't output k-mer with count > upper-count\n" - " --timing=Timing file Print timing information\n" - " --usage Usage\n" - " -h, --help This message\n" - " --full-help Detailed help\n" - " -V, --version Version"; - } - static const char* hidden() { return - "Hidden options:\n" - " --no-merge Do not merge files intermediary files (false)\n" - " --no-unlink Do not unlink intermediary files after automatic merging (false)\n" - " --no-write Don't write database (false)\n" - ""; - } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "mer_len_given:" << mer_len_given << " mer_len_arg:" << mer_len_arg << "\n"; - os << "size_given:" << size_given << " size_arg:" << size_arg << "\n"; - os << "threads_given:" << threads_given << " threads_arg:" << threads_arg << "\n"; - os << "Files_given:" << Files_given << " Files_arg:" << Files_arg << "\n"; - os << "generator_given:" << generator_given << " generator_arg:" << generator_arg << "\n"; - os << "Generators_given:" << Generators_given << " Generators_arg:" << Generators_arg << "\n"; - os << "shell_given:" << shell_given << " shell_arg:" << shell_arg << "\n"; - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - os << "counter_len_given:" << counter_len_given << " counter_len_arg:" << counter_len_arg << "\n"; - os << "out_counter_len_given:" << out_counter_len_given << " out_counter_len_arg:" << out_counter_len_arg << "\n"; - os << "canonical_flag:" << canonical_flag << "\n"; - os << "bc_given:" << bc_given << " bc_arg:" << bc_arg << "\n"; - os << "bf_size_given:" << bf_size_given << " bf_size_arg:" << bf_size_arg << "\n"; - os << "bf_fp_given:" << bf_fp_given << " bf_fp_arg:" << bf_fp_arg << "\n"; - os << "if_given:" << if_given << " if_arg:" << vec_str(if_arg) << "\n"; - os << "min_qual_char_given:" << min_qual_char_given << " min_qual_char_arg:" << min_qual_char_arg << "\n"; - os << "reprobes_given:" << reprobes_given << " reprobes_arg:" << reprobes_arg << "\n"; - os << "text_flag:" << text_flag << "\n"; - os << "disk_flag:" << disk_flag << "\n"; - os << "no_merge_flag:" << no_merge_flag << "\n"; - os << "no_unlink_flag:" << no_unlink_flag << "\n"; - os << "lower_count_given:" << lower_count_given << " lower_count_arg:" << lower_count_arg << "\n"; - os << "upper_count_given:" << upper_count_given << " upper_count_arg:" << upper_count_arg << "\n"; - os << "timing_given:" << timing_given << " timing_arg:" << timing_arg << "\n"; - os << "no_write_flag:" << no_write_flag << "\n"; - os << "file_arg:" << vec_str(file_arg) << "\n"; - } -}; -#endif // __COUNT_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/sub_commands/dump_main.cc b/src/modifiedJellyfish/sub_commands/dump_main.cc deleted file mode 100644 index 4acf3da0..00000000 --- a/src/modifiedJellyfish/sub_commands/dump_main.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace err = jellyfish::err; - -static dump_main_cmdline args; // Command line switches and arguments - -template -void dump(iterator& it, std::ostream &out, - uint64_t lower_count, uint64_t upper_count) { - if(args.column_flag) { - char spacer = args.tab_flag ? '\t' : ' '; - while(it.next()) { - if(it.val() < lower_count || it.val() > upper_count) - continue; - out << it.key() << spacer << it.val() << "\n"; - } - } else { - while(it.next()) { - if(it.val() < lower_count || it.val() > upper_count) - continue; - out << ">" << it.val() << "\n" << it.key() << "\n"; - } - } -} - -int dump_main(int argc, char *argv[]) -{ - args.parse(argc, argv); - std::ios::sync_with_stdio(false); // No sync with stdio -> faster - - ofstream_default out(args.output_given ? args.output_arg : 0, std::cout); - if(!out.good()) - err::die(err::msg() << "Error opening output file '" << args.output_arg << "'"); - - std::ifstream is(args.db_arg); - if(!is.good()) - err::die(err::msg() << "Failed to open input file '" << args.db_arg << "'"); - jellyfish::file_header header; - header.read(is); - jellyfish::mer_dna::k(header.key_len() / 2); - - if(!args.lower_count_given) - args.lower_count_arg = 0; - if(!args.upper_count_given) - args.upper_count_arg = std::numeric_limits::max(); - - if(!header.format().compare(binary_dumper::format)) { - binary_reader reader(is, &header); - dump(reader, out, args.lower_count_arg, args.upper_count_arg); - } else if(!header.format().compare(text_dumper::format)) { - text_reader reader(is, &header); - dump(reader, out, args.lower_count_arg, args.upper_count_arg); - } else { - err::die(err::msg() << "Unknown format '" << header.format() << "'"); - } - - out.close(); - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/dump_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/dump_main_cmdline.hpp deleted file mode 100644 index 15b56bdd..00000000 --- a/src/modifiedJellyfish/sub_commands/dump_main_cmdline.hpp +++ /dev/null @@ -1,456 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __DUMP_MAIN_CMDLINE_HPP__ -#define __DUMP_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class dump_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - bool column_flag; - bool tab_flag; - uint64_t lower_count_arg; - bool lower_count_given; - uint64_t upper_count_arg; - bool upper_count_given; - const char * output_arg; - bool output_given; - const char * db_arg; - - enum { - START_OPT = 1000, - USAGE_OPT - }; - - dump_main_cmdline() : - column_flag(false), - tab_flag(false), - lower_count_arg(0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - output_arg(""), output_given(false), - db_arg("") - { } - - dump_main_cmdline(int argc, char* argv[]) : - column_flag(false), - tab_flag(false), - lower_count_arg(0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - output_arg(""), output_given(false), - db_arg("") - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"column", 0, 0, 'c'}, - {"tab", 0, 0, 't'}, - {"lower-count", 1, 0, 'L'}, - {"upper-count", 1, 0, 'U'}, - {"output", 1, 0, 'o'}, - {"help", 0, 0, 'h'}, - {"usage", 0, 0, USAGE_OPT}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVctL:U:o:"; - - ::std::string err; -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case USAGE_OPT: - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case 'c': - column_flag = true; - break; - case 't': - tab_flag = true; - break; - case 'L': - lower_count_given = true; - lower_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-L, --lower-count=uint64") - break; - case 'U': - upper_count_given = true; - upper_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-U, --upper-count=uint64") - break; - case 'o': - output_given = true; - output_arg = optarg; - break; - } - } - - // Parse arguments - if(argc - optind != 1) - error("Requires exactly 1 argument."); - db_arg = argv[optind]; - ++optind; - } - static const char * usage() { return "Usage: jellyfish dump [options] db:path"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Dump k-mer counts\n\nBy default, dump in a fasta format where the header is the count and\n" \ - "the sequence is the sequence of the k-mer. The column format is a 2\n" \ - "column output: k-mer count.\n\n" - "Options (default value in (), *required):\n" - " -c, --column Column format (false)\n" - " -t, --tab Tab separator (false)\n" - " -L, --lower-count=uint64 Don't output k-mer with count < lower-count\n" - " -U, --upper-count=uint64 Don't output k-mer with count > upper-count\n" - " -o, --output=string Output file\n" - " --usage Usage\n" - " -h, --help This message\n" - " -V, --version Version"; - } - static const char* hidden() { return ""; } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "column_flag:" << column_flag << "\n"; - os << "tab_flag:" << tab_flag << "\n"; - os << "lower_count_given:" << lower_count_given << " lower_count_arg:" << lower_count_arg << "\n"; - os << "upper_count_given:" << upper_count_given << " upper_count_arg:" << upper_count_arg << "\n"; - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - os << "db_arg:" << db_arg << "\n"; - } -}; -#endif // __DUMP_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/sub_commands/histo_main.cc b/src/modifiedJellyfish/sub_commands/histo_main.cc deleted file mode 100644 index b971841f..00000000 --- a/src/modifiedJellyfish/sub_commands/histo_main.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace err = jellyfish::err; - -template -void compute_histo(reader_type& reader, const uint64_t base, const uint64_t ceil, - uint64_t* histo, const uint64_t nb_buckets, const uint64_t inc) { - while(reader.next()) { - if(reader.val() < base) - ++histo[0]; - else if(reader.val() > ceil) - ++histo[nb_buckets - 1]; - else - ++histo[(reader.val() - base) / inc]; - } -} - - -int histo_main(int argc, char *argv[]) -{ - histo_main_cmdline args(argc, argv); - - std::ifstream is(args.db_arg); - if(!is.good()) - err::die(err::msg() << "Failed to open input file '" << args.db_arg << "'"); - jellyfish::file_header header; - header.read(is); - jellyfish::mer_dna::k(header.key_len() / 2); - - if(args.high_arg < args.low_arg) - histo_main_cmdline::error("High count value must be >= to low count value"); - ofstream_default out(args.output_given ? args.output_arg : 0, std::cout); - if(!out.good()) - err::die(err::msg() << "Error opening output file '" << args.output_arg << "'"); - - const uint64_t base = args.increment_arg >= args.low_arg ? 0 : args.low_arg - args.increment_arg; - const uint64_t ceil = args.high_arg + args.increment_arg; - const uint64_t inc = args.increment_arg; - - const uint64_t nb_buckets = (ceil + inc - base) / inc; - uint64_t* histo = new uint64_t[nb_buckets]; - memset(histo, '\0', sizeof(uint64_t) * nb_buckets); - - if(!header.format().compare(binary_dumper::format)) { - binary_reader reader(is, &header); - compute_histo(reader, base, ceil, histo, nb_buckets, inc); - } else if(!header.format().compare(text_dumper::format)) { - text_reader reader(is, &header); - compute_histo(reader, base, ceil, histo, nb_buckets, inc); - } else { - err::die(err::msg() << "Unknown format '" << header.format() << "'"); - } - - for(uint64_t i = 0, col = base; i < nb_buckets; ++i, col += inc) - if(histo[i] > 0 || args.full_flag) - out << col << " " << histo[i] << "\n"; - - delete [] histo; - out.close(); - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/histo_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/histo_main_cmdline.hpp deleted file mode 100644 index deade1ab..00000000 --- a/src/modifiedJellyfish/sub_commands/histo_main_cmdline.hpp +++ /dev/null @@ -1,506 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __HISTO_MAIN_CMDLINE_HPP__ -#define __HISTO_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class histo_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - uint64_t low_arg; - bool low_given; - uint64_t high_arg; - bool high_given; - uint64_t increment_arg; - bool increment_given; - uint32_t threads_arg; - bool threads_given; - bool full_flag; - const char * output_arg; - bool output_given; - uint64_t buffer_size_arg; - bool buffer_size_given; - bool verbose_flag; - const char * db_arg; - - enum { - START_OPT = 1000, - FULL_HELP_OPT, - HELP_OPT - }; - - histo_main_cmdline() : - low_arg((uint64_t)1), low_given(false), - high_arg((uint64_t)10000), high_given(false), - increment_arg((uint64_t)1), increment_given(false), - threads_arg((uint32_t)1), threads_given(false), - full_flag(false), - output_arg(""), output_given(false), - buffer_size_arg((uint64_t)10000000), buffer_size_given(false), - verbose_flag(false), - db_arg("") - { } - - histo_main_cmdline(int argc, char* argv[]) : - low_arg((uint64_t)1), low_given(false), - high_arg((uint64_t)10000), high_given(false), - increment_arg((uint64_t)1), increment_given(false), - threads_arg((uint32_t)1), threads_given(false), - full_flag(false), - output_arg(""), output_given(false), - buffer_size_arg((uint64_t)10000000), buffer_size_given(false), - verbose_flag(false), - db_arg("") - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"low", 1, 0, 'l'}, - {"high", 1, 0, 'h'}, - {"increment", 1, 0, 'i'}, - {"threads", 1, 0, 't'}, - {"full", 0, 0, 'f'}, - {"output", 1, 0, 'o'}, - {"buffer-size", 1, 0, 's'}, - {"verbose", 0, 0, 'v'}, - {"help", 0, 0, HELP_OPT}, - {"full-help", 0, 0, FULL_HELP_OPT}, - {"usage", 0, 0, 'U'}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "VUl:h:i:t:fo:s:v"; - - ::std::string err; -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case HELP_OPT: - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case 'U': - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case FULL_HELP_OPT: - ::std::cout << usage() << "\n\n" << help() << "\n\n" << hidden() << std::flush; - exit(0); - case 'l': - low_given = true; - low_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-l, --low=uint64") - break; - case 'h': - high_given = true; - high_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-h, --high=uint64") - break; - case 'i': - increment_given = true; - increment_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-i, --increment=uint64") - break; - case 't': - threads_given = true; - threads_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-t, --threads=uint32") - break; - case 'f': - full_flag = true; - break; - case 'o': - output_given = true; - output_arg = optarg; - break; - case 's': - buffer_size_given = true; - buffer_size_arg = conv_uint((const char*)optarg, err, true); - CHECK_ERR(uint64_t, optarg, "-s, --buffer-size=Buffer length") - break; - case 'v': - verbose_flag = true; - break; - } - } - - // Parse arguments - if(argc - optind != 1) - error("Requires exactly 1 argument."); - db_arg = argv[optind]; - ++optind; - } - static const char * usage() { return "Usage: jellyfish histo [options] db:path"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Create an histogram of k-mer occurrences\n\nCreate an histogram with the number of k-mers having a given\n" \ - "count. In bucket 'i' are tallied the k-mers which have a count 'c'\n" \ - "satisfying 'low+i*inc <= c < low+(i+1)*inc'. Buckets in the output are\n" \ - "labeled by the low end point (low+i*inc).\n" \ - "\n" \ - "The last bucket in the output behaves as a catchall: it tallies all\n" \ - "k-mers with a count greater or equal to the low end point of this\n" \ - "bucket.\n\n" - "Options (default value in (), *required):\n" - " -l, --low=uint64 Low count value of histogram (1)\n" - " -h, --high=uint64 High count value of histogram (10000)\n" - " -i, --increment=uint64 Increment value for buckets (1)\n" - " -t, --threads=uint32 Number of threads (1)\n" - " -f, --full Full histo. Don't skip count 0. (false)\n" - " -o, --output=string Output file\n" - " -v, --verbose Output information (false)\n" - " -U, --usage Usage\n" - " --help This message\n" - " --full-help Detailed help\n" - " -V, --version Version"; - } - static const char* hidden() { return - "Hidden options:\n" - " -s, --buffer-size=Buffer length Length in bytes of input buffer (10000000)\n" - ""; - } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "low_given:" << low_given << " low_arg:" << low_arg << "\n"; - os << "high_given:" << high_given << " high_arg:" << high_arg << "\n"; - os << "increment_given:" << increment_given << " increment_arg:" << increment_arg << "\n"; - os << "threads_given:" << threads_given << " threads_arg:" << threads_arg << "\n"; - os << "full_flag:" << full_flag << "\n"; - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - os << "buffer_size_given:" << buffer_size_given << " buffer_size_arg:" << buffer_size_arg << "\n"; - os << "verbose_flag:" << verbose_flag << "\n"; - os << "db_arg:" << db_arg << "\n"; - } -}; -#endif // __HISTO_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/sub_commands/info_main.cc b/src/modifiedJellyfish/sub_commands/info_main.cc deleted file mode 100644 index d6cd43ec..00000000 --- a/src/modifiedJellyfish/sub_commands/info_main.cc +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include - -namespace err = jellyfish::err; - -static info_main_cmdline args; - -std::string get_command(const jellyfish::generic_file_header& h) { - std::string cmd(h["exe_path"]); - std::vector cmdline = h.cmdline(); - for(auto it = cmdline.cbegin(); it != cmdline.cend(); ++it) - (cmd += " ") += jellyfish::quote_arg(*it); - - return cmd; -} - -std::string get_where(const jellyfish::generic_file_header& h) { - std::string res(jellyfish::quote_arg(h["hostname"])); - if(!res.empty()) - res += ":"; - res += jellyfish::quote_arg(h["pwd"]); - return res; -} - -int info_main(int argc, char *argv[]) { - args.parse(argc, argv); - - std::ifstream file(args.file_arg); - if(!file.good()) - err::die(err::msg() << "Can't open '" << args.file_arg << "'"); - - jellyfish::file_header header; - header.read(file); - - if(args.skip_flag) - std::cout << file.rdbuf(); - else if(args.json_flag) - std::cout << header; - else if(args.cmd_flag) - std::cout << get_command(header) << "\n"; - else - std::cout << "command: " << get_command(header) << "\n" - << "where: " << get_where(header) << "\n" - << "when: " << header["time"] << "\n" - << "canonical: " << (header.canonical() ? "yes" : "no") << "\n"; - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/info_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/info_main_cmdline.hpp deleted file mode 100644 index db172a45..00000000 --- a/src/modifiedJellyfish/sub_commands/info_main_cmdline.hpp +++ /dev/null @@ -1,436 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __INFO_MAIN_CMDLINE_HPP__ -#define __INFO_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class info_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - bool skip_flag; - bool json_flag; - bool cmd_flag; - const char * file_arg; - - enum { - START_OPT = 1000 - }; - - info_main_cmdline() : - skip_flag(false), - json_flag(false), - cmd_flag(false), - file_arg("") - { } - - info_main_cmdline(int argc, char* argv[]) : - skip_flag(false), - json_flag(false), - cmd_flag(false), - file_arg("") - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"skip", 0, 0, 's'}, - {"json", 0, 0, 'j'}, - {"cmd", 0, 0, 'c'}, - {"help", 0, 0, 'h'}, - {"usage", 0, 0, 'U'}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVUsjc"; - -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case 'U': - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case 's': - skip_flag = true; - break; - case 'j': - json_flag = true; - break; - case 'c': - cmd_flag = true; - break; - } - } - - // Check mutually exlusive switches - if(json_flag && skip_flag) - error("Switches [-j, --json] and [-s, --skip] are mutually exclusive"); - if(cmd_flag && skip_flag) - error("Switches [-c, --cmd] and [-s, --skip] are mutually exclusive"); - if(cmd_flag && json_flag) - error("Switches [-c, --cmd] and [-j, --json] are mutually exclusive"); - - // Parse arguments - if(argc - optind != 1) - error("Requires exactly 1 argument."); - file_arg = argv[optind]; - ++optind; - } - static const char * usage() { return "Usage: jellyfish info [options] file:path"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Display information about a jellyfish file\n\nThis command shows some information about how this jellyfish output\n" \ - "file was created. Without any argument, it displays the command line\n" \ - "used, when and where it was run.\n\n" - "Options (default value in (), *required):\n" - " -s, --skip Skip header and dump remainder of file (false)\n" - " -j, --json Dump full header in JSON format (false)\n" - " -c, --cmd Display only the command line (false)\n" - " -U, --usage Usage\n" - " -h, --help This message\n" - " -V, --version Version"; - } - static const char* hidden() { return ""; } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "skip_flag:" << skip_flag << "\n"; - os << "json_flag:" << json_flag << "\n"; - os << "cmd_flag:" << cmd_flag << "\n"; - os << "file_arg:" << file_arg << "\n"; - } -}; -#endif // __INFO_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/sub_commands/jellyfish.cc b/src/modifiedJellyfish/sub_commands/jellyfish.cc deleted file mode 100644 index 25fc3cdd..00000000 --- a/src/modifiedJellyfish/sub_commands/jellyfish.cc +++ /dev/null @@ -1,158 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include -#include -#include - -typedef int (main_func_t)(int argc, char *argv[]); - -main_func_t count_main; -main_func_t bc_main; -main_func_t info_main; -main_func_t stats_main; -main_func_t merge_main; -main_func_t histo_main; -main_func_t query_main; -main_func_t dump_main; -main_func_t cite_main; -main_func_t mem_main; -// main_func_t dump_fastq_main; -// main_func_t histo_fastq_main; -// main_func_t hash_fastq_merge_main; -main_func_t sos; -main_func_t version; -main_func_t jf_main; - -struct cmd_func { - const char *cmd; - // std::string cmd; - main_func_t *func; -}; -cmd_func cmd_list[] = { - {"count", &count_main}, - {"bc", &bc_main}, - {"info", &info_main}, - {"stats", &stats_main}, - {"histo", &histo_main}, - {"dump", &dump_main}, - {"merge", &merge_main}, - {"query", &query_main}, - {"cite", &cite_main}, - {"mem", &mem_main}, - // {"qhisto", &histo_fastq_main}, - // {"qdump", &dump_fastq_main}, - // {"qmerge", &hash_fastq_merge_main}, - {"jf", &jf_main}, - - /* help in all its form. Must be first non-command */ - {"help", &sos}, - {"-h", &sos}, - {"-help", &sos}, - {"--help", &sos}, - {"-?", &sos}, - {"--version", &version}, - {"-V", &version}, - {"", 0} -}; - - - -void __sos(std::ostream *os) -{ - *os << "Usage: jellyfish [options] arg..." << std::endl << - "Where is one of: "; - bool comma = false; - for(cmd_func *ccmd = cmd_list; ccmd->func != sos; ccmd++) { - *os << (comma ? ", " : "") << ccmd->cmd; - comma = true; - } - *os << "." << std::endl; - *os << "Options:" << std::endl << - " --version Display version" << std::endl << - " --help Display this message" << std::endl; -} - -int jf_main(int argc, char* argv[]) { - const char* aa = - " .......\n" - " .......... .....\n" - " .... ....\n" - " .. /-+ +---\\ ...\n" - " . /--| +----\\ ...\n" - " .. ...\n" - " . .\n" - " .. +----------------+ .\n" - " . |. AAGATGGAGCGC .| ..\n" - " . |---. .--/ .\n" - " .. \\--------/ . .\n" - " . . .. .. .\n" - " . ... ..... ..... .. ..\n" - " . .. . . . .. . .... .\n" - " . .. . .. . . .. . . .\n" - " . .. . . ... . .. .. .\n" - " .... . .. .. ... .. .\n" - " .. . ... . .. .. .\n" - " . .. . . . ... ..\n" - " ... . . .. ... .\n" - " . .. . .. .....\n" - " ____ ____ ._ __ _ _ ____ ____ ___ _ _\n" - " (_ _)( ___)( ) ( ) ( \\/ )( ___)(_ _)/ __)( )_( )\n" - ".-_)( )__) )(__ )(__ \\ / )__) _)(_ \\__ \\ ) _ ( \n" - "\\____) (____)(____)(____)(__) (__) (____)(___/(_) (_)\n"; - std::cout << aa; - return 0; -} - -int sos(int argc, char *argv[]) -{ - __sos(&std::cout); - return 0; -} - -int version(int argc, char *argv[]) -{ -#ifdef PACKAGE_STRING - std::cout << PACKAGE_STRING << std::endl; -#else - std::cout << "no version" << std::endl; -#endif - return 0; -} - -int main(int argc, char *argv[]) -{ - std::string error; - - if(argc < 2) { - error = "Too few arguments"; - } else { - for(cmd_func *ccmd = cmd_list; ccmd->func != 0; ccmd++) { - if(!strcmp(ccmd->cmd, argv[1])) - // if(!ccmd->cmd.compare(argv[1])) - return ccmd->func(argc - 1, argv + 1); - } - error = "Unknown command '"; - error += argv[1]; - error += "'\n"; - } - - std::cerr << error << std::endl; - __sos(&std::cerr); - return 1; -} diff --git a/src/modifiedJellyfish/sub_commands/mem_main.cc b/src/modifiedJellyfish/sub_commands/mem_main.cc deleted file mode 100644 index 07c7ae38..00000000 --- a/src/modifiedJellyfish/sub_commands/mem_main.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include - -#include -#include -#include - -static const char* suffixes = "kMGTPE"; - -template -std::string add_suffix(uint64_t x) { - const int max_i = strlen(suffixes); - int i = 0; - while(x >= U && i <= max_i) { - x /= U; - ++i; - } - std::ostringstream res; - res << x; - if(i > 0) - res << suffixes[i - 1]; - return res.str(); -} - -int mem_main(int argc, char *argv[]) { - mem_main_cmdline args(argc, argv); - jellyfish::large_hash::array::usage_info usage(args.mer_len_arg * 2, args.counter_len_arg, args.reprobes_arg); - - if(args.size_given) { - uint64_t val = usage.mem(args.size_arg); - std::cout << val << " (" << add_suffix<1024>(val) << ")\n"; - } else { - uint64_t val = usage.size(args.mem_arg); - std::cout << val << " (" << add_suffix<1000>(val) << ")\n"; - } - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/mem_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/mem_main_cmdline.hpp deleted file mode 100644 index b57bb8f1..00000000 --- a/src/modifiedJellyfish/sub_commands/mem_main_cmdline.hpp +++ /dev/null @@ -1,736 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __MEM_MAIN_CMDLINE_HPP__ -#define __MEM_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class mem_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - uint32_t mer_len_arg; - bool mer_len_given; - uint64_t size_arg; - bool size_given; - uint32_t counter_len_arg; - bool counter_len_given; - uint32_t reprobes_arg; - bool reprobes_given; - uint64_t mem_arg; - bool mem_given; - uint32_t threads_arg; - bool threads_given; - uint32_t Files_arg; - bool Files_given; - const char * generator_arg; - bool generator_given; - uint32_t Generators_arg; - bool Generators_given; - const char * shell_arg; - bool shell_given; - const char * output_arg; - bool output_given; - uint32_t out_counter_len_arg; - bool out_counter_len_given; - bool canonical_flag; - const char * bc_arg; - bool bc_given; - uint64_t bf_size_arg; - bool bf_size_given; - double bf_fp_arg; - bool bf_fp_given; - ::std::vector if_arg; - typedef ::std::vector::iterator if_arg_it; - typedef ::std::vector::const_iterator if_arg_const_it; - bool if_given; - string min_qual_char_arg; - bool min_qual_char_given; - bool text_flag; - bool disk_flag; - bool no_merge_flag; - bool no_unlink_flag; - uint64_t lower_count_arg; - bool lower_count_given; - uint64_t upper_count_arg; - bool upper_count_given; - const char * timing_arg; - bool timing_given; - bool no_write_flag; - ::std::vector file_arg; - typedef ::std::vector::iterator file_arg_it; - typedef ::std::vector::const_iterator file_arg_const_it; - - enum { - START_OPT = 1000, - FULL_HELP_OPT, - USAGE_OPT, - MEM_OPT, - OUT_COUNTER_LEN_OPT, - BC_OPT, - BF_SIZE_OPT, - BF_FP_OPT, - IF_OPT, - TEXT_OPT, - DISK_OPT, - NO_MERGE_OPT, - NO_UNLINK_OPT, - TIMING_OPT, - NO_WRITE_OPT - }; - - mem_main_cmdline() : - mer_len_arg(0), mer_len_given(false), - size_arg(0), size_given(false), - counter_len_arg((uint32_t)7), counter_len_given(false), - reprobes_arg((uint32_t)126), reprobes_given(false), - mem_arg(0), mem_given(false), - threads_arg(0), threads_given(false), - Files_arg(0), Files_given(false), - generator_arg(""), generator_given(false), - Generators_arg(0), Generators_given(false), - shell_arg(""), shell_given(false), - output_arg(""), output_given(false), - out_counter_len_arg(0), out_counter_len_given(false), - canonical_flag(false), - bc_arg(""), bc_given(false), - bf_size_arg(0), bf_size_given(false), - bf_fp_arg((double)0.01), bf_fp_given(false), - if_arg(), if_given(false), - min_qual_char_arg(""), min_qual_char_given(false), - text_flag(false), - disk_flag(false), - no_merge_flag(false), - no_unlink_flag(false), - lower_count_arg(0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - timing_arg(""), timing_given(false), - no_write_flag(false), - file_arg() - { } - - mem_main_cmdline(int argc, char* argv[]) : - mer_len_arg(0), mer_len_given(false), - size_arg(0), size_given(false), - counter_len_arg((uint32_t)7), counter_len_given(false), - reprobes_arg((uint32_t)126), reprobes_given(false), - mem_arg(0), mem_given(false), - threads_arg(0), threads_given(false), - Files_arg(0), Files_given(false), - generator_arg(""), generator_given(false), - Generators_arg(0), Generators_given(false), - shell_arg(""), shell_given(false), - output_arg(""), output_given(false), - out_counter_len_arg(0), out_counter_len_given(false), - canonical_flag(false), - bc_arg(""), bc_given(false), - bf_size_arg(0), bf_size_given(false), - bf_fp_arg((double)0.01), bf_fp_given(false), - if_arg(), if_given(false), - min_qual_char_arg(""), min_qual_char_given(false), - text_flag(false), - disk_flag(false), - no_merge_flag(false), - no_unlink_flag(false), - lower_count_arg(0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - timing_arg(""), timing_given(false), - no_write_flag(false), - file_arg() - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"mer-len", 1, 0, 'm'}, - {"size", 1, 0, 's'}, - {"counter-len", 1, 0, 'c'}, - {"reprobes", 1, 0, 'p'}, - {"mem", 1, 0, MEM_OPT}, - {"threads", 1, 0, 't'}, - {"Files", 1, 0, 'F'}, - {"generator", 1, 0, 'g'}, - {"Generators", 1, 0, 'G'}, - {"shell", 1, 0, 'S'}, - {"output", 1, 0, 'o'}, - {"out-counter-len", 1, 0, OUT_COUNTER_LEN_OPT}, - {"canonical", 0, 0, 'C'}, - {"bc", 1, 0, BC_OPT}, - {"bf-size", 1, 0, BF_SIZE_OPT}, - {"bf-fp", 1, 0, BF_FP_OPT}, - {"if", 1, 0, IF_OPT}, - {"min-qual-char", 1, 0, 'Q'}, - {"text", 0, 0, TEXT_OPT}, - {"disk", 0, 0, DISK_OPT}, - {"no-merge", 0, 0, NO_MERGE_OPT}, - {"no-unlink", 0, 0, NO_UNLINK_OPT}, - {"lower-count", 1, 0, 'L'}, - {"upper-count", 1, 0, 'U'}, - {"timing", 1, 0, TIMING_OPT}, - {"no-write", 0, 0, NO_WRITE_OPT}, - {"help", 0, 0, 'h'}, - {"full-help", 0, 0, FULL_HELP_OPT}, - {"usage", 0, 0, USAGE_OPT}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVm:s:c:p:t:F:g:G:S:o:CQ:L:U:"; - - ::std::string err; -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case USAGE_OPT: - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case FULL_HELP_OPT: - ::std::cout << usage() << "\n\n" << help() << "\n\n" << hidden() << std::flush; - exit(0); - case 'm': - mer_len_given = true; - mer_len_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-m, --mer-len=uint32") - break; - case 's': - size_given = true; - size_arg = conv_uint((const char*)optarg, err, true); - CHECK_ERR(uint64_t, optarg, "-s, --size=uint64") - break; - case 'c': - counter_len_given = true; - counter_len_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-c, --counter-len=Length in bits") - break; - case 'p': - reprobes_given = true; - reprobes_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-p, --reprobes=uint32") - break; - case MEM_OPT: - mem_given = true; - mem_arg = conv_uint((const char*)optarg, err, true); - CHECK_ERR(uint64_t, optarg, " --mem=uint64") - break; - case 't': - threads_given = true; - threads_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-t, --threads=uint32") - break; - case 'F': - Files_given = true; - Files_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-F, --Files=uint32") - break; - case 'g': - generator_given = true; - generator_arg = optarg; - break; - case 'G': - Generators_given = true; - Generators_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, "-G, --Generators=uint32") - break; - case 'S': - shell_given = true; - shell_arg = optarg; - break; - case 'o': - output_given = true; - output_arg = optarg; - break; - case OUT_COUNTER_LEN_OPT: - out_counter_len_given = true; - out_counter_len_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint32_t, optarg, " --out-counter-len=uint32") - break; - case 'C': - canonical_flag = true; - break; - case BC_OPT: - bc_given = true; - bc_arg = optarg; - break; - case BF_SIZE_OPT: - bf_size_given = true; - bf_size_arg = conv_uint((const char*)optarg, err, true); - CHECK_ERR(uint64_t, optarg, " --bf-size=uint64") - break; - case BF_FP_OPT: - bf_fp_given = true; - bf_fp_arg = conv_double((const char*)optarg, err, false); - CHECK_ERR(double_t, optarg, " --bf-fp=double") - break; - case IF_OPT: - if_given = true; - if_arg.push_back(optarg); - break; - case 'Q': - min_qual_char_given = true; - min_qual_char_arg.assign(optarg); - break; - case TEXT_OPT: - text_flag = true; - break; - case DISK_OPT: - disk_flag = true; - break; - case NO_MERGE_OPT: - no_merge_flag = true; - break; - case NO_UNLINK_OPT: - no_unlink_flag = true; - break; - case 'L': - lower_count_given = true; - lower_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-L, --lower-count=uint64") - break; - case 'U': - upper_count_given = true; - upper_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-U, --upper-count=uint64") - break; - case TIMING_OPT: - timing_given = true; - timing_arg = optarg; - break; - case NO_WRITE_OPT: - no_write_flag = true; - break; - } - } - - // Check that required switches are present - if(!mer_len_given) - error("[-m, --mer-len=uint32] required switch"); - - // Check mutually exlusive switches - if(mem_given && size_given) - error("Switches [ --mem=uint64] and [-s, --size=uint64] are mutually exclusive"); - if(bf_size_given && bc_given) - error("Switches [ --bf-size=uint64] and [ --bc=peath] are mutually exclusive"); - - // Parse arguments - if(argc - optind < 0) - error("Requires at least 0 argument."); - for( ; optind < argc; ++optind) { - file_arg.push_back(argv[optind]); - } - } - static const char * usage() { return "Usage: jellyfish mem [options] file:path+"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Give memory usage information\n\nThe mem subcommand gives some information about the memory usage of\n" \ - "Jellyfish when counting mers. If one replace 'count' by 'mem' in the\n" \ - "command line, it displays the amount of memory needed. All the\n" \ - "switches of the count subcommand are supported, although only the\n" \ - "meaningful one for computing the memory usage are used.\n" \ - "\n" \ - "If the '--size' (-s) switch is omitted and the --mem switch is passed\n" \ - "with an amount of memory in bytes, then the largest size that fit in\n" \ - "that amount of memory is returned.\n" \ - "\n" \ - "The memory usage information only takes into account the hash to store\n" \ - "the k-mers, not various buffers (e.g. in parsing the input files). But\n" \ - "typically those will be small in comparison to the hash.\n\n" - "Options (default value in (), *required):\n" - " -m, --mer-len=uint32 *Length of mer\n" - " -s, --size=uint64 Initial hash size\n" - " -c, --counter-len=Length in bits Length bits of counting field (7)\n" - " -p, --reprobes=uint32 Maximum number of reprobes (126)\n" - " --mem=uint64 Return maximum size to fit within that memory\n" - " --bc=peath Ignored switch\n" - " --usage Usage\n" - " -h, --help This message\n" - " --full-help Detailed help\n" - " -V, --version Version"; - } - static const char* hidden() { return - "Hidden options:\n" - " -t, --threads=uint32 Ignored switch\n" - " -F, --Files=uint32 Ignored switch\n" - " -g, --generator=path Ignored switch\n" - " -G, --Generators=uint32 Ignored switch\n" - " -S, --shell=string Ignored switch\n" - " -o, --output=string Ignored switch\n" - " --out-counter-len=uint32 Ignored switch\n" - " -C, --canonical Ignored switch (false)\n" - " --bf-size=uint64 Ignored switch\n" - " --bf-fp=double Ignored switch (0.01)\n" - " --if=path Ignored switch\n" - " -Q, --min-qual-char=string Ignored switch\n" - " --text Ignored switch (false)\n" - " --disk Ignored switch (false)\n" - " --no-merge Ignored switch (false)\n" - " --no-unlink Ignored switch (false)\n" - " -L, --lower-count=uint64 Ignored switch\n" - " -U, --upper-count=uint64 Ignored switch\n" - " --timing=Timing file Ignored switch\n" - " --no-write Ignored switch (false)\n" - ""; - } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "mer_len_given:" << mer_len_given << " mer_len_arg:" << mer_len_arg << "\n"; - os << "size_given:" << size_given << " size_arg:" << size_arg << "\n"; - os << "counter_len_given:" << counter_len_given << " counter_len_arg:" << counter_len_arg << "\n"; - os << "reprobes_given:" << reprobes_given << " reprobes_arg:" << reprobes_arg << "\n"; - os << "mem_given:" << mem_given << " mem_arg:" << mem_arg << "\n"; - os << "threads_given:" << threads_given << " threads_arg:" << threads_arg << "\n"; - os << "Files_given:" << Files_given << " Files_arg:" << Files_arg << "\n"; - os << "generator_given:" << generator_given << " generator_arg:" << generator_arg << "\n"; - os << "Generators_given:" << Generators_given << " Generators_arg:" << Generators_arg << "\n"; - os << "shell_given:" << shell_given << " shell_arg:" << shell_arg << "\n"; - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - os << "out_counter_len_given:" << out_counter_len_given << " out_counter_len_arg:" << out_counter_len_arg << "\n"; - os << "canonical_flag:" << canonical_flag << "\n"; - os << "bc_given:" << bc_given << " bc_arg:" << bc_arg << "\n"; - os << "bf_size_given:" << bf_size_given << " bf_size_arg:" << bf_size_arg << "\n"; - os << "bf_fp_given:" << bf_fp_given << " bf_fp_arg:" << bf_fp_arg << "\n"; - os << "if_given:" << if_given << " if_arg:" << vec_str(if_arg) << "\n"; - os << "min_qual_char_given:" << min_qual_char_given << " min_qual_char_arg:" << min_qual_char_arg << "\n"; - os << "text_flag:" << text_flag << "\n"; - os << "disk_flag:" << disk_flag << "\n"; - os << "no_merge_flag:" << no_merge_flag << "\n"; - os << "no_unlink_flag:" << no_unlink_flag << "\n"; - os << "lower_count_given:" << lower_count_given << " lower_count_arg:" << lower_count_arg << "\n"; - os << "upper_count_given:" << upper_count_given << " upper_count_arg:" << upper_count_arg << "\n"; - os << "timing_given:" << timing_given << " timing_arg:" << timing_arg << "\n"; - os << "no_write_flag:" << no_write_flag << "\n"; - os << "file_arg:" << vec_str(file_arg) << "\n"; - } -}; -#endif // __MEM_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/sub_commands/merge_main.cc b/src/modifiedJellyfish/sub_commands/merge_main.cc deleted file mode 100644 index eae3d84c..00000000 --- a/src/modifiedJellyfish/sub_commands/merge_main.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include - -#include - -namespace err = jellyfish::err; - -int merge_main(int argc, char *argv[]) -{ - jellyfish::file_header out_header; - out_header.fill_standard(); - out_header.set_cmdline(argc, argv); - - merge_main_cmdline args(argc, argv); - uint64_t min = args.lower_count_given ? args.lower_count_arg : 0; - uint64_t max = args.upper_count_given ? args.upper_count_arg : std::numeric_limits::max(); - - try { - merge_files(args.input_arg, args.output_arg, out_header, min, max); - } catch(MergeError e) { - err::die(err::msg() << e.what()); - } - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/merge_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/merge_main_cmdline.hpp deleted file mode 100644 index cd0131a3..00000000 --- a/src/modifiedJellyfish/sub_commands/merge_main_cmdline.hpp +++ /dev/null @@ -1,439 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __MERGE_MAIN_CMDLINE_HPP__ -#define __MERGE_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class merge_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - const char * output_arg; - bool output_given; - uint64_t lower_count_arg; - bool lower_count_given; - uint64_t upper_count_arg; - bool upper_count_given; - ::std::vector input_arg; - typedef ::std::vector::iterator input_arg_it; - typedef ::std::vector::const_iterator input_arg_const_it; - - enum { - START_OPT = 1000, - USAGE_OPT - }; - - merge_main_cmdline() : - output_arg("mer_counts_merged.jf"), output_given(false), - lower_count_arg(0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - input_arg() - { } - - merge_main_cmdline(int argc, char* argv[]) : - output_arg("mer_counts_merged.jf"), output_given(false), - lower_count_arg(0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - input_arg() - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"output", 1, 0, 'o'}, - {"lower-count", 1, 0, 'L'}, - {"upper-count", 1, 0, 'U'}, - {"help", 0, 0, 'h'}, - {"usage", 0, 0, USAGE_OPT}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVo:L:U:"; - - ::std::string err; -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case USAGE_OPT: - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case 'o': - output_given = true; - output_arg = optarg; - break; - case 'L': - lower_count_given = true; - lower_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-L, --lower-count=uint64") - break; - case 'U': - upper_count_given = true; - upper_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-U, --upper-count=uint64") - break; - } - } - - // Parse arguments - if(argc - optind < 2) - error("Requires at least 2 arguments."); - for( ; optind < argc; ++optind) { - input_arg.push_back(argv[optind]); - } - } - static const char * usage() { return "Usage: jellyfish merge [options] input:string+"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Merge jellyfish databases\n\n" - "Options (default value in (), *required):\n" - " -o, --output=string Output file (mer_counts_merged.jf)\n" - " -L, --lower-count=uint64 Don't output k-mer with count < lower-count\n" - " -U, --upper-count=uint64 Don't output k-mer with count > upper-count\n" - " --usage Usage\n" - " -h, --help This message\n" - " -V, --version Version"; - } - static const char* hidden() { return ""; } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - os << "lower_count_given:" << lower_count_given << " lower_count_arg:" << lower_count_arg << "\n"; - os << "upper_count_given:" << upper_count_given << " upper_count_arg:" << upper_count_arg << "\n"; - os << "input_arg:" << vec_str(input_arg) << "\n"; - } -}; -#endif // __MERGE_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/sub_commands/query_main.cc b/src/modifiedJellyfish/sub_commands/query_main.cc deleted file mode 100644 index bde99f3e..00000000 --- a/src/modifiedJellyfish/sub_commands/query_main.cc +++ /dev/null @@ -1,123 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace err = jellyfish::err; - -using jellyfish::mer_dna; -using jellyfish::mer_dna_bloom_counter; -typedef std::vector file_vector; -typedef jellyfish::mer_overlap_sequence_parser > sequence_parser; -typedef jellyfish::mer_iterator mer_iterator; - -static query_main_cmdline args; - -// mer_dna_bloom_counter query_load_bloom_filter(const char* path) { -// return res; -// } - -template -void query_from_sequence(PathIterator file_begin, PathIterator file_end, const Database& db, - std::ostream& out, bool canonical) { - jellyfish::stream_manager streams(file_begin, file_end); - sequence_parser parser(mer_dna::k(), 1, 3, 4096, streams); - for(mer_iterator mers(parser, canonical); mers; ++mers) - out << *mers << " " << db.check(*mers) << "\n"; -} - -template -void query_from_cmdline(std::vector mers, const Database& db, std::ostream& out, - bool canonical) { - mer_dna m; - for(auto it = mers.cbegin(); it != mers.cend(); ++it) { - try { - m = *it; - if(canonical) - m.canonicalize(); - out << m << " " << db.check(m) << "\n"; - } catch(std::length_error e) { - std::cerr << "Invalid mer '" << *it << "'\n"; - } - } -} - -template -void query_from_stdin(const Database& db, std::ostream& out, bool canonical) { - std::string buffer; - mer_dna m; - - while(getline(std::cin, buffer)) { - try { - m = buffer; - if(canonical) - m.canonicalize(); - out << db.check(m) << std::endl; // a flush is need for interactive use - } catch(std::length_error e) { - std::cerr << "Invalid mer '" << buffer << "'" << std::endl; - } - } -} - -int query_main(int argc, char *argv[]) -{ - args.parse(argc, argv); - - ofstream_default out(args.output_given ? args.output_arg : 0, std::cout); - if(!out.good()) - err::die(err::msg() << "Error opening output file '" << args.output_arg << "'"); - - std::ifstream in(args.file_arg, std::ios::in|std::ios::binary); - jellyfish::file_header header(in); - if(!in.good()) - err::die(err::msg() << "Failed to parse header of file '" << args.file_arg << "'"); - mer_dna::k(header.key_len() / 2); - if(header.format() == "bloomcounter") { - jellyfish::hash_pair fns(header.matrix(1), header.matrix(2)); - mer_dna_bloom_counter filter(header.size(), header.nb_hashes(), in, fns); - if(!in.good()) - err::die("Bloom filter file is truncated"); - in.close(); - query_from_sequence(args.sequence_arg.begin(), args.sequence_arg.end(), filter, out, header.canonical()); - query_from_cmdline(args.mers_arg, filter, out, header.canonical()); - if(args.interactive_flag) query_from_stdin(filter, out, header.canonical()); - } else if(header.format() == binary_dumper::format) { - jellyfish::mapped_file binary_map(args.file_arg); - if(!args.no_load_flag && - (args.load_flag || (args.sequence_arg.begin() != args.sequence_arg.end()) || (args.mers_arg.size() > 100))) - binary_map.load(); - binary_query bq(binary_map.base() + header.offset(), header.key_len(), header.counter_len(), header.matrix(), - header.size() - 1, binary_map.length() - header.offset()); - query_from_sequence(args.sequence_arg.begin(), args.sequence_arg.end(), bq, out, header.canonical()); - query_from_cmdline(args.mers_arg, bq, out, header.canonical()); - if(args.interactive_flag) query_from_stdin(bq, out, header.canonical()); - } else { - err::die(err::msg() << "Unsupported format '" << header.format() << "'. Must be a bloom counter or binary list."); - } - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/query_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/query_main_cmdline.hpp deleted file mode 100644 index 450294e0..00000000 --- a/src/modifiedJellyfish/sub_commands/query_main_cmdline.hpp +++ /dev/null @@ -1,459 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __QUERY_MAIN_CMDLINE_HPP__ -#define __QUERY_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class query_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - ::std::vector sequence_arg; - typedef ::std::vector::iterator sequence_arg_it; - typedef ::std::vector::const_iterator sequence_arg_const_it; - bool sequence_given; - const char * output_arg; - bool output_given; - bool interactive_flag; - bool load_flag; - bool no_load_flag; - const char * file_arg; - ::std::vector mers_arg; - typedef ::std::vector::iterator mers_arg_it; - typedef ::std::vector::const_iterator mers_arg_const_it; - - enum { - START_OPT = 1000 - }; - - query_main_cmdline() : - sequence_arg(), sequence_given(false), - output_arg(""), output_given(false), - interactive_flag(false), - load_flag(false), - no_load_flag(false), - file_arg(""), - mers_arg() - { } - - query_main_cmdline(int argc, char* argv[]) : - sequence_arg(), sequence_given(false), - output_arg(""), output_given(false), - interactive_flag(false), - load_flag(false), - no_load_flag(false), - file_arg(""), - mers_arg() - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"sequence", 1, 0, 's'}, - {"output", 1, 0, 'o'}, - {"interactive", 0, 0, 'i'}, - {"load", 0, 0, 'l'}, - {"no-load", 0, 0, 'L'}, - {"help", 0, 0, 'h'}, - {"usage", 0, 0, 'U'}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVUs:o:ilL"; - -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case 'U': - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case 's': - sequence_given = true; - sequence_arg.push_back(optarg); - break; - case 'o': - output_given = true; - output_arg = optarg; - break; - case 'i': - interactive_flag = true; - break; - case 'l': - load_flag = true; - break; - case 'L': - no_load_flag = true; - break; - } - } - - // Parse arguments - if(argc - optind < 1) - error("Requires at least 1 argument."); - file_arg = argv[optind]; - ++optind; - for( ; optind < argc; ++optind) { - mers_arg.push_back(argv[optind]); - } - } - static const char * usage() { return "Usage: jellyfish query [options] file:path mers:string+"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Query a Jellyfish database\n\n" - "Options (default value in (), *required):\n" - " -s, --sequence=path Output counts for all mers in sequence\n" - " -o, --output=path Output file (stdout)\n" - " -i, --interactive Interactive, queries from stdin (false)\n" - " -l, --load Force pre-loading of database file into memory (false)\n" - " -L, --no-load Disable pre-loading of database file into memory (false)\n" - " -U, --usage Usage\n" - " -h, --help This message\n" - " -V, --version Version"; - } - static const char* hidden() { return ""; } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "sequence_given:" << sequence_given << " sequence_arg:" << vec_str(sequence_arg) << "\n"; - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - os << "interactive_flag:" << interactive_flag << "\n"; - os << "load_flag:" << load_flag << "\n"; - os << "no_load_flag:" << no_load_flag << "\n"; - os << "file_arg:" << file_arg << "\n"; - os << "mers_arg:" << vec_str(mers_arg) << "\n"; - } -}; -#endif // __QUERY_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/sub_commands/stats_main.cc b/src/modifiedJellyfish/sub_commands/stats_main.cc deleted file mode 100644 index 75124736..00000000 --- a/src/modifiedJellyfish/sub_commands/stats_main.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace err = jellyfish::err; - -template -void compute_stats(reader_type& reader, uint64_t low, uint64_t high, - uint64_t& uniq, uint64_t& distinct, uint64_t& total, - uint64_t& max) { - uniq = distinct = total = max = 0; - - while(reader.next()) { - if(reader.val() < low || reader.val() > high) continue; - uniq += reader.val() == 1; - total += reader.val(); - max = std::max(max, reader.val()); - ++distinct; - } -} - - -int stats_main(int argc, char *argv[]) -{ - stats_main_cmdline args(argc, argv); - - std::ifstream is(args.db_arg); - if(!is.good()) - err::die(err::msg() << "Failed to open input file '" << args.db_arg << "'"); - jellyfish::file_header header; - header.read(is); - jellyfish::mer_dna::k(header.key_len() / 2); - - ofstream_default out(args.output_given ? args.output_arg : 0, std::cout); - if(!out.good()) - err::die(err::msg() << "Error opening output file '" << args.output_arg << "'"); - - if(!args.upper_count_given) - args.upper_count_arg = std::numeric_limits::max(); - uint64_t uniq = 0, distinct = 0, total = 0, max = 0; - if(!header.format().compare(binary_dumper::format)) { - binary_reader reader(is, &header); - compute_stats(reader, args.lower_count_arg, args.upper_count_arg, uniq, distinct, total, max); - } else if(!header.format().compare(text_dumper::format)) { - text_reader reader(is, &header); - compute_stats(reader, args.lower_count_arg, args.upper_count_arg, uniq, distinct, total, max); - } else { - err::die(err::msg() << "Unknown format '" << header.format() << "'"); - } - - out << "Unique: " << uniq << "\n" - << "Distinct: " << distinct << "\n" - << "Total: " << total << "\n" - << "Max_count: " << max << "\n"; - out.close(); - - return 0; -} diff --git a/src/modifiedJellyfish/sub_commands/stats_main_cmdline.hpp b/src/modifiedJellyfish/sub_commands/stats_main_cmdline.hpp deleted file mode 100644 index 8d08e9c6..00000000 --- a/src/modifiedJellyfish/sub_commands/stats_main_cmdline.hpp +++ /dev/null @@ -1,468 +0,0 @@ -/***** This code was generated by Yaggo. Do not edit ******/ - -/* This file is part of Jellyfish. - - Jellyfish 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. - - Jellyfish 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 Jellyfish. If not, see . -*/ - -#ifndef __STATS_MAIN_CMDLINE_HPP__ -#define __STATS_MAIN_CMDLINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class stats_main_cmdline { - // Boiler plate stuff. Conversion from string to other formats - static bool adjust_double_si_suffix(double &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'a': res *= 1e-18; break; - case 'f': res *= 1e-15; break; - case 'p': res *= 1e-12; break; - case 'n': res *= 1e-9; break; - case 'u': res *= 1e-6; break; - case 'm': res *= 1e-3; break; - case 'k': res *= 1e3; break; - case 'M': res *= 1e6; break; - case 'G': res *= 1e9; break; - case 'T': res *= 1e12; break; - case 'P': res *= 1e15; break; - case 'E': res *= 1e18; break; - default: return false; - } - return true; - } - - static double conv_double(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - double res = strtod(str, &endptr); - if(errno) { - err.assign(strerror(errno)); - return (double)0.0; - } - bool invalid = - si_suffix ? !adjust_double_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (double)0.0; - } - return res; - } - - static int conv_enum(const char* str, ::std::string& err, const char* const strs[]) { - int res = 0; - for(const char* const* cstr = strs; *cstr; ++cstr, ++res) - if(!strcmp(*cstr, str)) - return res; - err += "Invalid constant '"; - err += str; - err += "'. Expected one of { "; - for(const char* const* cstr = strs; *cstr; ++cstr) { - if(cstr != strs) - err += ", "; - err += *cstr; - } - err += " }"; - return -1; - } - - template - static bool adjust_int_si_suffix(T &res, const char *suffix) { - if(*suffix == '\0') - return true; - if(*(suffix + 1) != '\0') - return false; - - switch(*suffix) { - case 'k': res *= (T)1000; break; - case 'M': res *= (T)1000000; break; - case 'G': res *= (T)1000000000; break; - case 'T': res *= (T)1000000000000; break; - case 'P': res *= (T)1000000000000000; break; - case 'E': res *= (T)1000000000000000000; break; - default: return false; - } - return true; - } - - template - static T conv_int(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - long long int res = strtoll(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max() || - res < ::std::numeric_limits::min()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static T conv_uint(const char *str, ::std::string &err, bool si_suffix) { - char *endptr = 0; - errno = 0; - while(isspace(*str)) { ++str; } - if(*str == '-') { - err.assign("Negative value"); - return (T)0; - } - unsigned long long int res = strtoull(str, &endptr, 0); - if(errno) { - err.assign(strerror(errno)); - return (T)0; - } - bool invalid = - si_suffix ? !adjust_int_si_suffix(res, endptr) : *endptr != '\0'; - if(invalid) { - err.assign("Invalid character"); - return (T)0; - } - if(res > ::std::numeric_limits::max()) { - err.assign("Value out of range"); - return (T)0; - } - return (T)res; - } - - template - static ::std::string vec_str(const std::vector &vec) { - ::std::ostringstream os; - for(typename ::std::vector::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - if(it != vec.begin()) - os << ","; - os << *it; - } - return os.str(); - } - - class string : public ::std::string { - public: - string() : ::std::string() {} - explicit string(const ::std::string &s) : std::string(s) {} - explicit string(const char *s) : ::std::string(s) {} - int as_enum(const char* const strs[]) { - ::std::string err; - int res = conv_enum((const char*)this->c_str(), err, strs); - if(!err.empty()) - throw ::std::runtime_error(err); - return res; - } - - - uint32_t as_uint32_suffix() const { return as_uint32(true); } - uint32_t as_uint32(bool si_suffix = false) const { - ::std::string err; - uint32_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - uint64_t as_uint64_suffix() const { return as_uint64(true); } - uint64_t as_uint64(bool si_suffix = false) const { - ::std::string err; - uint64_t res = conv_uint((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to uint64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int32_t as_int32_suffix() const { return as_int32(true); } - int32_t as_int32(bool si_suffix = false) const { - ::std::string err; - int32_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int32_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int64_t as_int64_suffix() const { return as_int64(true); } - int64_t as_int64(bool si_suffix = false) const { - ::std::string err; - int64_t res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int64_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - int as_int_suffix() const { return as_int(true); } - int as_int(bool si_suffix = false) const { - ::std::string err; - int res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to int_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - long as_long_suffix() const { return as_long(true); } - long as_long(bool si_suffix = false) const { - ::std::string err; - long res = conv_int((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to long_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - double as_double_suffix() const { return as_double(true); } - double as_double(bool si_suffix = false) const { - ::std::string err; - double res = conv_double((const char*)this->c_str(), err, si_suffix); - if(!err.empty()) { - ::std::string msg("Invalid conversion of '"); - msg += *this; - msg += "' to double_t: "; - msg += err; - throw ::std::runtime_error(msg); - } - return res; - } - }; - -public: - bool recompute_flag; - uint64_t lower_count_arg; - bool lower_count_given; - uint64_t upper_count_arg; - bool upper_count_given; - bool verbose_flag; - const char * output_arg; - bool output_given; - const char * db_arg; - - enum { - START_OPT = 1000, - FULL_HELP_OPT, - USAGE_OPT - }; - - stats_main_cmdline() : - recompute_flag(false), - lower_count_arg((uint64_t)0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - verbose_flag(false), - output_arg(""), output_given(false), - db_arg("") - { } - - stats_main_cmdline(int argc, char* argv[]) : - recompute_flag(false), - lower_count_arg((uint64_t)0), lower_count_given(false), - upper_count_arg(0), upper_count_given(false), - verbose_flag(false), - output_arg(""), output_given(false), - db_arg("") - { parse(argc, argv); } - - void parse(int argc, char* argv[]) { - static struct option long_options[] = { - {"recompute", 0, 0, 'r'}, - {"lower-count", 1, 0, 'L'}, - {"upper-count", 1, 0, 'U'}, - {"verbose", 0, 0, 'v'}, - {"output", 1, 0, 'o'}, - {"help", 0, 0, 'h'}, - {"full-help", 0, 0, FULL_HELP_OPT}, - {"usage", 0, 0, USAGE_OPT}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; - static const char *short_options = "hVrL:U:vo:"; - - ::std::string err; -#define CHECK_ERR(type,val,which) if(!err.empty()) { ::std::cerr << "Invalid " #type " '" << val << "' for [" which "]: " << err << "\n"; exit(1); } - while(true) { - int index = -1; - int c = getopt_long(argc, argv, short_options, long_options, &index); - if(c == -1) break; - switch(c) { - case ':': - ::std::cerr << "Missing required argument for " - << (index == -1 ? ::std::string(1, (char)optopt) : std::string(long_options[index].name)) - << ::std::endl; - exit(1); - case 'h': - ::std::cout << usage() << "\n\n" << help() << std::endl; - exit(0); - case USAGE_OPT: - ::std::cout << usage() << "\nUse --help for more information." << std::endl; - exit(0); - case 'V': - print_version(); - exit(0); - case '?': - ::std::cerr << "Use --usage or --help for some help\n"; - exit(1); - case FULL_HELP_OPT: - ::std::cout << usage() << "\n\n" << help() << "\n\n" << hidden() << std::flush; - exit(0); - case 'r': - recompute_flag = true; - break; - case 'L': - lower_count_given = true; - lower_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-L, --lower-count=uint64") - break; - case 'U': - upper_count_given = true; - upper_count_arg = conv_uint((const char*)optarg, err, false); - CHECK_ERR(uint64_t, optarg, "-U, --upper-count=uint64") - break; - case 'v': - verbose_flag = true; - break; - case 'o': - output_given = true; - output_arg = optarg; - break; - } - } - - // Parse arguments - if(argc - optind != 1) - error("Requires exactly 1 argument."); - db_arg = argv[optind]; - ++optind; - } - static const char * usage() { return "Usage: jellyfish stats [options] db:path"; } - class error { - int code_; - std::ostringstream msg_; - - // Select the correct version (GNU or XSI) version of - // strerror_r. strerror_ behaves like the GNU version of strerror_r, - // regardless of which version is provided by the system. - static const char* strerror__(char* buf, int res) { - return res != -1 ? buf : "Invalid error"; - } - static const char* strerror__(char* buf, char* res) { - return res; - } - static const char* strerror_(int err, char* buf, size_t buflen) { - return strerror__(buf, strerror_r(err, buf, buflen)); - } - struct no_t { }; - - public: - static no_t no; - error(int code = EXIT_FAILURE) : code_(code) { } - explicit error(const char* msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error(const std::string& msg, int code = EXIT_FAILURE) : code_(code) - { msg_ << msg; } - error& operator<<(no_t) { - char buf[1024]; - msg_ << ": " << strerror_(errno, buf, sizeof(buf)); - return *this; - } - template - error& operator<<(const T& x) { msg_ << x; return (*this); } - ~error() { - ::std::cerr << "Error: " << msg_.str() << "\n" - << usage() << "\n" - << "Use --help for more information" - << ::std::endl; - exit(code_); - } - }; - static const char * help() { return - "Statistics\n\nDisplay some statistics about the k-mers in the hash:\n" \ - "\n" \ - "Unique: Number of k-mers which occur only once.\n" \ - "Distinct: Number of k-mers, not counting multiplicity.\n" \ - "Total: Number of k-mers, including multiplicity.\n" \ - "Max_count: Maximum number of occurrence of a k-mer.\n\n" - "Options (default value in (), *required):\n" - " -L, --lower-count=uint64 Don't consider k-mer with count < lower-count (0)\n" - " -U, --upper-count=uint64 Don't consider k-mer with count > upper-count (2^64)\n" - " -v, --verbose Verbose (false)\n" - " -o, --output=string Output file\n" - " --usage Usage\n" - " -h, --help This message\n" - " --full-help Detailed help\n" - " -V, --version Version"; - } - static const char* hidden() { return - "Hidden options:\n" - " -r, --recompute Recompute (false)\n" - ""; - } - void print_version(::std::ostream &os = std::cout) const { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.0.0" -#endif - os << PACKAGE_VERSION << "\n"; - } - void dump(::std::ostream &os = std::cout) { - os << "recompute_flag:" << recompute_flag << "\n"; - os << "lower_count_given:" << lower_count_given << " lower_count_arg:" << lower_count_arg << "\n"; - os << "upper_count_given:" << upper_count_given << " upper_count_arg:" << upper_count_arg << "\n"; - os << "verbose_flag:" << verbose_flag << "\n"; - os << "output_given:" << output_given << " output_arg:" << output_arg << "\n"; - os << "db_arg:" << db_arg << "\n"; - } -}; -#endif // __STATS_MAIN_CMDLINE_HPP__" diff --git a/src/modifiedJellyfish/swig/Makefile.am b/src/modifiedJellyfish/swig/Makefile.am deleted file mode 100644 index aaf32b81..00000000 --- a/src/modifiedJellyfish/swig/Makefile.am +++ /dev/null @@ -1,66 +0,0 @@ -# SWIG -SWIG_SRC = swig/jellyfish.i swig/hash_counter.i swig/hash_set.i \ - swig/mer_dna.i swig/mer_file.i swig/string_mers.i - -if HAVE_SWIG -SWIG_V_GEN = $(swig_v_GEN_$(V)) -swig_v_GEN_ = $(swig_v_GEN_$(AM_DEFAULT_VERBOSITY)) -swig_v_GEN_0 = @echo " SWIG " $@; -%/swig_wrap.cpp: $(SWIG_SRC) - $(SWIG_V_GEN)$(SWIG) -$(notdir $*) -I$(srcdir)/../include -o $@ $< -else -%/swig_wrap.cc: - @echo >&2 SWIG >= 3.x.x not found. Make sure it is install and rerun configure - @false -endif - -# Python support -if PYTHON_BINDING -PYTHON_BUILT = swig/python/swig_wrap.cpp swig/python/jellyfish.py -BUILT_SOURCES += $(PYTHON_BUILT) - -pythonextdir = $(PYTHON_SITE_PKG)/jellyfish -pythonext_SCRIPTS = swig/python/__init__.pyc -pythonext_LTLIBRARIES = swig/python/_jellyfish.la -swig_python__jellyfish_la_SOURCES = swig/python/swig_wrap.cpp $(SWIG_SRC) -swig_python__jellyfish_la_CPPFLAGS = $(PYTHON_CPPFLAGS) -I$(srcdir)/include -swig_python__jellyfish_la_LDFLAGS = -module -swig_python__jellyfish_la_LIBADD = libjellyfish-2.0.la -CLEANFILES += $(PYTHON_BUILT) $(pythonext_SCRIPTS) -PYTHONC_V_GEN = $(pythonc_v_GEN_$(V)) -pythonc_v_GEN_ = $(pythonc_v_GEN_$(AM_DEFAULT_VERBOSITY)) -pythonc_v_GEN_0 = @echo " PYTHONC " $@; -%/__init__.pyc: %/jellyfish.py - $(PYTHONC_V_GEN)$(PYTHON) -c 'import py_compile, sys; py_compile.compile(sys.argv[1], sys.argv[2])' $< $@ -swig/python/jellyfish.py: swig/python/swig_wrap.cpp -EXTRA_DIST += $(PYTHON_BUILT) -endif - -# Ruby support -if RUBY_BINDING -RUBY_BUILT = swig/ruby/swig_wrap.cpp -BUILT_SOURCES += $(RUBY_BUILT) -rubyextdir = $(RUBY_EXT_LIB) -rubyext_LTLIBRARIES = swig/ruby/jellyfish.la -swig_ruby_jellyfish_la_SOURCES = swig/ruby/swig_wrap.cpp $(SWIG_SRC) -swig_ruby_jellyfish_la_CPPFLAGS = $(RUBY_EXT_CFLAGS) -I$(srcdir)/include -swig_ruby_jellyfish_la_LDFLAGS = -module -swig_ruby_jellyfish_la_LIBADD = libjellyfish-2.0.la -CLEANFILES += $(RUBY_BUILT) -endif - -# Perl5 support -if PERL_BINDING -PERL_BUILT = swig/perl5/swig_wrap.cpp swig/perl5/jellyfish.pm -BUILT_SOURCES += $(PERL_BUILT) -perlextdir = $(PERL_EXT_LIB) -perlext_SCRIPTS = swig/perl5/jellyfish.pm -perlext_LTLIBRARIES = swig/perl5/jellyfish.la -swig_perl5_jellyfish_la_SOURCES = swig/perl5/swig_wrap.cpp $(SWIG_SRC) -swig_perl5_jellyfish_la_CPPFLAGS = $(PERL_EXT_CPPFLAGS) -I$(PERL_EXT_INC) -I$(srcdir)/include -swig_perl5_jellyfish_la_LDFLAGS = -module -swig_perl5_jellyfish_la_LIBADD = libjellyfish-2.0.la -CLEANFILES += $(PERL_BUILT) -swig/perl5/jellyfish.pm: swig/perl5/swig_wrap.cpp -EXTRA_DIST += $(PERL_BUILT) -endif diff --git a/src/modifiedJellyfish/swig/hash_counter.i b/src/modifiedJellyfish/swig/hash_counter.i deleted file mode 100644 index 097990aa..00000000 --- a/src/modifiedJellyfish/swig/hash_counter.i +++ /dev/null @@ -1,56 +0,0 @@ -/*********************************************************************/ -/* Proxy class for hash counter: auto size doubling hash on mer_dna. */ -/*********************************************************************/ -%{ - class HashCounter : public jellyfish::cooperative::hash_counter { - typedef jellyfish::cooperative::hash_counter super; - public: - HashCounter(size_t size, unsigned int val_len, unsigned int nb_threads = 1) : \ - super(size, jellyfish::mer_dna::k() * 2, val_len, nb_threads) - { } - - bool add(const MerDNA& m, const int& x) { - bool res; - size_t id; - super::add(m, x, &res, &id); - return res; - } - - }; -%} - -// Typemaps to return nil/undef/None if the mer asked for is not in -// the hash -%typemap(in, numinputs=0) std::pair* COUNT (std::pair tmp) { - $1 = &tmp; - } -%typemap(argout) std::pair* COUNT { - if(($1)->first) { - SWIG_Object o = SWIG_From(unsigned long)(($1)->second); - %append_output(o); - } else { - %append_output(VOID_Object); - } - } - -class HashCounter { -public: - HashCounter(size_t size, unsigned int val_len, unsigned int nb_threads = 1); - size_t size() const; - unsigned int val_len() const; - // unsigned int nb_threads() const; - - bool add(const MerDNA& m, const int& x); - bool update_add(const MerDNA&, const int&); - - %extend { - void get(const MerDNA& m, std::pair* COUNT) const { - COUNT->first = $self->ary()->get_val_for_key(m, &COUNT->second); - } -#ifndef SWIGPERL - void __getitem__(const MerDNA& m, std::pair* COUNT) const { - COUNT->first = $self->ary()->get_val_for_key(m, &COUNT->second); - } -#endif - } -}; diff --git a/src/modifiedJellyfish/swig/hash_set.i b/src/modifiedJellyfish/swig/hash_set.i deleted file mode 100644 index 72ccf579..00000000 --- a/src/modifiedJellyfish/swig/hash_set.i +++ /dev/null @@ -1,35 +0,0 @@ -/*********************************************************************/ -/* Proxy class for hash counter: auto size doubling hash on mer_dna. */ -/*********************************************************************/ -%{ - class HashSet : public jellyfish::cooperative::hash_counter { - typedef jellyfish::cooperative::hash_counter super; - public: - HashSet(size_t size, unsigned int nb_threads = 1) : \ - super(size, jellyfish::mer_dna::k() * 2, 0, nb_threads) - { } - - bool add(const MerDNA& m) { - bool res; - size_t id; - super::set(m, &res, &id); - return res; - } - }; -%} - -class HashSet { -public: - HashSet(size_t size, unsigned int nb_threads = 1); - size_t size() const; - // unsigned int nb_threads() const; - - bool add(const MerDNA& m); - - %extend { - bool get(const MerDNA& m) const { return $self->ary()->has_key(m); } -#ifndef SWIGPERL - bool __getitem__(const MerDNA& m) const { return $self->ary()->has_key(m); } -#endif - } -}; diff --git a/src/modifiedJellyfish/swig/jellyfish.i b/src/modifiedJellyfish/swig/jellyfish.i deleted file mode 100644 index 2a916ec0..00000000 --- a/src/modifiedJellyfish/swig/jellyfish.i +++ /dev/null @@ -1,34 +0,0 @@ -%module(docstring="Jellyfish binding") jellyfish -%naturalvar; // Use const reference instead of pointers -%include "std_string.i" -%include "exception.i" -%include "std_except.i" -%include "typemaps.i" -%feature("autodoc", "2"); - -%{ -#ifdef SWIGPYTHON -#define SWIG_FILE_WITH_INIT -#endif - -#ifdef SWIGPERL -#undef seed -#undef random -#endif - -#include -#include -#undef die -#include -#include -#include -#include -#include -#undef die -%} - -%include "mer_dna.i" -%include "mer_file.i" -%include "hash_counter.i" -%include "hash_set.i" -%include "string_mers.i" diff --git a/src/modifiedJellyfish/swig/mer_dna.i b/src/modifiedJellyfish/swig/mer_dna.i deleted file mode 100644 index 0e6827df..00000000 --- a/src/modifiedJellyfish/swig/mer_dna.i +++ /dev/null @@ -1,99 +0,0 @@ -/**********************************/ -/* MerDNA proxy class for mer_dna */ -/**********************************/ -%{ - class MerDNA : public jellyfish::mer_dna { - public: - MerDNA() = default; - MerDNA(const char* s) : jellyfish::mer_dna(s) { } - MerDNA(const MerDNA& m) : jellyfish::mer_dna(m) { } - MerDNA& operator=(const jellyfish::mer_dna& m) { *static_cast(this) = m; return *this; } - }; -%} - -#ifdef SWIGRUBY -%bang MerDNA::randomize(); -%bang MerDNA::canonicalize(); -%bang MerDNA::reverse_complement(); -%bang MerDNA::polyA(); -%bang MerDNA::polyC(); -%bang MerDNA::polyG(); -%bang MerDNA::polyT(); -// %predicate MerDNA::is_homopolymer(); // Does not work??? -%rename("MerDNA::homopolymer?") MerDNA::is_homopolymer(); -%rename("MerDNA::complement") MerDNA::get_reverse_complement(); -%rename("MerDNA::canonical") MerDNA::get_canonical(); -#endif - - -%feature("autodoc", "Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int)"); -class MerDNA { -public: - MerDNA(); - MerDNA(const char*); - MerDNA(const MerDNA&); - - %feature("autodoc", "Get the length of the k-mers"); - static unsigned int k(); - %feature("autodoc", "Set the length of the k-mers"); - static unsigned int k(unsigned int); - - %feature("autodoc", "Change the mer to a homopolymer of A"); - void polyA(); - %feature("autodoc", "Change the mer to a homopolymer of C"); - void polyC(); - %feature("autodoc", "Change the mer to a homopolymer of G"); - void polyG(); - %feature("autodoc", "Change the mer to a homopolymer of T"); - void polyT(); - %feature("autodoc", "Change the mer to a random one"); - void randomize(); - %feature("autodoc", "Check if the mer is a homopolymer"); - bool is_homopolymer() const; - - %feature("autodoc", "Shift a base to the left and the leftmost base is return . \"ACGT\", shift_left('A') becomes \"CGTA\" and 'A' is returned"); - char shift_left(char); - %feature("autodoc", "Shift a base to the right and the rightmost base is return . \"ACGT\", shift_right('A') becomes \"AACG\" and 'T' is returned"); - char shift_right(char); - - %feature("autodoc", "Change the mer to its canonical representation"); - void canonicalize(); - %feature("autodoc", "Change the mer to its reverse complement"); - void reverse_complement(); - %feature("autodoc", "Return canonical representation of the mer"); - MerDNA get_canonical() const; - %feature("autodoc", "Return the reverse complement of the mer"); - MerDNA get_reverse_complement() const; - - %feature("autodoc", "Equality between mers"); - bool operator==(const MerDNA&) const; - %feature("autodoc", "Lexicographic less-than"); - bool operator<(const MerDNA&) const; - %feature("autodoc", "Lexicographic greater-than"); - bool operator>(const MerDNA&) const; - - - %extend{ - %feature("autodoc", "Duplicate the mer"); - MerDNA dup() const { return MerDNA(*self); } - %feature("autodoc", "Return string representation of the mer"); - std::string __str__() { return self->to_str(); } - %feature("autodoc", "Set the mer from a string"); - void set(const char* s) throw(std::length_error) { *static_cast(self) = s; } - -#ifdef SWIGPERL - char get_base(unsigned int i) { return (char)self->base(i); } - void set_base(unsigned int i, char b) { self->base(i) = b; } -#else - %feature("autodoc", "Get base i (0 <= i < k)"); - char __getitem__(unsigned int i) { return (char)self->base(i); } - %feature("autodoc", "Set base i (0 <= i < k)"); - void __setitem__(unsigned int i, char b) { self->base(i) = b; } - // MerDNA __neg__() const { return self->get_reverse_complement(); } - %feature("autodoc", "Shift a base to the left and return the mer"); - MerDNA& __lshift__(char b) { self->shift_left(b); return *self; } - %feature("autodoc", "Shift a base to the right and return the mer"); - MerDNA& __rshift__(char b) { self->shift_right(b); return *self; } -#endif - } -}; diff --git a/src/modifiedJellyfish/swig/mer_file.i b/src/modifiedJellyfish/swig/mer_file.i deleted file mode 100644 index 130695ab..00000000 --- a/src/modifiedJellyfish/swig/mer_file.i +++ /dev/null @@ -1,191 +0,0 @@ -/******************************/ -/* Query output of jellyfish. */ -/******************************/ -%{ - class QueryMerFile { - std::unique_ptr bf; - jellyfish::mapped_file binary_map; - std::unique_ptr jf; - - public: - QueryMerFile(const char* path) throw(std::runtime_error) { - std::ifstream in(path); - if(!in.good()) - throw std::runtime_error(std::string("Can't open file '") + path + "'"); - jellyfish::file_header header(in); - jellyfish::mer_dna::k(header.key_len() / 2); - if(header.format() == "bloomcounter") { - jellyfish::hash_pair fns(header.matrix(1), header.matrix(2)); - bf.reset(new jellyfish::mer_dna_bloom_filter(header.size(), header.nb_hashes(), in, fns)); - if(!in.good()) - throw std::runtime_error("Bloom filter file is truncated"); - } else if(header.format() == "binary/sorted") { - binary_map.map(path); - jf.reset(new binary_query(binary_map.base() + header.offset(), header.key_len(), header.counter_len(), header.matrix(), - header.size() - 1, binary_map.length() - header.offset())); - } else { - throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'"); - } - } - -#ifdef SWIGPERL - unsigned int get(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); } -#else - unsigned int __getitem__(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); } -#endif - }; -%} - -%feature("autodoc", "Give random access to a Jellyfish database. Given a mer, it returns the count associated with that mer"); -class QueryMerFile { - public: - %feature("autodoc", "Open the jellyfish database"); - QueryMerFile(const char* path) throw(std::runtime_error); - - %feature("autodoc", "Get the count for the mer m"); -#ifdef SWIGPERL - unsigned int get(const MerDNA& m); -#else - unsigned int __getitem__(const MerDNA& m); -#endif -}; - - -/****************************/ -/* Read output of jellyfish */ -/****************************/ -#ifdef SWIGRUBY -%mixin ReadMerFile "Enumerable"; -#endif - -#ifdef SWIGPYTHON -// For python iteratable, throw StopIteration if at end of iterator -%exception __next__ { - $action; - if(!result.first) { - PyErr_SetString(PyExc_StopIteration, "Done"); - SWIG_fail; - } - } -%exception next { - $action; - if(!result.first) { - PyErr_SetString(PyExc_StopIteration, "Done"); - SWIG_fail; - } - } -%typemap(out) std::pair { - SWIG_Object m = SWIG_NewPointerObj(const_cast(($1).first), SWIGTYPE_p_MerDNA, 0); - SWIG_Object c = SWIG_From(unsigned long)(($1).second); - %append_output(m); - %append_output(c); - } -#endif - -#ifdef SWIGPERL -// For perl, return an empty array at end of iterator -%typemap(out) std::pair { - if(($1).first) { - SWIG_Object m = SWIG_NewPointerObj(const_cast(($1).first), SWIGTYPE_p_MerDNA, 0); - SWIG_Object c = SWIG_From(unsigned long)(($1).second); - %append_output(m); - %append_output(c); - } - } -#endif - -%{ - class ReadMerFile { - std::ifstream in; - std::unique_ptr binary; - std::unique_ptr text; - - std::pair next_mer__() { - std::pair res((const MerDNA*)0, 0); - if(next_mer()) { - res.first = mer(); - res.second = count(); - } - return res; - } - - public: - ReadMerFile(const char* path) throw(std::runtime_error) : - in(path) - { - if(!in.good()) - throw std::runtime_error(std::string("Can't open file '") + path + "'"); - jellyfish::file_header header(in); - jellyfish::mer_dna::k(header.key_len() / 2); - if(header.format() == binary_dumper::format) - binary.reset(new binary_reader(in, &header)); - else if(header.format() == text_dumper::format) - text.reset(new text_reader(in, &header)); - else - throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'"); - } - - bool next_mer() { - if(binary) { - if(binary->next()) return true; - binary.reset(); - } else if(text) { - if(text->next()) return true; - text.reset(); - } - return false; - } - - const MerDNA* mer() const { return static_cast(binary ? &binary->key() : &text->key()); } - unsigned long count() const { return binary ? binary->val() : text->val(); } - -#ifdef SWIGRUBY - void each() { - if(!rb_block_given_p()) return; - while(next_mer()) { - auto m = SWIG_NewPointerObj(const_cast(mer()), SWIGTYPE_p_MerDNA, 0); - auto c = SWIG_From_unsigned_SS_long(count()); - rb_yield(rb_ary_new3(2, m, c)); - } - } -#endif - -#ifdef SWIGPERL - std::pair each() { return next_mer__(); } -#endif - -#ifdef SWIGPYTHON - ReadMerFile* __iter__() { return this; } - std::pair __next__() { return next_mer__(); } - std::pair next() { return next_mer__(); } -#endif - }; -%} - -%feature("autodoc", "Read a Jellyfish database sequentially"); -class ReadMerFile { - public: - %feature("autodoc", "Open the jellyfish database"); - ReadMerFile(const char* path) throw(std::runtime_error); - %feature("autodoc", "Move to the next mer in the file. Returns false if no mers left, true otherwise"); - bool next_mer(); - %feature("autodoc", "Returns current mer"); - const MerDNA* mer() const; - %feature("autodoc", "Returns the count of the current mer"); - unsigned long count() const; - - %feature("autodoc", "Iterate through all the mers in the file, passing two values: a mer and its count"); -#ifdef SWIGRUBY - void each(); -#endif - -#ifdef SWIGPERL - std::pair each(); -#endif - -#ifdef SWIGPYTHON - ReadMerFile* __iter__(); - std::pair __next__(); - std::pair next() { return __next__(); } -#endif - }; diff --git a/src/modifiedJellyfish/swig/perl5/jellyfish.pm b/src/modifiedJellyfish/swig/perl5/jellyfish.pm deleted file mode 100644 index 6098a5e0..00000000 --- a/src/modifiedJellyfish/swig/perl5/jellyfish.pm +++ /dev/null @@ -1,325 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 3.0.2 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - -package jellyfish; -use base qw(Exporter); -use base qw(DynaLoader); -package jellyfishc; -bootstrap jellyfish; -package jellyfish; -@EXPORT = qw(); - -# ---------- BASE METHODS ------------- - -package jellyfish; - -sub TIEHASH { - my ($classname,$obj) = @_; - return bless $obj, $classname; -} - -sub CLEAR { } - -sub FIRSTKEY { } - -sub NEXTKEY { } - -sub FETCH { - my ($self,$field) = @_; - my $member_func = "swig_${field}_get"; - $self->$member_func(); -} - -sub STORE { - my ($self,$field,$newval) = @_; - my $member_func = "swig_${field}_set"; - $self->$member_func($newval); -} - -sub this { - my $ptr = shift; - return tied(%$ptr); -} - - -# ------- FUNCTION WRAPPERS -------- - -package jellyfish; - -*string_mers = *jellyfishc::string_mers; -*string_canonicals = *jellyfishc::string_canonicals; - -############# Class : jellyfish::MerDNA ############## - -package jellyfish::MerDNA; -use overload - '""' => sub { $_[0]->__str__()}, - "<" => sub { $_[0]->__lt__($_[1])}, - "==" => sub { $_[0]->__eq__($_[1])}, - ">" => sub { $_[0]->__gt__($_[1])}, - "=" => sub { my $class = ref($_[0]); $class->new($_[0]) }, - "fallback" => 1; -use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); -@ISA = qw( jellyfish ); -%OWNER = (); -%ITERATORS = (); -sub new { - my $pkg = shift; - my $self = jellyfishc::new_MerDNA(@_); - bless $self, $pkg if defined($self); -} - -*k = *jellyfishc::MerDNA_k; -*polyA = *jellyfishc::MerDNA_polyA; -*polyC = *jellyfishc::MerDNA_polyC; -*polyG = *jellyfishc::MerDNA_polyG; -*polyT = *jellyfishc::MerDNA_polyT; -*randomize = *jellyfishc::MerDNA_randomize; -*is_homopolymer = *jellyfishc::MerDNA_is_homopolymer; -*shift_left = *jellyfishc::MerDNA_shift_left; -*shift_right = *jellyfishc::MerDNA_shift_right; -*canonicalize = *jellyfishc::MerDNA_canonicalize; -*reverse_complement = *jellyfishc::MerDNA_reverse_complement; -*get_canonical = *jellyfishc::MerDNA_get_canonical; -*get_reverse_complement = *jellyfishc::MerDNA_get_reverse_complement; -*__eq__ = *jellyfishc::MerDNA___eq__; -*__lt__ = *jellyfishc::MerDNA___lt__; -*__gt__ = *jellyfishc::MerDNA___gt__; -*dup = *jellyfishc::MerDNA_dup; -*__str__ = *jellyfishc::MerDNA___str__; -*set = *jellyfishc::MerDNA_set; -*get_base = *jellyfishc::MerDNA_get_base; -*set_base = *jellyfishc::MerDNA_set_base; -sub DESTROY { - return unless $_[0]->isa('HASH'); - my $self = tied(%{$_[0]}); - return unless defined $self; - delete $ITERATORS{$self}; - if (exists $OWNER{$self}) { - jellyfishc::delete_MerDNA($self); - delete $OWNER{$self}; - } -} - -sub DISOWN { - my $self = shift; - my $ptr = tied(%$self); - delete $OWNER{$ptr}; -} - -sub ACQUIRE { - my $self = shift; - my $ptr = tied(%$self); - $OWNER{$ptr} = 1; -} - - -############# Class : jellyfish::QueryMerFile ############## - -package jellyfish::QueryMerFile; -use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); -@ISA = qw( jellyfish ); -%OWNER = (); -%ITERATORS = (); -sub new { - my $pkg = shift; - my $self = jellyfishc::new_QueryMerFile(@_); - bless $self, $pkg if defined($self); -} - -*get = *jellyfishc::QueryMerFile_get; -sub DESTROY { - return unless $_[0]->isa('HASH'); - my $self = tied(%{$_[0]}); - return unless defined $self; - delete $ITERATORS{$self}; - if (exists $OWNER{$self}) { - jellyfishc::delete_QueryMerFile($self); - delete $OWNER{$self}; - } -} - -sub DISOWN { - my $self = shift; - my $ptr = tied(%$self); - delete $OWNER{$ptr}; -} - -sub ACQUIRE { - my $self = shift; - my $ptr = tied(%$self); - $OWNER{$ptr} = 1; -} - - -############# Class : jellyfish::ReadMerFile ############## - -package jellyfish::ReadMerFile; -use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); -@ISA = qw( jellyfish ); -%OWNER = (); -%ITERATORS = (); -sub new { - my $pkg = shift; - my $self = jellyfishc::new_ReadMerFile(@_); - bless $self, $pkg if defined($self); -} - -*next_mer = *jellyfishc::ReadMerFile_next_mer; -*mer = *jellyfishc::ReadMerFile_mer; -*count = *jellyfishc::ReadMerFile_count; -*each = *jellyfishc::ReadMerFile_each; -sub DESTROY { - return unless $_[0]->isa('HASH'); - my $self = tied(%{$_[0]}); - return unless defined $self; - delete $ITERATORS{$self}; - if (exists $OWNER{$self}) { - jellyfishc::delete_ReadMerFile($self); - delete $OWNER{$self}; - } -} - -sub DISOWN { - my $self = shift; - my $ptr = tied(%$self); - delete $OWNER{$ptr}; -} - -sub ACQUIRE { - my $self = shift; - my $ptr = tied(%$self); - $OWNER{$ptr} = 1; -} - - -############# Class : jellyfish::HashCounter ############## - -package jellyfish::HashCounter; -use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); -@ISA = qw( jellyfish ); -%OWNER = (); -%ITERATORS = (); -sub new { - my $pkg = shift; - my $self = jellyfishc::new_HashCounter(@_); - bless $self, $pkg if defined($self); -} - -*size = *jellyfishc::HashCounter_size; -*val_len = *jellyfishc::HashCounter_val_len; -*add = *jellyfishc::HashCounter_add; -*update_add = *jellyfishc::HashCounter_update_add; -*get = *jellyfishc::HashCounter_get; -sub DESTROY { - return unless $_[0]->isa('HASH'); - my $self = tied(%{$_[0]}); - return unless defined $self; - delete $ITERATORS{$self}; - if (exists $OWNER{$self}) { - jellyfishc::delete_HashCounter($self); - delete $OWNER{$self}; - } -} - -sub DISOWN { - my $self = shift; - my $ptr = tied(%$self); - delete $OWNER{$ptr}; -} - -sub ACQUIRE { - my $self = shift; - my $ptr = tied(%$self); - $OWNER{$ptr} = 1; -} - - -############# Class : jellyfish::HashSet ############## - -package jellyfish::HashSet; -use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); -@ISA = qw( jellyfish ); -%OWNER = (); -%ITERATORS = (); -sub new { - my $pkg = shift; - my $self = jellyfishc::new_HashSet(@_); - bless $self, $pkg if defined($self); -} - -*size = *jellyfishc::HashSet_size; -*add = *jellyfishc::HashSet_add; -*get = *jellyfishc::HashSet_get; -sub DESTROY { - return unless $_[0]->isa('HASH'); - my $self = tied(%{$_[0]}); - return unless defined $self; - delete $ITERATORS{$self}; - if (exists $OWNER{$self}) { - jellyfishc::delete_HashSet($self); - delete $OWNER{$self}; - } -} - -sub DISOWN { - my $self = shift; - my $ptr = tied(%$self); - delete $OWNER{$ptr}; -} - -sub ACQUIRE { - my $self = shift; - my $ptr = tied(%$self); - $OWNER{$ptr} = 1; -} - - -############# Class : jellyfish::StringMers ############## - -package jellyfish::StringMers; -use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); -@ISA = qw( jellyfish ); -%OWNER = (); -%ITERATORS = (); -sub new { - my $pkg = shift; - my $self = jellyfishc::new_StringMers(@_); - bless $self, $pkg if defined($self); -} - -*next_mer = *jellyfishc::StringMers_next_mer; -*mer = *jellyfishc::StringMers_mer; -*each = *jellyfishc::StringMers_each; -sub DESTROY { - return unless $_[0]->isa('HASH'); - my $self = tied(%{$_[0]}); - return unless defined $self; - delete $ITERATORS{$self}; - if (exists $OWNER{$self}) { - jellyfishc::delete_StringMers($self); - delete $OWNER{$self}; - } -} - -sub DISOWN { - my $self = shift; - my $ptr = tied(%$self); - delete $OWNER{$ptr}; -} - -sub ACQUIRE { - my $self = shift; - my $ptr = tied(%$self); - $OWNER{$ptr} = 1; -} - - -# ------- VARIABLE STUBS -------- - -package jellyfish; - -1; diff --git a/src/modifiedJellyfish/swig/perl5/swig_wrap.cpp b/src/modifiedJellyfish/swig/perl5/swig_wrap.cpp deleted file mode 100644 index af3f3de6..00000000 --- a/src/modifiedJellyfish/swig/perl5/swig_wrap.cpp +++ /dev/null @@ -1,4773 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.2 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - -#define SWIGPERL -#define SWIG_CASTRANK_MODE - - -#ifdef __cplusplus -/* SwigValueWrapper is described in swig.swg */ -template class SwigValueWrapper { - struct SwigMovePointer { - T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } - } pointer; - SwigValueWrapper& operator=(const SwigValueWrapper& rhs); - SwigValueWrapper(const SwigValueWrapper& rhs); -public: - SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } - operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -}; - -template T SwigValueInit() { - return T(); -} -#endif - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - - -/* ----------------------------------------------------------------------------- - * swigrun.swg - * - * This file contains generic C API SWIG runtime support for pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -/* This should only be incremented when either the layout of swig_type_info changes, - or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" - -/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -# define SWIG_QUOTE_STRING(x) #x -# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -# define SWIG_TYPE_TABLE_NAME -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the SWIG runtime code. - In 99.9% of the cases, SWIG just needs to declare them as 'static'. - - But only do this if strictly necessary, ie, if you have problems - with your compiler or suchlike. -*/ - -#ifndef SWIGRUNTIME -# define SWIGRUNTIME SWIGINTERN -#endif - -#ifndef SWIGRUNTIMEINLINE -# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - -/* Generic buffer size */ -#ifndef SWIG_BUFFER_SIZE -# define SWIG_BUFFER_SIZE 1024 -#endif - -/* Flags for pointer conversions */ -#define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 - -/* Flags for new pointer objects */ -#define SWIG_POINTER_OWN 0x1 - - -/* - Flags/methods for returning states. - - The SWIG conversion methods, as ConvertPtr, return an integer - that tells if the conversion was successful or not. And if not, - an error code can be returned (see swigerrors.swg for the codes). - - Use the following macros/flags to set or process the returning - states. - - In old versions of SWIG, code such as the following was usually written: - - if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { - // success code - } else { - //fail code - } - - Now you can be more explicit: - - int res = SWIG_ConvertPtr(obj,vptr,ty.flags); - if (SWIG_IsOK(res)) { - // success code - } else { - // fail code - } - - which is the same really, but now you can also do - - Type *ptr; - int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); - if (SWIG_IsOK(res)) { - // success code - if (SWIG_IsNewObj(res) { - ... - delete *ptr; - } else { - ... - } - } else { - // fail code - } - - I.e., now SWIG_ConvertPtr can return new objects and you can - identify the case and take care of the deallocation. Of course that - also requires SWIG_ConvertPtr to return new result values, such as - - int SWIG_ConvertPtr(obj, ptr,...) { - if () { - if () { - *ptr = ; - return SWIG_NEWOBJ; - } else { - *ptr = ; - return SWIG_OLDOBJ; - } - } else { - return SWIG_BADOBJ; - } - } - - Of course, returning the plain '0(success)/-1(fail)' still works, but you can be - more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - SWIG errors code. - - Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this - - int food(double) - int fooi(int); - - and you call - - food(1) // cast rank '1' (1 -> 1.0) - fooi(1) // cast rank '0' - - just use the SWIG_AddCast()/SWIG_CheckState() -*/ - -#define SWIG_OK (0) -#define SWIG_ERROR (-1) -#define SWIG_IsOK(r) (r >= 0) -#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) - -/* The CastRankLimit says how many bits are used for the cast rank */ -#define SWIG_CASTRANKLIMIT (1 << 8) -/* The NewMask denotes the object was created (using new/malloc) */ -#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ -#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) -/* Simple returning values */ -#define SWIG_BADOBJ (SWIG_ERROR) -#define SWIG_OLDOBJ (SWIG_OK) -#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) -#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ -#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) -#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) -#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) -#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) -#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) -#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - -/* Cast-Rank Mode */ -#if defined(SWIG_CASTRANK_MODE) -# ifndef SWIG_TypeRank -# define SWIG_TypeRank unsigned long -# endif -# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ -# define SWIG_MAXCASTRANK (2) -# endif -# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) -# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) -SWIGINTERNINLINE int SWIG_AddCast(int r) { - return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; -} -SWIGINTERNINLINE int SWIG_CheckState(int r) { - return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; -} -#else /* no cast-rank mode */ -# define SWIG_AddCast(r) (r) -# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) -#endif - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *(*swig_converter_func)(void *, int *); -typedef struct swig_type_info *(*swig_dycast_func)(void **); - -/* Structure to store information on one type */ -typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ - struct swig_cast_info *cast; /* linked list of types that can cast into this type */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ -} swig_type_info; - -/* Structure to store a type and conversion function used for casting */ -typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ -} swig_cast_info; - -/* Structure used to store module information - * Each module generates one structure like this, and the runtime collects - * all of these structures and stores them in a circularly linked list.*/ -typedef struct swig_module_info { - swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ - size_t size; /* Number of types in this module */ - struct swig_module_info *next; /* Pointer to next element in circularly linked list */ - swig_type_info **type_initial; /* Array of initially generated type structures */ - swig_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ -} swig_module_info; - -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class" == "Class", etc. - - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; - } - return (int)((l1 - f1) - (l2 - f2)); -} - -/* - Check type equivalence in a name list like ||... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb -*/ -SWIGRUNTIME int -SWIG_TypeCmp(const char *nb, const char *tb) { - int equiv = 1; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (equiv != 0 && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = SWIG_TypeNameComp(nb, ne, tb, te); - if (*ne) ++ne; - } - return equiv; -} - -/* - Check type equivalence in a name list like ||... - Return 0 if not equal, 1 if equal -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; -} - -/* - Check the typename -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Cast a pointer up an inheritance hierarchy -*/ -SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (!type) return NULL; - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; - } - else - return type->name; -} - -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void -SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; - /* if (ti->clientdata == clientdata) return; */ - ti->clientdata = clientdata; - - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); - } - } - cast = cast->next; - } -} -SWIGRUNTIME void -SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { - SWIG_TypeClientData(ti, clientdata); - ti->owndata = 1; -} - -/* - Search for a swig_type_info structure only by mangled name - Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - swig_module_info *iter = start; - do { - if (iter->size) { - size_t l = 0; - size_t r = iter->size - 1; - do { - /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - size_t i = (l + r) >> 1; - const char *iname = iter->types[i]->name; - if (iname) { - int compare = strcmp(name, iname); - if (compare == 0) { - return iter->types[i]; - } else if (compare < 0) { - if (i) { - r = i - 1; - } else { - break; - } - } else if (compare > 0) { - l = i + 1; - } - } else { - break; /* should never happen */ - } - } while (l <= r); - } - iter = iter->next; - } while (iter != end); - return 0; -} - -/* - Search for a swig_type_info structure for either a mangled name or a human readable name. - It first searches the mangled names of the types, which is a O(log #types) - If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - /* STEP 1: Search the name field using binary search */ - swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); - if (ret) { - return ret; - } else { - /* STEP 2: If the type hasn't been found, do a complete search - of the str field (the human readable name) */ - swig_module_info *iter = start; - do { - size_t i = 0; - for (; i < iter->size; ++i) { - if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) - return iter->types[i]; - } - iter = iter->next; - } while (iter != end); - } - - /* neither found a match */ - return 0; -} - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static const char hex[17] = "0123456789abcdef"; - const unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - unsigned char uu = *u; - *(c++) = hex[(uu & 0xf0) >> 4]; - *(c++) = hex[uu & 0xf]; - } - return c; -} - -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - char d = *(c++); - unsigned char uu; - if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); - else - return (char *) 0; - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); - else - return (char *) 0; - *u = uu; - } - return c; -} - -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} - -#ifdef __cplusplus -} -#endif - -/* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 -#define SWIG_SystemError -10 -#define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 -#define SWIG_NullReferenceError -13 - - - -#ifdef __cplusplus -/* Needed on some windows machines---since MS plays funny games with the header files under C++ */ -#include -#include -extern "C" { -#endif -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - -/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */ - -/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */ -#ifndef PERL_REVISION -# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) -# define PERL_PATCHLEVEL_H_IMPLICIT -# include -# endif -# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) -# include -# endif -# ifndef PERL_REVISION -# define PERL_REVISION (5) -# define PERL_VERSION PATCHLEVEL -# define PERL_SUBVERSION SUBVERSION -# endif -#endif - -#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) -#define PerlIO_exportFILE(fh,fl) (FILE*)(fh) -#endif - -#ifndef SvIOK_UV -# define SvIOK_UV(sv) (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv))) -#endif - -#ifndef SvUOK -# define SvUOK(sv) SvIOK_UV(sv) -#endif - -#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))) -# define PL_sv_undef sv_undef -# define PL_na na -# define PL_errgv errgv -# define PL_sv_no sv_no -# define PL_sv_yes sv_yes -# define PL_markstack_ptr markstack_ptr -#endif - -#ifndef IVSIZE -# ifdef LONGSIZE -# define IVSIZE LONGSIZE -# else -# define IVSIZE 4 /* A bold guess, but the best we can make. */ -# endif -#endif - -#ifndef INT2PTR -# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) -# define PTRV UV -# define INT2PTR(any,d) (any)(d) -# else -# if PTRSIZE == LONGSIZE -# define PTRV unsigned long -# else -# define PTRV unsigned -# endif -# define INT2PTR(any,d) (any)(PTRV)(d) -# endif - -# define NUM2PTR(any,d) (any)(PTRV)(d) -# define PTR2IV(p) INT2PTR(IV,p) -# define PTR2UV(p) INT2PTR(UV,p) -# define PTR2NV(p) NUM2PTR(NV,p) - -# if PTRSIZE == LONGSIZE -# define PTR2ul(p) (unsigned long)(p) -# else -# define PTR2ul(p) INT2PTR(unsigned long,p) -# endif -#endif /* !INT2PTR */ - -#ifndef SvPV_nolen -# define SvPV_nolen(x) SvPV(x,PL_na) -#endif - -#ifndef get_sv -# define get_sv perl_get_sv -#endif - -#ifndef ERRSV -# define ERRSV get_sv("@",FALSE) -#endif - -#ifndef pTHX_ -#define pTHX_ -#endif - -#include -#ifdef __cplusplus -} -#endif - -/* ----------------------------------------------------------------------------- - * error manipulation - * ----------------------------------------------------------------------------- */ - -SWIGINTERN const char* -SWIG_Perl_ErrorType(int code) { - switch(code) { - case SWIG_MemoryError: - return "MemoryError"; - case SWIG_IOError: - return "IOError"; - case SWIG_RuntimeError: - return "RuntimeError"; - case SWIG_IndexError: - return "IndexError"; - case SWIG_TypeError: - return "TypeError"; - case SWIG_DivisionByZero: - return "ZeroDivisionError"; - case SWIG_OverflowError: - return "OverflowError"; - case SWIG_SyntaxError: - return "SyntaxError"; - case SWIG_ValueError: - return "ValueError"; - case SWIG_SystemError: - return "SystemError"; - case SWIG_AttributeError: - return "AttributeError"; - default: - return "RuntimeError"; - } -} - - -/* ----------------------------------------------------------------------------- - * perlrun.swg - * - * This file contains the runtime support for Perl modules - * and includes code for managing global variables and pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -#ifdef PERL_OBJECT -#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl), -#define SWIG_PERL_OBJECT_CALL pPerl, -#else -#define SWIG_PERL_OBJECT_DECL -#define SWIG_PERL_OBJECT_CALL -#endif - -/* Common SWIG API */ - -/* for raw pointers */ -#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags) -#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own) -#define SWIG_NewPointerObj(p, type, flags) SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags) -#define swig_owntype int - -/* for raw packed data */ -#define SWIG_ConvertPacked(obj, p, s, type) SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type) -#define SWIG_NewPackedObj(p, s, type) SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type) - -/* for class or struct pointers */ -#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) -#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) - -/* for C or C++ function pointers */ -#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0) -#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0) - -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewMemberObj(ptr, sz, type) SWIG_NewPackedObj(ptr, sz, type) - - -/* Runtime API */ - -#define SWIG_GetModule(clientdata) SWIG_Perl_GetModule(clientdata) -#define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer) - - -/* Error manipulation */ - -#define SWIG_ErrorType(code) SWIG_Perl_ErrorType(code) -#define SWIG_Error(code, msg) sv_setpvf(get_sv("@", GV_ADD), "%s %s", SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail - -/* Perl-specific SWIG API */ - -#define SWIG_MakePtr(sv, ptr, type, flags) SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags) -#define SWIG_MakePackedObj(sv, p, s, type) SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type) -#define SWIG_SetError(str) SWIG_Error(SWIG_RuntimeError, str) - - -#define SWIG_PERL_DECL_ARGS_1(arg1) (SWIG_PERL_OBJECT_DECL arg1) -#define SWIG_PERL_CALL_ARGS_1(arg1) (SWIG_PERL_OBJECT_CALL arg1) -#define SWIG_PERL_DECL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_DECL arg1, arg2) -#define SWIG_PERL_CALL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_CALL arg1, arg2) - -/* ----------------------------------------------------------------------------- - * pointers/data manipulation - * ----------------------------------------------------------------------------- */ - -/* For backward compatibility only */ -#define SWIG_POINTER_EXCEPTION 0 - -#ifdef __cplusplus -extern "C" { -#endif - -#define SWIG_OWNER SWIG_POINTER_OWN -#define SWIG_SHADOW SWIG_OWNER << 1 - -#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL - -/* SWIG Perl macros */ - -/* Macro to declare an XS function */ -#ifndef XSPROTO -# define XSPROTO(name) void name(pTHX_ CV* cv) -#endif - -/* Macro to call an XS function */ -#ifdef PERL_OBJECT -# define SWIG_CALLXS(_name) _name(cv,pPerl) -#else -# ifndef MULTIPLICITY -# define SWIG_CALLXS(_name) _name(cv) -# else -# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) -# endif -#endif - -#ifdef PERL_OBJECT -#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; - -#ifdef __cplusplus -extern "C" { -#endif -typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); -#ifdef __cplusplus -} -#endif - -#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) -#define SWIGCLASS_STATIC - -#else /* PERL_OBJECT */ - -#define MAGIC_PPERL -#define SWIGCLASS_STATIC static SWIGUNUSED - -#ifndef MULTIPLICITY -#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) - -#ifdef __cplusplus -extern "C" { -#endif -typedef int (*SwigMagicFunc)(SV *, MAGIC *); -#ifdef __cplusplus -} -#endif - -#else /* MULTIPLICITY */ - -#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) - -#ifdef __cplusplus -extern "C" { -#endif -typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); -#ifdef __cplusplus -} -#endif - -#endif /* MULTIPLICITY */ -#endif /* PERL_OBJECT */ - -# ifdef PERL_OBJECT -# define SWIG_croak_null() SWIG_Perl_croak_null(pPerl) -static void SWIG_Perl_croak_null(CPerlObj *pPerl) -# else -static void SWIG_croak_null() -# endif -{ - SV *err = get_sv("@", GV_ADD); -# if (PERL_VERSION < 6) - croak("%_", err); -# else - if (sv_isobject(err)) - croak(0); - else - croak("%s", SvPV_nolen(err)); -# endif -} - - -/* - Define how strict is the cast between strings and integers/doubles - when overloading between these types occurs. - - The default is making it as strict as possible by using SWIG_AddCast - when needed. - - You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to - disable the SWIG_AddCast, making the casting between string and - numbers less strict. - - In the end, we try to solve the overloading between strings and - numerical types in the more natural way, but if you can avoid it, - well, avoid it using %rename, for example. -*/ -#ifndef SWIG_PERL_NO_STRICT_STR2NUM -# ifndef SWIG_PERL_STRICT_STR2NUM -# define SWIG_PERL_STRICT_STR2NUM -# endif -#endif -#ifdef SWIG_PERL_STRICT_STR2NUM -/* string takes precedence */ -#define SWIG_Str2NumCast(x) SWIG_AddCast(x) -#else -/* number takes precedence */ -#define SWIG_Str2NumCast(x) x -#endif - - - -#include - -SWIGRUNTIME const char * -SWIG_Perl_TypeProxyName(const swig_type_info *type) { - if (!type) return NULL; - if (type->clientdata != NULL) { - return (const char*) type->clientdata; - } - else { - return type->name; - } -} - -/* Identical to SWIG_TypeCheck, except for strcmp comparison */ -SWIGRUNTIME swig_cast_info * -SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(SWIG_Perl_TypeProxyName(iter->type), c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* Function for getting a pointer value */ - -SWIGRUNTIME int -SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) { - swig_cast_info *tc; - void *voidptr = (void *)0; - SV *tsv = 0; - - if (own) - *own = 0; - - /* If magical, apply more magic */ - if (SvGMAGICAL(sv)) - mg_get(sv); - - /* Check to see if this is an object */ - if (sv_isobject(sv)) { - IV tmp = 0; - tsv = (SV*) SvRV(sv); - if ((SvTYPE(tsv) == SVt_PVHV)) { - MAGIC *mg; - if (SvMAGICAL(tsv)) { - mg = mg_find(tsv,'P'); - if (mg) { - sv = mg->mg_obj; - if (sv_isobject(sv)) { - tsv = (SV*)SvRV(sv); - tmp = SvIV(tsv); - } - } - } else { - return SWIG_ERROR; - } - } else { - tmp = SvIV(tsv); - } - voidptr = INT2PTR(void *,tmp); - } else if (! SvOK(sv)) { /* Check for undef */ - *(ptr) = (void *) 0; - return SWIG_OK; - } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ - if (!SvROK(sv)) { - /* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value. */ - if (SvIOK(sv)) { - return SWIG_ERROR; - } else { - /* NULL pointer (reference to undef). */ - *(ptr) = (void *) 0; - return SWIG_OK; - } - } else { - return SWIG_ERROR; - } - } else { /* Don't know what it is */ - return SWIG_ERROR; - } - if (_t) { - /* Now see if the types match */ - char *_c = HvNAME(SvSTASH(SvRV(sv))); - tc = SWIG_TypeProxyCheck(_c,_t); -#ifdef SWIG_DIRECTORS - if (!tc && !sv_derived_from(sv,SWIG_Perl_TypeProxyName(_t))) { -#else - if (!tc) { -#endif - return SWIG_ERROR; - } - { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,voidptr,&newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ - if (own) - *own = *own | SWIG_CAST_NEW_MEMORY; - } - } - } else { - *ptr = voidptr; - } - - /* - * DISOWN implementation: we need a perl guru to check this one. - */ - if (tsv && (flags & SWIG_POINTER_DISOWN)) { - /* - * almost copy paste code from below SWIG_POINTER_OWN setting - */ - SV *obj = sv; - HV *stash = SvSTASH(SvRV(obj)); - GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE); - if (isGV(gv)) { - HV *hv = GvHVn(gv); - /* - * To set ownership (see below), a newSViv(1) entry is added. - * Hence, to remove ownership, we delete the entry. - */ - if (hv_exists_ent(hv, obj, 0)) { - hv_delete_ent(hv, obj, 0, 0); - } - } - } - return SWIG_OK; -} - -SWIGRUNTIME int -SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) { - return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0); -} - -SWIGRUNTIME void -SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) { - if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) { - SV *self; - SV *obj=newSV(0); - HV *hash=newHV(); - HV *stash; - sv_setref_pv(obj, SWIG_Perl_TypeProxyName(t), ptr); - stash=SvSTASH(SvRV(obj)); - if (flags & SWIG_POINTER_OWN) { - HV *hv; - GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE); - if (!isGV(gv)) - gv_init(gv, stash, "OWNER", 5, FALSE); - hv=GvHVn(gv); - hv_store_ent(hv, obj, newSViv(1), 0); - } - sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0); - SvREFCNT_dec(obj); - self=newRV_noinc((SV *)hash); - sv_setsv(sv, self); - SvREFCNT_dec((SV *)self); - sv_bless(sv, stash); - } - else { - sv_setref_pv(sv, SWIG_Perl_TypeProxyName(t), ptr); - } -} - -SWIGRUNTIMEINLINE SV * -SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) { - SV *result = sv_newmortal(); - SWIG_MakePtr(result, ptr, t, flags); - return result; -} - -SWIGRUNTIME void -SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) { - char result[1024]; - char *r = result; - if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - strcpy(r,SWIG_Perl_TypeProxyName(type)); - sv_setpv(sv, result); -} - -SWIGRUNTIME SV * -SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) { - SV *result = sv_newmortal(); - SWIG_Perl_MakePackedObj(result, ptr, sz, type); - return result; -} - -/* Convert a packed value value */ -SWIGRUNTIME int -SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) { - swig_cast_info *tc; - const char *c = 0; - - if ((!obj) || (!SvOK(obj))) return SWIG_ERROR; - c = SvPV_nolen(obj); - /* Pointer values must start with leading underscore */ - if (*c != '_') return SWIG_ERROR; - c++; - c = SWIG_UnpackData(c,ptr,sz); - if (ty) { - tc = SWIG_TypeCheck(c,ty); - if (!tc) return SWIG_ERROR; - } - return SWIG_OK; -} - - -/* Macros for low-level exception handling */ -#define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; } - - -typedef XSPROTO(SwigPerlWrapper); -typedef SwigPerlWrapper *SwigPerlWrapperPtr; - -/* Structure for command table */ -typedef struct { - const char *name; - SwigPerlWrapperPtr wrapper; -} swig_command_info; - -/* Information for constant table */ - -#define SWIG_INT 1 -#define SWIG_FLOAT 2 -#define SWIG_STRING 3 -#define SWIG_POINTER 4 -#define SWIG_BINARY 5 - -/* Constant information structure */ -typedef struct swig_constant_info { - int type; - const char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_constant_info; - - -/* Structure for variable table */ -typedef struct { - const char *name; - SwigMagicFunc set; - SwigMagicFunc get; - swig_type_info **type; -} swig_variable_info; - -/* Magic variable code */ -#ifndef PERL_OBJECT -# ifdef __cplusplus -# define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast(a),b,c) -# else -# define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c) -# endif -# ifndef MULTIPLICITY -SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) -# else -SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) -# endif -#else -# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) -SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) -#endif -{ - MAGIC *mg; - sv_magic(sv,sv,'U',name,strlen(name)); - mg = mg_find(sv,'U'); - mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); - mg->mg_virtual->svt_get = (SwigMagicFunc) get; - mg->mg_virtual->svt_set = (SwigMagicFunc) set; - mg->mg_virtual->svt_len = 0; - mg->mg_virtual->svt_clear = 0; - mg->mg_virtual->svt_free = 0; -} - - -SWIGRUNTIME swig_module_info * -SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) { - static void *type_pointer = (void *)0; - SV *pointer; - - /* first check if pointer already created */ - if (!type_pointer) { - pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI); - if (pointer && SvOK(pointer)) { - type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); - } - } - - return (swig_module_info *) type_pointer; -} - -SWIGRUNTIME void -SWIG_Perl_SetModule(swig_module_info *module) { - SV *pointer; - - /* create a new pointer */ - pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI); - sv_setiv(pointer, PTR2IV(module)); -} - -#ifdef __cplusplus -} -#endif - -/* Workaround perl5 global namespace pollution. Note that undefining library - * functions like fopen will not solve the problem on all platforms as fopen - * might be a macro on Windows but not necessarily on other operating systems. */ -#ifdef do_open - #undef do_open -#endif -#ifdef do_close - #undef do_close -#endif -#ifdef do_exec - #undef do_exec -#endif -#ifdef scalar - #undef scalar -#endif -#ifdef list - #undef list -#endif -#ifdef apply - #undef apply -#endif -#ifdef convert - #undef convert -#endif -#ifdef Error - #undef Error -#endif -#ifdef form - #undef form -#endif -#ifdef vform - #undef vform -#endif -#ifdef LABEL - #undef LABEL -#endif -#ifdef METHOD - #undef METHOD -#endif -#ifdef Move - #undef Move -#endif -#ifdef yylex - #undef yylex -#endif -#ifdef yyparse - #undef yyparse -#endif -#ifdef yyerror - #undef yyerror -#endif -#ifdef invert - #undef invert -#endif -#ifdef ref - #undef ref -#endif -#ifdef read - #undef read -#endif -#ifdef write - #undef write -#endif -#ifdef eof - #undef eof -#endif -#ifdef close - #undef close -#endif -#ifdef rewind - #undef rewind -#endif -#ifdef free - #undef free -#endif -#ifdef malloc - #undef malloc -#endif -#ifdef calloc - #undef calloc -#endif -#ifdef Stat - #undef Stat -#endif -#ifdef check - #undef check -#endif -#ifdef seekdir - #undef seekdir -#endif -#ifdef open - #undef open -#endif -#ifdef readdir - #undef readdir -#endif -#ifdef bind - #undef bind -#endif -#ifdef access - #undef access -#endif -#ifdef stat - #undef stat -#endif - -#ifdef bool - /* Leave if macro is from C99 stdbool.h */ - #ifndef __bool_true_false_are_defined - #undef bool - #endif -#endif - - - - -#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) - -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else - - - - #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) - - -/* -------- TYPES TABLE (BEGIN) -------- */ - -#define SWIGTYPE_p_HashCounter swig_types[0] -#define SWIGTYPE_p_HashSet swig_types[1] -#define SWIGTYPE_p_MerDNA swig_types[2] -#define SWIGTYPE_p_QueryMerFile swig_types[3] -#define SWIGTYPE_p_ReadMerFile swig_types[4] -#define SWIGTYPE_p_StringMers swig_types[5] -#define SWIGTYPE_p_char swig_types[6] -#define SWIGTYPE_p_std__pairT_bool_uint64_t_t swig_types[7] -static swig_type_info *swig_types[9]; -static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0}; -#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) -#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) - -/* -------- TYPES TABLE (END) -------- */ - -#define SWIG_init boot_jellyfish - -#define SWIG_name "jellyfishc::boot_jellyfish" -#define SWIG_prefix "jellyfishc::" - -#define SWIGVERSION 0x030002 -#define SWIG_VERSION SWIGVERSION - - -#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) -#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) - - -#include - - -#ifdef __cplusplus -extern "C" -#endif -#ifndef PERL_OBJECT -#ifndef MULTIPLICITY -SWIGEXPORT void SWIG_init (CV* cv); -#else -SWIGEXPORT void SWIG_init (pTHXo_ CV* cv); -#endif -#else -SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); -#endif - - -#include - - -#include - - -#ifdef SWIGPYTHON -#define SWIG_FILE_WITH_INIT -#endif - -#ifdef SWIGPERL -#undef seed -#undef random -#endif - -#include -#include -#undef die -#include -#include -#include -#include -#include -#undef die - - - class MerDNA : public jellyfish::mer_dna { - public: - MerDNA() = default; - MerDNA(const char* s) : jellyfish::mer_dna(s) { } - MerDNA(const MerDNA& m) : jellyfish::mer_dna(m) { } - MerDNA& operator=(const jellyfish::mer_dna& m) { *static_cast(this) = m; return *this; } - }; - - -SWIGINTERN swig_type_info* -SWIG_pchar_descriptor(void) -{ - static int init = 0; - static swig_type_info* info = 0; - if (!init) { - info = SWIG_TypeQuery("_p_char"); - init = 1; - } - return info; -} - - -SWIGINTERN int -SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc) -{ - if (SvMAGICAL(obj)) { - SV *tmp = sv_newmortal(); - SvSetSV(tmp, obj); - obj = tmp; - } - if (SvPOK(obj)) { - STRLEN len = 0; - char *cstr = SvPV(obj, len); - size_t size = len + 1; - if (cptr) { - if (alloc) { - if (*alloc == SWIG_NEWOBJ) { - *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size))); - } else { - *cptr = cstr; - *alloc = SWIG_OLDOBJ; - } - } - } - if (psize) *psize = size; - return SWIG_OK; - } else { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor) { - char* vptr = 0; - if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) { - if (cptr) *cptr = vptr; - if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; - } - } - } - return SWIG_TypeError; -} - - - - - -SWIGINTERNINLINE SV * -SWIG_From_unsigned_SS_long SWIG_PERL_DECL_ARGS_1(unsigned long value) -{ - SV *sv; - if (value <= UV_MAX) - sv = newSVuv(value); - else - sv = newSVpvf("%lu", value); - return sv_2mortal(sv); -} - - -SWIGINTERNINLINE SV * -SWIG_From_unsigned_SS_int SWIG_PERL_DECL_ARGS_1(unsigned int value) -{ - return SWIG_From_unsigned_SS_long SWIG_PERL_CALL_ARGS_1(value); -} - - -#include -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -SWIGINTERN int -SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val) -{ - if (SvNIOK(obj)) { - if (val) *val = SvNV(obj); - return SWIG_OK; - } else if (SvIOK(obj)) { - if (val) *val = (double) SvIV(obj); - return SWIG_AddCast(SWIG_OK); - } else { - const char *nptr = SvPV_nolen(obj); - if (nptr) { - char *endptr; - double v; - errno = 0; - v = strtod(nptr, &endptr); - if (errno == ERANGE) { - errno = 0; - return SWIG_OverflowError; - } else { - if (*endptr == '\0') { - if (val) *val = v; - return SWIG_Str2NumCast(SWIG_OK); - } - } - } - } - return SWIG_TypeError; -} - - -#include - - -#include - - -SWIGINTERNINLINE int -SWIG_CanCastAsInteger(double *d, double min, double max) { - double x = *d; - if ((min <= x && x <= max)) { - double fx = floor(x); - double cx = ceil(x); - double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ - if ((errno == EDOM) || (errno == ERANGE)) { - errno = 0; - } else { - double summ, reps, diff; - if (rd < x) { - diff = x - rd; - } else if (rd > x) { - diff = rd - x; - } else { - return 1; - } - summ = rd + x; - reps = diff/summ; - if (reps < 8*DBL_EPSILON) { - *d = rd; - return 1; - } - } - } - return 0; -} - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) -{ - if (SvUOK(obj)) { - UV v = SvUV(obj); - if (v <= ULONG_MAX) { - if (val) *val = v; - return SWIG_OK; - } - return SWIG_OverflowError; - } else if (SvIOK(obj)) { - IV v = SvIV(obj); - if (v >= 0 && v <= ULONG_MAX) { - if (val) *val = v; - return SWIG_OK; - } - return SWIG_OverflowError; - } else { - int dispatch = 0; - const char *nptr = SvPV_nolen(obj); - if (nptr) { - char *endptr; - unsigned long v; - errno = 0; - v = strtoul(nptr, &endptr,0); - if (errno == ERANGE) { - errno = 0; - return SWIG_OverflowError; - } else { - if (*endptr == '\0') { - if (val) *val = v; - return SWIG_Str2NumCast(SWIG_OK); - } - } - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { - if (val) *val = (unsigned long)(d); - return res; - } - } - } - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_int SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned int *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v); - if (SWIG_IsOK(res)) { - if ((v > UINT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = static_cast< unsigned int >(v); - } - } - return res; -} - - -SWIGINTERNINLINE SV * -SWIG_From_bool SWIG_PERL_DECL_ARGS_1(bool value) -{ - return boolSV(value); -} - - -SWIGINTERN int -SWIG_AsCharArray(SV * obj, char *val, size_t size) -{ - char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; - int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); - if (SWIG_IsOK(res)) { - /* special case of single char conversion when we don't need space for NUL */ - if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; - if (csize <= size) { - if (val) { - if (csize) memcpy(val, cptr, csize*sizeof(char)); - if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); - } - if (alloc == SWIG_NEWOBJ) { - delete[] cptr; - res = SWIG_DelNewMask(res); - } - return res; - } - if (alloc == SWIG_NEWOBJ) delete[] cptr; - } - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val) -{ - if (SvUOK(obj)) { - UV v = SvUV(obj); - if (v <= LONG_MAX) { - if (val) *val = v; - return SWIG_OK; - } - return SWIG_OverflowError; - } else if (SvIOK(obj)) { - IV v = SvIV(obj); - if (v >= LONG_MIN && v <= LONG_MAX) { - if(val) *val = v; - return SWIG_OK; - } - return SWIG_OverflowError; - } else { - int dispatch = 0; - const char *nptr = SvPV_nolen(obj); - if (nptr) { - char *endptr; - long v; - errno = 0; - v = strtol(nptr, &endptr,0); - if (errno == ERANGE) { - errno = 0; - return SWIG_OverflowError; - } else { - if (*endptr == '\0') { - if (val) *val = v; - return SWIG_Str2NumCast(SWIG_OK); - } - } - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { - if (val) *val = (long)(d); - return res; - } - } - } - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_char SWIG_PERL_DECL_ARGS_2(SV * obj, char *val) -{ - int res = SWIG_AsCharArray(obj, val, 1); - if (!SWIG_IsOK(res)) { - long v; - res = SWIG_AddCast(SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v)); - if (SWIG_IsOK(res)) { - if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) { - if (val) *val = static_cast< char >(v); - } else { - res = SWIG_OverflowError; - } - } - } - return res; -} - - -SWIGINTERNINLINE SV * -SWIG_FromCharPtrAndSize(const char* carray, size_t size) -{ - SV *obj = sv_newmortal(); - if (carray) { - sv_setpvn(obj, carray, size); - } else { - sv_setsv(obj, &PL_sv_undef); - } - return obj; -} - - -SWIGINTERNINLINE SV * -SWIG_From_char SWIG_PERL_DECL_ARGS_1(char c) -{ - return SWIG_FromCharPtrAndSize(&c,1); -} - -SWIGINTERN MerDNA MerDNA_dup(MerDNA const *self){ return MerDNA(*self); } -SWIGINTERN std::string MerDNA___str__(MerDNA *self){ return self->to_str(); } - -SWIGINTERNINLINE SV * -SWIG_From_std_string SWIG_PERL_DECL_ARGS_1(const std::string& s) -{ - return SWIG_FromCharPtrAndSize(s.data(), s.size()); -} - -SWIGINTERN void MerDNA_set(MerDNA *self,char const *s){ *static_cast(self) = s; } -SWIGINTERN char MerDNA_get_base(MerDNA *self,unsigned int i){ return (char)self->base(i); } -SWIGINTERN void MerDNA_set_base(MerDNA *self,unsigned int i,char b){ self->base(i) = b; } - - class QueryMerFile { - std::unique_ptr bf; - jellyfish::mapped_file binary_map; - std::unique_ptr jf; - - public: - QueryMerFile(const char* path) throw(std::runtime_error) { - std::ifstream in(path); - if(!in.good()) - throw std::runtime_error(std::string("Can't open file '") + path + "'"); - jellyfish::file_header header(in); - jellyfish::mer_dna::k(header.key_len() / 2); - if(header.format() == "bloomcounter") { - jellyfish::hash_pair fns(header.matrix(1), header.matrix(2)); - bf.reset(new jellyfish::mer_dna_bloom_filter(header.size(), header.nb_hashes(), in, fns)); - if(!in.good()) - throw std::runtime_error("Bloom filter file is truncated"); - } else if(header.format() == "binary/sorted") { - binary_map.map(path); - jf.reset(new binary_query(binary_map.base() + header.offset(), header.key_len(), header.counter_len(), header.matrix(), - header.size() - 1, binary_map.length() - header.offset())); - } else { - throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'"); - } - } - -#ifdef SWIGPERL - unsigned int get(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); } -#else - unsigned int __getitem__(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); } -#endif - }; - - - class ReadMerFile { - std::ifstream in; - std::unique_ptr binary; - std::unique_ptr text; - - std::pair next_mer__() { - std::pair res((const MerDNA*)0, 0); - if(next_mer()) { - res.first = mer(); - res.second = count(); - } - return res; - } - - public: - ReadMerFile(const char* path) throw(std::runtime_error) : - in(path) - { - if(!in.good()) - throw std::runtime_error(std::string("Can't open file '") + path + "'"); - jellyfish::file_header header(in); - jellyfish::mer_dna::k(header.key_len() / 2); - if(header.format() == binary_dumper::format) - binary.reset(new binary_reader(in, &header)); - else if(header.format() == text_dumper::format) - text.reset(new text_reader(in, &header)); - else - throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'"); - } - - bool next_mer() { - if(binary) { - if(binary->next()) return true; - binary.reset(); - } else if(text) { - if(text->next()) return true; - text.reset(); - } - return false; - } - - const MerDNA* mer() const { return static_cast(binary ? &binary->key() : &text->key()); } - unsigned long count() const { return binary ? binary->val() : text->val(); } - -#ifdef SWIGRUBY - void each() { - if(!rb_block_given_p()) return; - while(next_mer()) { - auto m = SWIG_NewPointerObj(const_cast(mer()), SWIGTYPE_p_MerDNA, 0); - auto c = SWIG_From_unsigned_SS_long(count()); - rb_yield(rb_ary_new3(2, m, c)); - } - } -#endif - -#ifdef SWIGPERL - std::pair each() { return next_mer__(); } -#endif - -#ifdef SWIGPYTHON - ReadMerFile* __iter__() { return this; } - std::pair __next__() { return next_mer__(); } - std::pair next() { return next_mer__(); } -#endif - }; - - - class HashCounter : public jellyfish::cooperative::hash_counter { - typedef jellyfish::cooperative::hash_counter super; - public: - HashCounter(size_t size, unsigned int val_len, unsigned int nb_threads = 1) : \ - super(size, jellyfish::mer_dna::k() * 2, val_len, nb_threads) - { } - - bool add(const MerDNA& m, const int& x) { - bool res; - size_t id; - super::add(m, x, &res, &id); - return res; - } - - }; - - -SWIGINTERNINLINE int -SWIG_AsVal_size_t SWIG_PERL_DECL_ARGS_2(SV * obj, size_t *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); - return res; -} - - -SWIGINTERNINLINE SV * -SWIG_From_size_t SWIG_PERL_DECL_ARGS_1(size_t value) -{ - return SWIG_From_unsigned_SS_long SWIG_PERL_CALL_ARGS_1(static_cast< unsigned long >(value)); -} - - -SWIGINTERN int -SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val) -{ - long v; - int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v); - if (SWIG_IsOK(res)) { - if ((v < INT_MIN || v > INT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = static_cast< int >(v); - } - } - return res; -} - -SWIGINTERN void HashCounter_get(HashCounter const *self,MerDNA const &m,std::pair< bool,uint64_t > *COUNT){ - COUNT->first = self->ary()->get_val_for_key(m, &COUNT->second); - } - - class HashSet : public jellyfish::cooperative::hash_counter { - typedef jellyfish::cooperative::hash_counter super; - public: - HashSet(size_t size, unsigned int nb_threads = 1) : \ - super(size, jellyfish::mer_dna::k() * 2, 0, nb_threads) - { } - - bool add(const MerDNA& m) { - bool res; - size_t id; - super::set(m, &res, &id); - return res; - } - }; - -SWIGINTERN bool HashSet_get(HashSet const *self,MerDNA const &m){ return self->ary()->has_key(m); } - - class StringMers { - const char* m_current; - const char* const m_last; - const bool m_canonical; - MerDNA m_m, m_rcm; - unsigned int m_filled; - - public: - StringMers(const char* str, int len, bool canonical) - : m_current(str) - , m_last(str + len) - , m_canonical(canonical) - , m_filled(0) - { } - - bool next_mer() { - if(m_current == m_last) - return false; - - do { - int code = jellyfish::mer_dna::code(*m_current); - ++m_current; - if(code >= 0) { - m_m.shift_left(code); - if(m_canonical) - m_rcm.shift_right(m_rcm.complement(code)); - m_filled = std::min(m_filled + 1, m_m.k()); - } else - m_filled = 0; - } while(m_filled < m_m.k() && m_current != m_last); - return m_filled == m_m.k(); - } - - const MerDNA* mer() const { return !m_canonical || m_m < m_rcm ? &m_m : &m_rcm; } - - const MerDNA* next_mer__() { - return next_mer() ? mer() : nullptr; - } - - -#ifdef SWIGRUBY - void each() { - if(!rb_block_given_p()) return; - while(next_mer()) { - auto m = SWIG_NewPointerObj(const_cast(mer()), SWIGTYPE_p_MerDNA, 0); - rb_yield(m); - } - } -#endif - -#ifdef SWIGPYTHON - StringMers* __iter__() { return this; } - const MerDNA* __next__() { return next_mer__(); } - const MerDNA* next() { return next_mer__(); } -#endif - -#ifdef SWIGPERL - const MerDNA* each() { return next_mer__(); } -#endif - - }; - - StringMers* string_mers(char* str, int length) { return new StringMers(str, length, false); } - StringMers* string_canonicals(char* str, int length) { return new StringMers(str, length, true); } - - -SWIGINTERN int -SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV *obj, bool* val) -{ - if (obj == &PL_sv_yes) { - if (val) *val = true; - return SWIG_OK; - } else if (obj == &PL_sv_no) { - if (val) *val = false; - return SWIG_OK; - } else { - if (val) *val = SvTRUE(obj) ? true : false; - return SWIG_AddCast(SWIG_OK); - } -} - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef PERL_OBJECT -#define MAGIC_CLASS _wrap_jellyfish_var:: -class _wrap_jellyfish_var : public CPerlObj { -public: -#else -#define MAGIC_CLASS -#endif -SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) { - MAGIC_PPERL - croak("Value is read-only."); - return 0; -} - - -#ifdef PERL_OBJECT -}; -#endif - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -extern "C" { -#endif -XS(_wrap_new_MerDNA__SWIG_0) { - { - int argvi = 0; - MerDNA *result = 0 ; - dXSARGS; - - if ((items < 0) || (items > 0)) { - SWIG_croak("Usage: new_MerDNA();"); - } - result = (MerDNA *)new MerDNA(); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - XSRETURN(argvi); - fail: - SWIG_croak_null(); - } -} - - -XS(_wrap_new_MerDNA__SWIG_1) { - { - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int argvi = 0; - MerDNA *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: new_MerDNA(char const *);"); - } - res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_MerDNA" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - result = (MerDNA *)new MerDNA((char const *)arg1); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - XSRETURN(argvi); - fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - SWIG_croak_null(); - } -} - - -XS(_wrap_new_MerDNA__SWIG_2) { - { - MerDNA *arg1 = 0 ; - void *argp1 ; - int res1 = 0 ; - int argvi = 0; - MerDNA *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: new_MerDNA(MerDNA const &);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_MerDNA" "', argument " "1"" of type '" "MerDNA const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_MerDNA" "', argument " "1"" of type '" "MerDNA const &""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = (MerDNA *)new MerDNA((MerDNA const &)*arg1); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_new_MerDNA) { - dXSARGS; - - { - unsigned long _index = 0; - SWIG_TypeRank _rank = 0; - if (items == 0) { - SWIG_TypeRank _ranki = 0; - SWIG_TypeRank _rankm = 0; - if (!_index || (_ranki < _rank)) { - _rank = _ranki; _index = 1; - if (_rank == _rankm) goto dispatch; - } - } - if (items == 1) { - SWIG_TypeRank _ranki = 0; - SWIG_TypeRank _rankm = 0; - SWIG_TypeRank _pi = 1; - int _v = 0; - { - void *vptr = 0; - int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_MerDNA, 0); - _v = SWIG_CheckState(res); - } - if (!_v) goto check_2; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - if (!_index || (_ranki < _rank)) { - _rank = _ranki; _index = 2; - if (_rank == _rankm) goto dispatch; - } - } - check_2: - - if (items == 1) { - SWIG_TypeRank _ranki = 0; - SWIG_TypeRank _rankm = 0; - SWIG_TypeRank _pi = 1; - int _v = 0; - { - int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0); - _v = SWIG_CheckState(res); - } - if (!_v) goto check_3; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - if (!_index || (_ranki < _rank)) { - _rank = _ranki; _index = 3; - if (_rank == _rankm) goto dispatch; - } - } - check_3: - - dispatch: - switch(_index) { - case 1: - PUSHMARK(MARK); SWIG_CALLXS(_wrap_new_MerDNA__SWIG_0); return; - case 2: - PUSHMARK(MARK); SWIG_CALLXS(_wrap_new_MerDNA__SWIG_2); return; - case 3: - PUSHMARK(MARK); SWIG_CALLXS(_wrap_new_MerDNA__SWIG_1); return; - } - } - - croak("No matching function for overloaded 'new_MerDNA'"); - XSRETURN(0); -} - - -XS(_wrap_MerDNA_k__SWIG_0) { - { - int argvi = 0; - unsigned int result; - dXSARGS; - - if ((items < 0) || (items > 0)) { - SWIG_croak("Usage: MerDNA_k();"); - } - result = (unsigned int)MerDNA::k(); - ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ; - XSRETURN(argvi); - fail: - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_k__SWIG_1) { - { - unsigned int arg1 ; - unsigned int val1 ; - int ecode1 = 0 ; - int argvi = 0; - unsigned int result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_k(unsigned int);"); - } - ecode1 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MerDNA_k" "', argument " "1"" of type '" "unsigned int""'"); - } - arg1 = static_cast< unsigned int >(val1); - result = (unsigned int)MerDNA::k(arg1); - ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_k) { - dXSARGS; - - { - unsigned long _index = 0; - SWIG_TypeRank _rank = 0; - if (items == 0) { - SWIG_TypeRank _ranki = 0; - SWIG_TypeRank _rankm = 0; - if (!_index || (_ranki < _rank)) { - _rank = _ranki; _index = 1; - if (_rank == _rankm) goto dispatch; - } - } - if (items == 1) { - SWIG_TypeRank _ranki = 0; - SWIG_TypeRank _rankm = 0; - SWIG_TypeRank _pi = 1; - int _v = 0; - { - { - int res = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(0), NULL); - _v = SWIG_CheckState(res); - } - } - if (!_v) goto check_2; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - if (!_index || (_ranki < _rank)) { - _rank = _ranki; _index = 2; - if (_rank == _rankm) goto dispatch; - } - } - check_2: - - dispatch: - switch(_index) { - case 1: - PUSHMARK(MARK); SWIG_CALLXS(_wrap_MerDNA_k__SWIG_0); return; - case 2: - PUSHMARK(MARK); SWIG_CALLXS(_wrap_MerDNA_k__SWIG_1); return; - } - } - - croak("No matching function for overloaded 'MerDNA_k'"); - XSRETURN(0); -} - - -XS(_wrap_MerDNA_polyA) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_polyA(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_polyA" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyA(); - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_polyC) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_polyC(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_polyC" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyC(); - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_polyG) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_polyG(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_polyG" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyG(); - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_polyT) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_polyT(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_polyT" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyT(); - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_randomize) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_randomize(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_randomize" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->randomize(); - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_is_homopolymer) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_is_homopolymer(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_is_homopolymer" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = (bool)((MerDNA const *)arg1)->is_homopolymer(); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_shift_left) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - int argvi = 0; - char result; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: MerDNA_shift_left(self,char);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_shift_left" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(1), &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA_shift_left" "', argument " "2"" of type '" "char""'"); - } - arg2 = static_cast< char >(val2); - result = (char)(arg1)->shift_left(arg2); - ST(argvi) = SWIG_From_char SWIG_PERL_CALL_ARGS_1(static_cast< char >(result)); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_shift_right) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - int argvi = 0; - char result; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: MerDNA_shift_right(self,char);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_shift_right" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(1), &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA_shift_right" "', argument " "2"" of type '" "char""'"); - } - arg2 = static_cast< char >(val2); - result = (char)(arg1)->shift_right(arg2); - ST(argvi) = SWIG_From_char SWIG_PERL_CALL_ARGS_1(static_cast< char >(result)); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_canonicalize) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_canonicalize(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_canonicalize" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->canonicalize(); - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_reverse_complement) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_reverse_complement(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_reverse_complement" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->reverse_complement(); - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_get_canonical) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - MerDNA result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_get_canonical(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_get_canonical" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = ((MerDNA const *)arg1)->get_canonical(); - ST(argvi) = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | SWIG_SHADOW); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_get_reverse_complement) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - MerDNA result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_get_reverse_complement(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_get_reverse_complement" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = ((MerDNA const *)arg1)->get_reverse_complement(); - ST(argvi) = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | SWIG_SHADOW); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA___eq__) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: MerDNA___eq__(self,MerDNA const &);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___eq__" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MerDNA___eq__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "MerDNA___eq__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)((MerDNA const *)arg1)->operator ==((MerDNA const &)*arg2); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA___lt__) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: MerDNA___lt__(self,MerDNA const &);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___lt__" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MerDNA___lt__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "MerDNA___lt__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)((MerDNA const *)arg1)->operator <((MerDNA const &)*arg2); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA___gt__) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: MerDNA___gt__(self,MerDNA const &);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___gt__" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MerDNA___gt__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "MerDNA___gt__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)((MerDNA const *)arg1)->operator >((MerDNA const &)*arg2); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_dup) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - MerDNA result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA_dup(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_dup" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = MerDNA_dup((MerDNA const *)arg1); - ST(argvi) = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | SWIG_SHADOW); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA___str__) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - std::string result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: MerDNA___str__(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___str__" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = MerDNA___str__(arg1); - ST(argvi) = SWIG_From_std_string SWIG_PERL_CALL_ARGS_1(static_cast< std::string >(result)); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_set) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - char *arg2 = (char *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: MerDNA_set(self,s);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_set" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MerDNA_set" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = reinterpret_cast< char * >(buf2); - try { - MerDNA_set(arg1,(char const *)arg2); - } - catch(std::length_error &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - - ST(argvi) = sv_newmortal(); - - if (alloc2 == SWIG_NEWOBJ) delete[] buf2; - XSRETURN(argvi); - fail: - - if (alloc2 == SWIG_NEWOBJ) delete[] buf2; - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_get_base) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - unsigned int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - int argvi = 0; - char result; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: MerDNA_get_base(self,i);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_get_base" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA_get_base" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - result = (char)MerDNA_get_base(arg1,arg2); - ST(argvi) = SWIG_From_char SWIG_PERL_CALL_ARGS_1(static_cast< char >(result)); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_MerDNA_set_base) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - unsigned int arg2 ; - char arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - char val3 ; - int ecode3 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 3) || (items > 3)) { - SWIG_croak("Usage: MerDNA_set_base(self,i,b);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_set_base" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA_set_base" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - ecode3 = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(2), &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "MerDNA_set_base" "', argument " "3"" of type '" "char""'"); - } - arg3 = static_cast< char >(val3); - MerDNA_set_base(arg1,arg2,arg3); - ST(argvi) = sv_newmortal(); - - - - XSRETURN(argvi); - fail: - - - - SWIG_croak_null(); - } -} - - -XS(_wrap_delete_MerDNA) { - { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: delete_MerDNA(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MerDNA, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_MerDNA" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - delete arg1; - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_new_QueryMerFile) { - { - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int argvi = 0; - QueryMerFile *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: new_QueryMerFile(path);"); - } - res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_QueryMerFile" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - try { - result = (QueryMerFile *)new QueryMerFile((char const *)arg1); - } - catch(std::runtime_error &_e) { - SWIG_exception_fail(SWIG_RuntimeError, (&_e)->what()); - } - - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_QueryMerFile, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - XSRETURN(argvi); - fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - SWIG_croak_null(); - } -} - - -XS(_wrap_QueryMerFile_get) { - { - QueryMerFile *arg1 = (QueryMerFile *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int argvi = 0; - unsigned int result; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: QueryMerFile_get(self,m);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QueryMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QueryMerFile_get" "', argument " "1"" of type '" "QueryMerFile *""'"); - } - arg1 = reinterpret_cast< QueryMerFile * >(argp1); - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "QueryMerFile_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "QueryMerFile_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (unsigned int)(arg1)->get((MerDNA const &)*arg2); - ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_delete_QueryMerFile) { - { - QueryMerFile *arg1 = (QueryMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: delete_QueryMerFile(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QueryMerFile, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_QueryMerFile" "', argument " "1"" of type '" "QueryMerFile *""'"); - } - arg1 = reinterpret_cast< QueryMerFile * >(argp1); - delete arg1; - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_new_ReadMerFile) { - { - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int argvi = 0; - ReadMerFile *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: new_ReadMerFile(path);"); - } - res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ReadMerFile" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - try { - result = (ReadMerFile *)new ReadMerFile((char const *)arg1); - } - catch(std::runtime_error &_e) { - SWIG_exception_fail(SWIG_RuntimeError, (&_e)->what()); - } - - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ReadMerFile, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - XSRETURN(argvi); - fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - SWIG_croak_null(); - } -} - - -XS(_wrap_ReadMerFile_next_mer) { - { - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: ReadMerFile_next_mer(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile_next_mer" "', argument " "1"" of type '" "ReadMerFile *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (bool)(arg1)->next_mer(); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_ReadMerFile_mer) { - { - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - MerDNA *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: ReadMerFile_mer(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile_mer" "', argument " "1"" of type '" "ReadMerFile const *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (MerDNA *)((ReadMerFile const *)arg1)->mer(); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | SWIG_SHADOW); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_ReadMerFile_count) { - { - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - unsigned long result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: ReadMerFile_count(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile_count" "', argument " "1"" of type '" "ReadMerFile const *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (unsigned long)((ReadMerFile const *)arg1)->count(); - ST(argvi) = SWIG_From_unsigned_SS_long SWIG_PERL_CALL_ARGS_1(static_cast< unsigned long >(result)); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_ReadMerFile_each) { - { - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - std::pair< MerDNA const *,uint64_t > result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: ReadMerFile_each(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile_each" "', argument " "1"" of type '" "ReadMerFile *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (arg1)->each(); - { - if((result).first) { - SV * m = SWIG_NewPointerObj(const_cast((result).first), SWIGTYPE_p_MerDNA, 0); - SV * c = SWIG_From_unsigned_SS_long SWIG_PERL_CALL_ARGS_1((result).second); - if (argvi >= items) EXTEND(sp,1); ST(argvi) = m; argvi++ ; - if (argvi >= items) EXTEND(sp,1); ST(argvi) = c; argvi++ ; - } - } - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_delete_ReadMerFile) { - { - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: delete_ReadMerFile(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ReadMerFile, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ReadMerFile" "', argument " "1"" of type '" "ReadMerFile *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - delete arg1; - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_new_HashCounter__SWIG_0) { - { - size_t arg1 ; - unsigned int arg2 ; - unsigned int arg3 ; - size_t val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - unsigned int val3 ; - int ecode3 = 0 ; - int argvi = 0; - HashCounter *result = 0 ; - dXSARGS; - - if ((items < 3) || (items > 3)) { - SWIG_croak("Usage: new_HashCounter(size,val_len,nb_threads);"); - } - ecode1 = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(0), &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_HashCounter" "', argument " "1"" of type '" "size_t""'"); - } - arg1 = static_cast< size_t >(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_HashCounter" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - ecode3 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_HashCounter" "', argument " "3"" of type '" "unsigned int""'"); - } - arg3 = static_cast< unsigned int >(val3); - result = (HashCounter *)new HashCounter(arg1,arg2,arg3); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HashCounter, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - - - - XSRETURN(argvi); - fail: - - - - SWIG_croak_null(); - } -} - - -XS(_wrap_new_HashCounter__SWIG_1) { - { - size_t arg1 ; - unsigned int arg2 ; - size_t val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - int argvi = 0; - HashCounter *result = 0 ; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: new_HashCounter(size,val_len);"); - } - ecode1 = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(0), &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_HashCounter" "', argument " "1"" of type '" "size_t""'"); - } - arg1 = static_cast< size_t >(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_HashCounter" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - result = (HashCounter *)new HashCounter(arg1,arg2); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HashCounter, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_new_HashCounter) { - dXSARGS; - - { - unsigned long _index = 0; - SWIG_TypeRank _rank = 0; - if (items == 2) { - SWIG_TypeRank _ranki = 0; - SWIG_TypeRank _rankm = 0; - SWIG_TypeRank _pi = 1; - int _v = 0; - { - { - int res = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(0), NULL); - _v = SWIG_CheckState(res); - } - } - if (!_v) goto check_1; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - { - { - int res = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL); - _v = SWIG_CheckState(res); - } - } - if (!_v) goto check_1; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - if (!_index || (_ranki < _rank)) { - _rank = _ranki; _index = 1; - if (_rank == _rankm) goto dispatch; - } - } - check_1: - - if (items == 3) { - SWIG_TypeRank _ranki = 0; - SWIG_TypeRank _rankm = 0; - SWIG_TypeRank _pi = 1; - int _v = 0; - { - { - int res = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(0), NULL); - _v = SWIG_CheckState(res); - } - } - if (!_v) goto check_2; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - { - { - int res = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL); - _v = SWIG_CheckState(res); - } - } - if (!_v) goto check_2; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - { - { - int res = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL); - _v = SWIG_CheckState(res); - } - } - if (!_v) goto check_2; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - if (!_index || (_ranki < _rank)) { - _rank = _ranki; _index = 2; - if (_rank == _rankm) goto dispatch; - } - } - check_2: - - dispatch: - switch(_index) { - case 1: - PUSHMARK(MARK); SWIG_CALLXS(_wrap_new_HashCounter__SWIG_1); return; - case 2: - PUSHMARK(MARK); SWIG_CALLXS(_wrap_new_HashCounter__SWIG_0); return; - } - } - - croak("No matching function for overloaded 'new_HashCounter'"); - XSRETURN(0); -} - - -XS(_wrap_HashCounter_size) { - { - HashCounter *arg1 = (HashCounter *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - size_t result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: HashCounter_size(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_size" "', argument " "1"" of type '" "HashCounter const *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - result = ((HashCounter const *)arg1)->size(); - ST(argvi) = SWIG_From_size_t SWIG_PERL_CALL_ARGS_1(static_cast< size_t >(result)); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_HashCounter_val_len) { - { - HashCounter *arg1 = (HashCounter *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - unsigned int result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: HashCounter_val_len(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_val_len" "', argument " "1"" of type '" "HashCounter const *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - result = (unsigned int)((HashCounter const *)arg1)->val_len(); - ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_HashCounter_add) { - { - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - int *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int temp3 ; - int val3 ; - int ecode3 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 3) || (items > 3)) { - SWIG_croak("Usage: HashCounter_add(self,m,x);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_add" "', argument " "1"" of type '" "HashCounter *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashCounter_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashCounter_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "HashCounter_add" "', argument " "3"" of type '" "int""'"); - } - temp3 = static_cast< int >(val3); - arg3 = &temp3; - result = (bool)(arg1)->add((MerDNA const &)*arg2,(int const &)*arg3); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - - - XSRETURN(argvi); - fail: - - - - SWIG_croak_null(); - } -} - - -XS(_wrap_HashCounter_update_add) { - { - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - int *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int temp3 ; - int val3 ; - int ecode3 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 3) || (items > 3)) { - SWIG_croak("Usage: HashCounter_update_add(self,MerDNA const &,int const &);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_update_add" "', argument " "1"" of type '" "HashCounter *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashCounter_update_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashCounter_update_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "HashCounter_update_add" "', argument " "3"" of type '" "int""'"); - } - temp3 = static_cast< int >(val3); - arg3 = &temp3; - result = (bool)(arg1)->update_add((MerDNA const &)*arg2,(int const &)*arg3); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - - - XSRETURN(argvi); - fail: - - - - SWIG_croak_null(); - } -} - - -XS(_wrap_HashCounter_get) { - { - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - std::pair< bool,uint64_t > *arg3 = (std::pair< bool,uint64_t > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - std::pair< bool,uint64_t > tmp3 ; - int argvi = 0; - dXSARGS; - - { - arg3 = &tmp3; - } - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: HashCounter_get(self,m);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_get" "', argument " "1"" of type '" "HashCounter const *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashCounter_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashCounter_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - HashCounter_get((HashCounter const *)arg1,(MerDNA const &)*arg2,arg3); - ST(argvi) = sv_newmortal(); - { - if((arg3)->first) { - SV * o = SWIG_From_unsigned_SS_long SWIG_PERL_CALL_ARGS_1((arg3)->second); - if (argvi >= items) EXTEND(sp,1); ST(argvi) = o; argvi++ ; - } else { - if (argvi >= items) EXTEND(sp,1); ST(argvi) = sv_newmortal(); argvi++ ; - } - } - - - - XSRETURN(argvi); - fail: - - - - SWIG_croak_null(); - } -} - - -XS(_wrap_delete_HashCounter) { - { - HashCounter *arg1 = (HashCounter *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: delete_HashCounter(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashCounter, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_HashCounter" "', argument " "1"" of type '" "HashCounter *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - delete arg1; - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_new_HashSet__SWIG_0) { - { - size_t arg1 ; - unsigned int arg2 ; - size_t val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - int argvi = 0; - HashSet *result = 0 ; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: new_HashSet(size,nb_threads);"); - } - ecode1 = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(0), &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_HashSet" "', argument " "1"" of type '" "size_t""'"); - } - arg1 = static_cast< size_t >(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_HashSet" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - result = (HashSet *)new HashSet(arg1,arg2); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HashSet, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_new_HashSet__SWIG_1) { - { - size_t arg1 ; - size_t val1 ; - int ecode1 = 0 ; - int argvi = 0; - HashSet *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: new_HashSet(size);"); - } - ecode1 = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(0), &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_HashSet" "', argument " "1"" of type '" "size_t""'"); - } - arg1 = static_cast< size_t >(val1); - result = (HashSet *)new HashSet(arg1); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HashSet, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_new_HashSet) { - dXSARGS; - - { - unsigned long _index = 0; - SWIG_TypeRank _rank = 0; - if (items == 1) { - SWIG_TypeRank _ranki = 0; - SWIG_TypeRank _rankm = 0; - SWIG_TypeRank _pi = 1; - int _v = 0; - { - { - int res = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(0), NULL); - _v = SWIG_CheckState(res); - } - } - if (!_v) goto check_1; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - if (!_index || (_ranki < _rank)) { - _rank = _ranki; _index = 1; - if (_rank == _rankm) goto dispatch; - } - } - check_1: - - if (items == 2) { - SWIG_TypeRank _ranki = 0; - SWIG_TypeRank _rankm = 0; - SWIG_TypeRank _pi = 1; - int _v = 0; - { - { - int res = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(0), NULL); - _v = SWIG_CheckState(res); - } - } - if (!_v) goto check_2; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - { - { - int res = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL); - _v = SWIG_CheckState(res); - } - } - if (!_v) goto check_2; - _ranki += _v*_pi; - _rankm += _pi; - _pi *= SWIG_MAXCASTRANK; - if (!_index || (_ranki < _rank)) { - _rank = _ranki; _index = 2; - if (_rank == _rankm) goto dispatch; - } - } - check_2: - - dispatch: - switch(_index) { - case 1: - PUSHMARK(MARK); SWIG_CALLXS(_wrap_new_HashSet__SWIG_1); return; - case 2: - PUSHMARK(MARK); SWIG_CALLXS(_wrap_new_HashSet__SWIG_0); return; - } - } - - croak("No matching function for overloaded 'new_HashSet'"); - XSRETURN(0); -} - - -XS(_wrap_HashSet_size) { - { - HashSet *arg1 = (HashSet *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - size_t result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: HashSet_size(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashSet_size" "', argument " "1"" of type '" "HashSet const *""'"); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - result = ((HashSet const *)arg1)->size(); - ST(argvi) = SWIG_From_size_t SWIG_PERL_CALL_ARGS_1(static_cast< size_t >(result)); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_HashSet_add) { - { - HashSet *arg1 = (HashSet *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: HashSet_add(self,m);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashSet_add" "', argument " "1"" of type '" "HashSet *""'"); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashSet_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashSet_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)(arg1)->add((MerDNA const &)*arg2); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_HashSet_get) { - { - HashSet *arg1 = (HashSet *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: HashSet_get(self,m);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashSet_get" "', argument " "1"" of type '" "HashSet const *""'"); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashSet_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashSet_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)HashSet_get((HashSet const *)arg1,(MerDNA const &)*arg2); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - - XSRETURN(argvi); - fail: - - - SWIG_croak_null(); - } -} - - -XS(_wrap_delete_HashSet) { - { - HashSet *arg1 = (HashSet *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: delete_HashSet(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_HashSet, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_HashSet" "', argument " "1"" of type '" "HashSet *""'"); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - delete arg1; - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_string_mers) { - { - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - size_t size1 = 0 ; - int alloc1 = 0 ; - int argvi = 0; - StringMers *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: string_mers(str,length);"); - } - res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, &size1, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "string_mers" "', argument " "1"" of type '" "char *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - arg2 = static_cast< int >(size1 - 1); - result = (StringMers *)string_mers(arg1,arg2); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - XSRETURN(argvi); - fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - SWIG_croak_null(); - } -} - - -XS(_wrap_string_canonicals) { - { - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - size_t size1 = 0 ; - int alloc1 = 0 ; - int argvi = 0; - StringMers *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: string_canonicals(str,length);"); - } - res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, &size1, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "string_canonicals" "', argument " "1"" of type '" "char *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - arg2 = static_cast< int >(size1 - 1); - result = (StringMers *)string_canonicals(arg1,arg2); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - XSRETURN(argvi); - fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - SWIG_croak_null(); - } -} - - -XS(_wrap_new_StringMers) { - { - char *arg1 = (char *) 0 ; - int arg2 ; - bool arg3 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; - bool val3 ; - int ecode3 = 0 ; - int argvi = 0; - StringMers *result = 0 ; - dXSARGS; - - if ((items < 3) || (items > 3)) { - SWIG_croak("Usage: new_StringMers(str,len,canonical);"); - } - res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringMers" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_StringMers" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - ecode3 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(2), &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_StringMers" "', argument " "3"" of type '" "bool""'"); - } - arg3 = static_cast< bool >(val3); - result = (StringMers *)new StringMers((char const *)arg1,arg2,arg3); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_OWNER | SWIG_SHADOW); argvi++ ; - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - - - XSRETURN(argvi); - fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - - - SWIG_croak_null(); - } -} - - -XS(_wrap_StringMers_next_mer) { - { - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - bool result; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: StringMers_next_mer(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMers_next_mer" "', argument " "1"" of type '" "StringMers *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - result = (bool)(arg1)->next_mer(); - ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_StringMers_mer) { - { - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - MerDNA *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: StringMers_mer(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMers_mer" "', argument " "1"" of type '" "StringMers const *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - result = (MerDNA *)((StringMers const *)arg1)->mer(); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | SWIG_SHADOW); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_StringMers_each) { - { - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - MerDNA *result = 0 ; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: StringMers_each(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMers_each" "', argument " "1"" of type '" "StringMers *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - result = (MerDNA *)(arg1)->each(); - ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | SWIG_SHADOW); argvi++ ; - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - -XS(_wrap_delete_StringMers) { - { - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: delete_StringMers(self);"); - } - res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_StringMers, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringMers" "', argument " "1"" of type '" "StringMers *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - delete arg1; - ST(argvi) = sv_newmortal(); - - XSRETURN(argvi); - fail: - - SWIG_croak_null(); - } -} - - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ - -static swig_type_info _swigt__p_HashCounter = {"_p_HashCounter", "HashCounter *", 0, 0, (void*)"jellyfish::HashCounter", 0}; -static swig_type_info _swigt__p_HashSet = {"_p_HashSet", "HashSet *", 0, 0, (void*)"jellyfish::HashSet", 0}; -static swig_type_info _swigt__p_MerDNA = {"_p_MerDNA", "MerDNA *", 0, 0, (void*)"jellyfish::MerDNA", 0}; -static swig_type_info _swigt__p_QueryMerFile = {"_p_QueryMerFile", "QueryMerFile *", 0, 0, (void*)"jellyfish::QueryMerFile", 0}; -static swig_type_info _swigt__p_ReadMerFile = {"_p_ReadMerFile", "ReadMerFile *", 0, 0, (void*)"jellyfish::ReadMerFile", 0}; -static swig_type_info _swigt__p_StringMers = {"_p_StringMers", "StringMers *", 0, 0, (void*)"jellyfish::StringMers", 0}; -static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__pairT_bool_uint64_t_t = {"_p_std__pairT_bool_uint64_t_t", "std::pair< bool,uint64_t > *", 0, 0, (void*)0, 0}; - -static swig_type_info *swig_type_initial[] = { - &_swigt__p_HashCounter, - &_swigt__p_HashSet, - &_swigt__p_MerDNA, - &_swigt__p_QueryMerFile, - &_swigt__p_ReadMerFile, - &_swigt__p_StringMers, - &_swigt__p_char, - &_swigt__p_std__pairT_bool_uint64_t_t, -}; - -static swig_cast_info _swigc__p_HashCounter[] = { {&_swigt__p_HashCounter, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_HashSet[] = { {&_swigt__p_HashSet, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_MerDNA[] = { {&_swigt__p_MerDNA, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_QueryMerFile[] = { {&_swigt__p_QueryMerFile, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_ReadMerFile[] = { {&_swigt__p_ReadMerFile, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_StringMers[] = { {&_swigt__p_StringMers, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__pairT_bool_uint64_t_t[] = { {&_swigt__p_std__pairT_bool_uint64_t_t, 0, 0, 0},{0, 0, 0, 0}}; - -static swig_cast_info *swig_cast_initial[] = { - _swigc__p_HashCounter, - _swigc__p_HashSet, - _swigc__p_MerDNA, - _swigc__p_QueryMerFile, - _swigc__p_ReadMerFile, - _swigc__p_StringMers, - _swigc__p_char, - _swigc__p_std__pairT_bool_uint64_t_t, -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ - -static swig_constant_info swig_constants[] = { -{0,0,0,0,0,0} -}; -#ifdef __cplusplus -} -#endif -static swig_variable_info swig_variables[] = { -{0,0,0,0} -}; -static swig_command_info swig_commands[] = { -{"jellyfishc::new_MerDNA", _wrap_new_MerDNA}, -{"jellyfishc::MerDNA_k", _wrap_MerDNA_k}, -{"jellyfishc::MerDNA_polyA", _wrap_MerDNA_polyA}, -{"jellyfishc::MerDNA_polyC", _wrap_MerDNA_polyC}, -{"jellyfishc::MerDNA_polyG", _wrap_MerDNA_polyG}, -{"jellyfishc::MerDNA_polyT", _wrap_MerDNA_polyT}, -{"jellyfishc::MerDNA_randomize", _wrap_MerDNA_randomize}, -{"jellyfishc::MerDNA_is_homopolymer", _wrap_MerDNA_is_homopolymer}, -{"jellyfishc::MerDNA_shift_left", _wrap_MerDNA_shift_left}, -{"jellyfishc::MerDNA_shift_right", _wrap_MerDNA_shift_right}, -{"jellyfishc::MerDNA_canonicalize", _wrap_MerDNA_canonicalize}, -{"jellyfishc::MerDNA_reverse_complement", _wrap_MerDNA_reverse_complement}, -{"jellyfishc::MerDNA_get_canonical", _wrap_MerDNA_get_canonical}, -{"jellyfishc::MerDNA_get_reverse_complement", _wrap_MerDNA_get_reverse_complement}, -{"jellyfishc::MerDNA___eq__", _wrap_MerDNA___eq__}, -{"jellyfishc::MerDNA___lt__", _wrap_MerDNA___lt__}, -{"jellyfishc::MerDNA___gt__", _wrap_MerDNA___gt__}, -{"jellyfishc::MerDNA_dup", _wrap_MerDNA_dup}, -{"jellyfishc::MerDNA___str__", _wrap_MerDNA___str__}, -{"jellyfishc::MerDNA_set", _wrap_MerDNA_set}, -{"jellyfishc::MerDNA_get_base", _wrap_MerDNA_get_base}, -{"jellyfishc::MerDNA_set_base", _wrap_MerDNA_set_base}, -{"jellyfishc::delete_MerDNA", _wrap_delete_MerDNA}, -{"jellyfishc::new_QueryMerFile", _wrap_new_QueryMerFile}, -{"jellyfishc::QueryMerFile_get", _wrap_QueryMerFile_get}, -{"jellyfishc::delete_QueryMerFile", _wrap_delete_QueryMerFile}, -{"jellyfishc::new_ReadMerFile", _wrap_new_ReadMerFile}, -{"jellyfishc::ReadMerFile_next_mer", _wrap_ReadMerFile_next_mer}, -{"jellyfishc::ReadMerFile_mer", _wrap_ReadMerFile_mer}, -{"jellyfishc::ReadMerFile_count", _wrap_ReadMerFile_count}, -{"jellyfishc::ReadMerFile_each", _wrap_ReadMerFile_each}, -{"jellyfishc::delete_ReadMerFile", _wrap_delete_ReadMerFile}, -{"jellyfishc::new_HashCounter", _wrap_new_HashCounter}, -{"jellyfishc::HashCounter_size", _wrap_HashCounter_size}, -{"jellyfishc::HashCounter_val_len", _wrap_HashCounter_val_len}, -{"jellyfishc::HashCounter_add", _wrap_HashCounter_add}, -{"jellyfishc::HashCounter_update_add", _wrap_HashCounter_update_add}, -{"jellyfishc::HashCounter_get", _wrap_HashCounter_get}, -{"jellyfishc::delete_HashCounter", _wrap_delete_HashCounter}, -{"jellyfishc::new_HashSet", _wrap_new_HashSet}, -{"jellyfishc::HashSet_size", _wrap_HashSet_size}, -{"jellyfishc::HashSet_add", _wrap_HashSet_add}, -{"jellyfishc::HashSet_get", _wrap_HashSet_get}, -{"jellyfishc::delete_HashSet", _wrap_delete_HashSet}, -{"jellyfishc::string_mers", _wrap_string_mers}, -{"jellyfishc::string_canonicals", _wrap_string_canonicals}, -{"jellyfishc::new_StringMers", _wrap_new_StringMers}, -{"jellyfishc::StringMers_next_mer", _wrap_StringMers_next_mer}, -{"jellyfishc::StringMers_mer", _wrap_StringMers_mer}, -{"jellyfishc::StringMers_each", _wrap_StringMers_each}, -{"jellyfishc::delete_StringMers", _wrap_delete_StringMers}, -{0,0} -}; -/* ----------------------------------------------------------------------------- - * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to - * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of - * swig_module, and does all the lookup, filling in the swig_module.types - * array with the correct data and linking the correct swig_cast_info - * structures together. - * - * The generated swig_type_info structures are assigned statically to an initial - * array. We just loop through that array, and handle each type individually. - * First we lookup if this type has been already loaded, and if so, use the - * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a - * two-dimensional array. Each row corresponds to a type (there are the same - * number of rows as there are in the swig_type_initial array). Each entry in - * a column is one of the swig_cast_info structures for that type. - * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. - * - * First off, we lookup the cast->type name to see if it is already loaded. - * There are three cases to handle: - * 1) If the cast->type has already been loaded AND the type we are adding - * casting info to has not been loaded (it is in this module), THEN we - * replace the cast->type pointer with the type pointer that has already - * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the - * cast->type) are loaded, THEN the cast info has already been loaded by - * the previous module so we just ignore it. - * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will - * be correct. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* c-mode */ -#endif -#endif - -#if 0 -#define SWIGRUNTIME_DEBUG -#endif - - -SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { - size_t i; - swig_module_info *module_head, *iter; - int found, init; - - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - init = 1; - } else { - init = 0; - } - - /* Try and load any already created modules */ - module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; - iter=module_head; - do { - if (iter==&swig_module) { - found=1; - break; - } - iter=iter->next; - } while (iter!= module_head); - - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ - swig_module.next = module_head->next; - module_head->next = &swig_module; - } - - /* When multiple interpreters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - - /* Now work on filling in swig_module.types */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %d\n", swig_module.size); -#endif - for (i = 0; i < swig_module.size; ++i) { - swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; - -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); -#endif - - /* if there is another module already loaded */ - if (swig_module.next != &swig_module) { - type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); - } - if (type) { - /* Overwrite clientdata field */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found type %s\n", type->name); -#endif - if (swig_module.type_initial[i]->clientdata) { - type->clientdata = swig_module.type_initial[i]->clientdata; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); -#endif - } - } else { - type = swig_module.type_initial[i]; - } - - /* Insert casting types */ - cast = swig_module.cast_initial[i]; - while (cast->type) { - /* Don't need to add information already in the list */ - ret = 0; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); -#endif - if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); -#ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); -#endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); -#endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); -#ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); -#endif - if (!ocast) ret = 0; - } - } - - if (!ret) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); -#endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; - } - type->cast = cast; - } - cast++; - } - /* Set entry in modules->types array equal to the type */ - swig_module.types[i] = type; - } - swig_module.types[i] = 0; - -#ifdef SWIGRUNTIME_DEBUG - printf("**** SWIG_InitializeModule: Cast List ******\n"); - for (i = 0; i < swig_module.size; ++i) { - int j = 0; - swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); - while (cast->type) { - printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); - cast++; - ++j; - } - printf("---- Total casts: %d\n",j); - } - printf("**** SWIG_InitializeModule: Cast List ******\n"); -#endif -} - -/* This function will propagate the clientdata field of type to -* any new swig_type_info structures that have been added into the list -* of equivalent types. It is like calling -* SWIG_TypeClientData(type, clientdata) a second time. -*/ -SWIGRUNTIME void -SWIG_PropagateClientData(void) { - size_t i; - swig_cast_info *equiv; - static int init_run = 0; - - if (init_run) return; - init_run = 1; - - for (i = 0; i < swig_module.size; i++) { - if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); - } - equiv = equiv->next; - } - } - } -} - -#ifdef __cplusplus -#if 0 -{ - /* c-mode */ -#endif -} -#endif - - - -#ifdef __cplusplus -extern "C" -#endif - -XS(SWIG_init) { - dXSARGS; - int i; - - SWIG_InitializeModule(0); - - /* Install commands */ - for (i = 0; swig_commands[i].name; i++) { - /* Casts only needed for Perl < 5.10. */ -#ifdef __cplusplus - newXS(const_cast(swig_commands[i].name), swig_commands[i].wrapper, const_cast(__FILE__)); -#else - newXS((char*)swig_commands[i].name, swig_commands[i].wrapper, (char*)__FILE__); -#endif - } - - /* Install variables */ - for (i = 0; swig_variables[i].name; i++) { - SV *sv; - sv = get_sv(swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI); - if (swig_variables[i].type) { - SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); - } else { - sv_setiv(sv,(IV) 0); - } - swig_create_magic(sv, swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); - } - - /* Install constant */ - for (i = 0; swig_constants[i].type; i++) { - SV *sv; - sv = get_sv(swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI); - switch(swig_constants[i].type) { - case SWIG_INT: - sv_setiv(sv, (IV) swig_constants[i].lvalue); - break; - case SWIG_FLOAT: - sv_setnv(sv, (double) swig_constants[i].dvalue); - break; - case SWIG_STRING: - sv_setpv(sv, (const char *) swig_constants[i].pvalue); - break; - case SWIG_POINTER: - SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); - break; - case SWIG_BINARY: - SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); - break; - default: - break; - } - SvREADONLY_on(sv); - } - - SWIG_TypeClientData(SWIGTYPE_p_MerDNA, (void*) "jellyfish::MerDNA"); - SWIG_TypeClientData(SWIGTYPE_p_QueryMerFile, (void*) "jellyfish::QueryMerFile"); - SWIG_TypeClientData(SWIGTYPE_p_ReadMerFile, (void*) "jellyfish::ReadMerFile"); - SWIG_TypeClientData(SWIGTYPE_p_HashCounter, (void*) "jellyfish::HashCounter"); - SWIG_TypeClientData(SWIGTYPE_p_HashSet, (void*) "jellyfish::HashSet"); - SWIG_TypeClientData(SWIGTYPE_p_StringMers, (void*) "jellyfish::StringMers"); - ST(0) = &PL_sv_yes; - XSRETURN(1); -} - diff --git a/src/modifiedJellyfish/swig/python/jellyfish.py b/src/modifiedJellyfish/swig/python/jellyfish.py deleted file mode 100644 index ade5deaf..00000000 --- a/src/modifiedJellyfish/swig/python/jellyfish.py +++ /dev/null @@ -1,390 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 3.0.2 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - - - - -""" -Jellyfish binding -""" - - -from sys import version_info -if version_info >= (2,6,0): - def swig_import_helper(): - from os.path import dirname - import imp - fp = None - try: - fp, pathname, description = imp.find_module('_jellyfish', [dirname(__file__)]) - except ImportError: - import _jellyfish - return _jellyfish - if fp is not None: - try: - _mod = imp.load_module('_jellyfish', fp, pathname, description) - finally: - fp.close() - return _mod - _jellyfish = swig_import_helper() - del swig_import_helper -else: - import _jellyfish -del version_info -try: - _swig_property = property -except NameError: - pass # Python < 2.2 doesn't have 'property'. -def _swig_setattr_nondynamic(self,class_type,name,value,static=1): - if (name == "thisown"): return self.this.own(value) - if (name == "this"): - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name,None) - if method: return method(self,value) - if (not static): - self.__dict__[name] = value - else: - raise AttributeError("You cannot add attributes to %s" % self) - -def _swig_setattr(self,class_type,name,value): - return _swig_setattr_nondynamic(self,class_type,name,value,0) - -def _swig_getattr(self,class_type,name): - if (name == "thisown"): return self.this.own() - method = class_type.__swig_getmethods__.get(name,None) - if method: return method(self) - raise AttributeError(name) - -def _swig_repr(self): - try: strthis = "proxy of " + self.this.__repr__() - except: strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - -try: - _object = object - _newclass = 1 -except AttributeError: - class _object : pass - _newclass = 0 - - -class MerDNA(_object): - """Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int)""" - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, MerDNA, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, MerDNA, name) - __repr__ = _swig_repr - def __init__(self, *args): - """ - Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int) - Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int) - Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int) - """ - this = _jellyfish.new_MerDNA(*args) - try: self.this.append(this) - except: self.this = this - def k(*args): - """ - Get the length of the k-mers - Set the length of the k-mers - """ - return _jellyfish.MerDNA_k(*args) - - if _newclass:k = staticmethod(k) - __swig_getmethods__["k"] = lambda x: k - def polyA(self): - """Change the mer to a homopolymer of A""" - return _jellyfish.MerDNA_polyA(self) - - def polyC(self): - """Change the mer to a homopolymer of C""" - return _jellyfish.MerDNA_polyC(self) - - def polyG(self): - """Change the mer to a homopolymer of G""" - return _jellyfish.MerDNA_polyG(self) - - def polyT(self): - """Change the mer to a homopolymer of T""" - return _jellyfish.MerDNA_polyT(self) - - def randomize(self): - """Change the mer to a random one""" - return _jellyfish.MerDNA_randomize(self) - - def is_homopolymer(self): - """Check if the mer is a homopolymer""" - return _jellyfish.MerDNA_is_homopolymer(self) - - def shift_left(self, *args): - """Shift a base to the left and the leftmost base is return . "ACGT", shift_left('A') becomes "CGTA" and 'A' is returned""" - return _jellyfish.MerDNA_shift_left(self, *args) - - def shift_right(self, *args): - """Shift a base to the right and the rightmost base is return . "ACGT", shift_right('A') becomes "AACG" and 'T' is returned""" - return _jellyfish.MerDNA_shift_right(self, *args) - - def canonicalize(self): - """Change the mer to its canonical representation""" - return _jellyfish.MerDNA_canonicalize(self) - - def reverse_complement(self): - """Change the mer to its reverse complement""" - return _jellyfish.MerDNA_reverse_complement(self) - - def get_canonical(self): - """Return canonical representation of the mer""" - return _jellyfish.MerDNA_get_canonical(self) - - def get_reverse_complement(self): - """Return the reverse complement of the mer""" - return _jellyfish.MerDNA_get_reverse_complement(self) - - def __eq__(self, *args): - """Equality between mers""" - return _jellyfish.MerDNA___eq__(self, *args) - - def __lt__(self, *args): - """Lexicographic less-than""" - return _jellyfish.MerDNA___lt__(self, *args) - - def __gt__(self, *args): - """Lexicographic greater-than""" - return _jellyfish.MerDNA___gt__(self, *args) - - def dup(self): - """Duplicate the mer""" - return _jellyfish.MerDNA_dup(self) - - def __str__(self): - """Return string representation of the mer""" - return _jellyfish.MerDNA___str__(self) - - def set(self, *args): - """Set the mer from a string""" - return _jellyfish.MerDNA_set(self, *args) - - def __getitem__(self, *args): - """Get base i (0 <= i < k)""" - return _jellyfish.MerDNA___getitem__(self, *args) - - def __setitem__(self, *args): - """Set base i (0 <= i < k)""" - return _jellyfish.MerDNA___setitem__(self, *args) - - def __lshift__(self, *args): - """Shift a base to the left and return the mer""" - return _jellyfish.MerDNA___lshift__(self, *args) - - def __rshift__(self, *args): - """Shift a base to the right and return the mer""" - return _jellyfish.MerDNA___rshift__(self, *args) - - __swig_destroy__ = _jellyfish.delete_MerDNA - __del__ = lambda self : None; -MerDNA_swigregister = _jellyfish.MerDNA_swigregister -MerDNA_swigregister(MerDNA) - -def MerDNA_k(*args): - """ - Get the length of the k-mers - Set the length of the k-mers - """ - return _jellyfish.MerDNA_k(*args) - -class QueryMerFile(_object): - """Give random access to a Jellyfish database. Given a mer, it returns the count associated with that mer""" - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, QueryMerFile, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, QueryMerFile, name) - __repr__ = _swig_repr - def __init__(self, *args): - """Open the jellyfish database""" - this = _jellyfish.new_QueryMerFile(*args) - try: self.this.append(this) - except: self.this = this - def __getitem__(self, *args): - """Get the count for the mer m""" - return _jellyfish.QueryMerFile___getitem__(self, *args) - - __swig_destroy__ = _jellyfish.delete_QueryMerFile - __del__ = lambda self : None; -QueryMerFile_swigregister = _jellyfish.QueryMerFile_swigregister -QueryMerFile_swigregister(QueryMerFile) - -class ReadMerFile(_object): - """Read a Jellyfish database sequentially""" - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, ReadMerFile, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, ReadMerFile, name) - __repr__ = _swig_repr - def __init__(self, *args): - """Open the jellyfish database""" - this = _jellyfish.new_ReadMerFile(*args) - try: self.this.append(this) - except: self.this = this - def next_mer(self): - """Move to the next mer in the file. Returns false if no mers left, true otherwise""" - return _jellyfish.ReadMerFile_next_mer(self) - - def mer(self): - """Returns current mer""" - return _jellyfish.ReadMerFile_mer(self) - - def count(self): - """Returns the count of the current mer""" - return _jellyfish.ReadMerFile_count(self) - - def __iter__(self): - """Iterate through all the mers in the file, passing two values: a mer and its count""" - return _jellyfish.ReadMerFile___iter__(self) - - def __next__(self): - """Iterate through all the mers in the file, passing two values: a mer and its count""" - return _jellyfish.ReadMerFile___next__(self) - - def next(self): - """Iterate through all the mers in the file, passing two values: a mer and its count""" - return _jellyfish.ReadMerFile_next(self) - - __swig_destroy__ = _jellyfish.delete_ReadMerFile - __del__ = lambda self : None; -ReadMerFile_swigregister = _jellyfish.ReadMerFile_swigregister -ReadMerFile_swigregister(ReadMerFile) - -class HashCounter(_object): - """Read a Jellyfish database sequentially""" - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, HashCounter, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, HashCounter, name) - __repr__ = _swig_repr - def __init__(self, *args): - """ - Read a Jellyfish database sequentially - Read a Jellyfish database sequentially - """ - this = _jellyfish.new_HashCounter(*args) - try: self.this.append(this) - except: self.this = this - def size(self): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashCounter_size(self) - - def val_len(self): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashCounter_val_len(self) - - def add(self, *args): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashCounter_add(self, *args) - - def update_add(self, *args): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashCounter_update_add(self, *args) - - def get(self, *args): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashCounter_get(self, *args) - - def __getitem__(self, *args): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashCounter___getitem__(self, *args) - - __swig_destroy__ = _jellyfish.delete_HashCounter - __del__ = lambda self : None; -HashCounter_swigregister = _jellyfish.HashCounter_swigregister -HashCounter_swigregister(HashCounter) - -class HashSet(_object): - """Read a Jellyfish database sequentially""" - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, HashSet, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, HashSet, name) - __repr__ = _swig_repr - def __init__(self, *args): - """ - Read a Jellyfish database sequentially - Read a Jellyfish database sequentially - """ - this = _jellyfish.new_HashSet(*args) - try: self.this.append(this) - except: self.this = this - def size(self): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashSet_size(self) - - def add(self, *args): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashSet_add(self, *args) - - def get(self, *args): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashSet_get(self, *args) - - def __getitem__(self, *args): - """Read a Jellyfish database sequentially""" - return _jellyfish.HashSet___getitem__(self, *args) - - __swig_destroy__ = _jellyfish.delete_HashSet - __del__ = lambda self : None; -HashSet_swigregister = _jellyfish.HashSet_swigregister -HashSet_swigregister(HashSet) - - -def string_mers(*args): - """Get an iterator to the mers in the string""" - return _jellyfish.string_mers(*args) - -def string_canonicals(*args): - """Get an iterator to the canonical mers in the string""" - return _jellyfish.string_canonicals(*args) -class StringMers(_object): - """Extract k-mers from a sequence string""" - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, StringMers, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, StringMers, name) - __repr__ = _swig_repr - def __init__(self, *args): - """Create a k-mers parser from a string. Pass true as a second argument to get canonical mers""" - this = _jellyfish.new_StringMers(*args) - try: self.this.append(this) - except: self.this = this - def next_mer(self): - """Get the next mer. Return false if reached the end of the string.""" - return _jellyfish.StringMers_next_mer(self) - - def mer(self): - """Return the current mer (or its canonical representation)""" - return _jellyfish.StringMers_mer(self) - - def __iter__(self): - """Return the current mer (or its canonical representation)""" - return _jellyfish.StringMers___iter__(self) - - def __next__(self): - """Return the current mer (or its canonical representation)""" - return _jellyfish.StringMers___next__(self) - - def next(self): - """Return the current mer (or its canonical representation)""" - return _jellyfish.StringMers_next(self) - - __swig_destroy__ = _jellyfish.delete_StringMers - __del__ = lambda self : None; -StringMers_swigregister = _jellyfish.StringMers_swigregister -StringMers_swigregister(StringMers) - -# This file is compatible with both classic and new-style classes. - - diff --git a/src/modifiedJellyfish/swig/python/swig_wrap.cpp b/src/modifiedJellyfish/swig/python/swig_wrap.cpp deleted file mode 100644 index dda311e7..00000000 --- a/src/modifiedJellyfish/swig/python/swig_wrap.cpp +++ /dev/null @@ -1,6543 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.2 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - -#define SWIGPYTHON -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE - - -#ifdef __cplusplus -/* SwigValueWrapper is described in swig.swg */ -template class SwigValueWrapper { - struct SwigMovePointer { - T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } - } pointer; - SwigValueWrapper& operator=(const SwigValueWrapper& rhs); - SwigValueWrapper(const SwigValueWrapper& rhs); -public: - SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } - operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -}; - -template T SwigValueInit() { - return T(); -} -#endif - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - - - -#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) -/* Use debug wrappers with the Python release dll */ -# undef _DEBUG -# include -# define _DEBUG -#else -# include -#endif - -/* ----------------------------------------------------------------------------- - * swigrun.swg - * - * This file contains generic C API SWIG runtime support for pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -/* This should only be incremented when either the layout of swig_type_info changes, - or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" - -/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -# define SWIG_QUOTE_STRING(x) #x -# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -# define SWIG_TYPE_TABLE_NAME -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the SWIG runtime code. - In 99.9% of the cases, SWIG just needs to declare them as 'static'. - - But only do this if strictly necessary, ie, if you have problems - with your compiler or suchlike. -*/ - -#ifndef SWIGRUNTIME -# define SWIGRUNTIME SWIGINTERN -#endif - -#ifndef SWIGRUNTIMEINLINE -# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - -/* Generic buffer size */ -#ifndef SWIG_BUFFER_SIZE -# define SWIG_BUFFER_SIZE 1024 -#endif - -/* Flags for pointer conversions */ -#define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 - -/* Flags for new pointer objects */ -#define SWIG_POINTER_OWN 0x1 - - -/* - Flags/methods for returning states. - - The SWIG conversion methods, as ConvertPtr, return an integer - that tells if the conversion was successful or not. And if not, - an error code can be returned (see swigerrors.swg for the codes). - - Use the following macros/flags to set or process the returning - states. - - In old versions of SWIG, code such as the following was usually written: - - if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { - // success code - } else { - //fail code - } - - Now you can be more explicit: - - int res = SWIG_ConvertPtr(obj,vptr,ty.flags); - if (SWIG_IsOK(res)) { - // success code - } else { - // fail code - } - - which is the same really, but now you can also do - - Type *ptr; - int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); - if (SWIG_IsOK(res)) { - // success code - if (SWIG_IsNewObj(res) { - ... - delete *ptr; - } else { - ... - } - } else { - // fail code - } - - I.e., now SWIG_ConvertPtr can return new objects and you can - identify the case and take care of the deallocation. Of course that - also requires SWIG_ConvertPtr to return new result values, such as - - int SWIG_ConvertPtr(obj, ptr,...) { - if () { - if () { - *ptr = ; - return SWIG_NEWOBJ; - } else { - *ptr = ; - return SWIG_OLDOBJ; - } - } else { - return SWIG_BADOBJ; - } - } - - Of course, returning the plain '0(success)/-1(fail)' still works, but you can be - more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - SWIG errors code. - - Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this - - int food(double) - int fooi(int); - - and you call - - food(1) // cast rank '1' (1 -> 1.0) - fooi(1) // cast rank '0' - - just use the SWIG_AddCast()/SWIG_CheckState() -*/ - -#define SWIG_OK (0) -#define SWIG_ERROR (-1) -#define SWIG_IsOK(r) (r >= 0) -#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) - -/* The CastRankLimit says how many bits are used for the cast rank */ -#define SWIG_CASTRANKLIMIT (1 << 8) -/* The NewMask denotes the object was created (using new/malloc) */ -#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ -#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) -/* Simple returning values */ -#define SWIG_BADOBJ (SWIG_ERROR) -#define SWIG_OLDOBJ (SWIG_OK) -#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) -#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ -#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) -#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) -#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) -#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) -#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) -#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - -/* Cast-Rank Mode */ -#if defined(SWIG_CASTRANK_MODE) -# ifndef SWIG_TypeRank -# define SWIG_TypeRank unsigned long -# endif -# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ -# define SWIG_MAXCASTRANK (2) -# endif -# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) -# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) -SWIGINTERNINLINE int SWIG_AddCast(int r) { - return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; -} -SWIGINTERNINLINE int SWIG_CheckState(int r) { - return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; -} -#else /* no cast-rank mode */ -# define SWIG_AddCast(r) (r) -# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) -#endif - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *(*swig_converter_func)(void *, int *); -typedef struct swig_type_info *(*swig_dycast_func)(void **); - -/* Structure to store information on one type */ -typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ - struct swig_cast_info *cast; /* linked list of types that can cast into this type */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ -} swig_type_info; - -/* Structure to store a type and conversion function used for casting */ -typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ -} swig_cast_info; - -/* Structure used to store module information - * Each module generates one structure like this, and the runtime collects - * all of these structures and stores them in a circularly linked list.*/ -typedef struct swig_module_info { - swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ - size_t size; /* Number of types in this module */ - struct swig_module_info *next; /* Pointer to next element in circularly linked list */ - swig_type_info **type_initial; /* Array of initially generated type structures */ - swig_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ -} swig_module_info; - -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class" == "Class", etc. - - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; - } - return (int)((l1 - f1) - (l2 - f2)); -} - -/* - Check type equivalence in a name list like ||... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb -*/ -SWIGRUNTIME int -SWIG_TypeCmp(const char *nb, const char *tb) { - int equiv = 1; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (equiv != 0 && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = SWIG_TypeNameComp(nb, ne, tb, te); - if (*ne) ++ne; - } - return equiv; -} - -/* - Check type equivalence in a name list like ||... - Return 0 if not equal, 1 if equal -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; -} - -/* - Check the typename -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Cast a pointer up an inheritance hierarchy -*/ -SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (!type) return NULL; - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; - } - else - return type->name; -} - -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void -SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; - /* if (ti->clientdata == clientdata) return; */ - ti->clientdata = clientdata; - - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); - } - } - cast = cast->next; - } -} -SWIGRUNTIME void -SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { - SWIG_TypeClientData(ti, clientdata); - ti->owndata = 1; -} - -/* - Search for a swig_type_info structure only by mangled name - Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - swig_module_info *iter = start; - do { - if (iter->size) { - size_t l = 0; - size_t r = iter->size - 1; - do { - /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - size_t i = (l + r) >> 1; - const char *iname = iter->types[i]->name; - if (iname) { - int compare = strcmp(name, iname); - if (compare == 0) { - return iter->types[i]; - } else if (compare < 0) { - if (i) { - r = i - 1; - } else { - break; - } - } else if (compare > 0) { - l = i + 1; - } - } else { - break; /* should never happen */ - } - } while (l <= r); - } - iter = iter->next; - } while (iter != end); - return 0; -} - -/* - Search for a swig_type_info structure for either a mangled name or a human readable name. - It first searches the mangled names of the types, which is a O(log #types) - If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - /* STEP 1: Search the name field using binary search */ - swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); - if (ret) { - return ret; - } else { - /* STEP 2: If the type hasn't been found, do a complete search - of the str field (the human readable name) */ - swig_module_info *iter = start; - do { - size_t i = 0; - for (; i < iter->size; ++i) { - if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) - return iter->types[i]; - } - iter = iter->next; - } while (iter != end); - } - - /* neither found a match */ - return 0; -} - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static const char hex[17] = "0123456789abcdef"; - const unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - unsigned char uu = *u; - *(c++) = hex[(uu & 0xf0) >> 4]; - *(c++) = hex[uu & 0xf]; - } - return c; -} - -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - char d = *(c++); - unsigned char uu; - if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); - else - return (char *) 0; - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); - else - return (char *) 0; - *u = uu; - } - return c; -} - -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} - -#ifdef __cplusplus -} -#endif - -/* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 -#define SWIG_SystemError -10 -#define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 -#define SWIG_NullReferenceError -13 - - - -/* Compatibility macros for Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - -#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) -#define PyInt_Check(x) PyLong_Check(x) -#define PyInt_AsLong(x) PyLong_AsLong(x) -#define PyInt_FromLong(x) PyLong_FromLong(x) -#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) -#define PyString_Check(name) PyBytes_Check(name) -#define PyString_FromString(x) PyUnicode_FromString(x) -#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) -#define PyString_AsString(str) PyBytes_AsString(str) -#define PyString_Size(str) PyBytes_Size(str) -#define PyString_InternFromString(key) PyUnicode_InternFromString(key) -#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE -#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) -#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) - -#endif - -#ifndef Py_TYPE -# define Py_TYPE(op) ((op)->ob_type) -#endif - -/* SWIG APIs for compatibility of both Python 2 & 3 */ - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_FromFormat PyUnicode_FromFormat -#else -# define SWIG_Python_str_FromFormat PyString_FromFormat -#endif - - -/* Warning: This function will allocate a new string in Python 3, - * so please call SWIG_Python_str_DelForPy3(x) to free the space. - */ -SWIGINTERN char* -SWIG_Python_str_AsChar(PyObject *str) -{ -#if PY_VERSION_HEX >= 0x03000000 - char *cstr; - char *newstr; - Py_ssize_t len; - str = PyUnicode_AsUTF8String(str); - PyBytes_AsStringAndSize(str, &cstr, &len); - newstr = (char *) malloc(len+1); - memcpy(newstr, cstr, len+1); - Py_XDECREF(str); - return newstr; -#else - return PyString_AsString(str); -#endif -} - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) -#else -# define SWIG_Python_str_DelForPy3(x) -#endif - - -SWIGINTERN PyObject* -SWIG_Python_str_FromChar(const char *c) -{ -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromString(c); -#else - return PyString_FromString(c); -#endif -} - -/* Add PyOS_snprintf for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 -# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) -# define PyOS_snprintf _snprintf -# else -# define PyOS_snprintf snprintf -# endif -#endif - -/* A crude PyString_FromFormat implementation for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 - -#ifndef SWIG_PYBUFFER_SIZE -# define SWIG_PYBUFFER_SIZE 1024 -#endif - -static PyObject * -PyString_FromFormat(const char *fmt, ...) { - va_list ap; - char buf[SWIG_PYBUFFER_SIZE * 2]; - int res; - va_start(ap, fmt); - res = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); -} -#endif - -/* Add PyObject_Del for old Pythons */ -#if PY_VERSION_HEX < 0x01060000 -# define PyObject_Del(op) PyMem_DEL((op)) -#endif -#ifndef PyObject_DEL -# define PyObject_DEL PyObject_Del -#endif - -/* A crude PyExc_StopIteration exception for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 -# ifndef PyExc_StopIteration -# define PyExc_StopIteration PyExc_RuntimeError -# endif -# ifndef PyObject_GenericGetAttr -# define PyObject_GenericGetAttr 0 -# endif -#endif - -/* Py_NotImplemented is defined in 2.1 and up. */ -#if PY_VERSION_HEX < 0x02010000 -# ifndef Py_NotImplemented -# define Py_NotImplemented PyExc_RuntimeError -# endif -#endif - -/* A crude PyString_AsStringAndSize implementation for old Pythons */ -#if PY_VERSION_HEX < 0x02010000 -# ifndef PyString_AsStringAndSize -# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} -# endif -#endif - -/* PySequence_Size for old Pythons */ -#if PY_VERSION_HEX < 0x02000000 -# ifndef PySequence_Size -# define PySequence_Size PySequence_Length -# endif -#endif - -/* PyBool_FromLong for old Pythons */ -#if PY_VERSION_HEX < 0x02030000 -static -PyObject *PyBool_FromLong(long ok) -{ - PyObject *result = ok ? Py_True : Py_False; - Py_INCREF(result); - return result; -} -#endif - -/* Py_ssize_t for old Pythons */ -/* This code is as recommended by: */ -/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) -typedef int Py_ssize_t; -# define PY_SSIZE_T_MAX INT_MAX -# define PY_SSIZE_T_MIN INT_MIN -typedef inquiry lenfunc; -typedef intargfunc ssizeargfunc; -typedef intintargfunc ssizessizeargfunc; -typedef intobjargproc ssizeobjargproc; -typedef intintobjargproc ssizessizeobjargproc; -typedef getreadbufferproc readbufferproc; -typedef getwritebufferproc writebufferproc; -typedef getsegcountproc segcountproc; -typedef getcharbufferproc charbufferproc; -static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) -{ - long result = 0; - PyObject *i = PyNumber_Int(x); - if (i) { - result = PyInt_AsLong(i); - Py_DECREF(i); - } - return result; -} -#endif - -#if PY_VERSION_HEX < 0x02050000 -#define PyInt_FromSize_t(x) PyInt_FromLong((long)x) -#endif - -#if PY_VERSION_HEX < 0x02040000 -#define Py_VISIT(op) \ - do { \ - if (op) { \ - int vret = visit((op), arg); \ - if (vret) \ - return vret; \ - } \ - } while (0) -#endif - -#if PY_VERSION_HEX < 0x02030000 -typedef struct { - PyTypeObject type; - PyNumberMethods as_number; - PyMappingMethods as_mapping; - PySequenceMethods as_sequence; - PyBufferProcs as_buffer; - PyObject *name, *slots; -} PyHeapTypeObject; -#endif - -#if PY_VERSION_HEX < 0x02030000 -typedef destructor freefunc; -#endif - -#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ - (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \ - (PY_MAJOR_VERSION > 3)) -# define SWIGPY_USE_CAPSULE -# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) -#endif - -#if PY_VERSION_HEX < 0x03020000 -#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) -#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) -#endif - -/* ----------------------------------------------------------------------------- - * error manipulation - * ----------------------------------------------------------------------------- */ - -SWIGRUNTIME PyObject* -SWIG_Python_ErrorType(int code) { - PyObject* type = 0; - switch(code) { - case SWIG_MemoryError: - type = PyExc_MemoryError; - break; - case SWIG_IOError: - type = PyExc_IOError; - break; - case SWIG_RuntimeError: - type = PyExc_RuntimeError; - break; - case SWIG_IndexError: - type = PyExc_IndexError; - break; - case SWIG_TypeError: - type = PyExc_TypeError; - break; - case SWIG_DivisionByZero: - type = PyExc_ZeroDivisionError; - break; - case SWIG_OverflowError: - type = PyExc_OverflowError; - break; - case SWIG_SyntaxError: - type = PyExc_SyntaxError; - break; - case SWIG_ValueError: - type = PyExc_ValueError; - break; - case SWIG_SystemError: - type = PyExc_SystemError; - break; - case SWIG_AttributeError: - type = PyExc_AttributeError; - break; - default: - type = PyExc_RuntimeError; - } - return type; -} - - -SWIGRUNTIME void -SWIG_Python_AddErrorMsg(const char* mesg) -{ - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - - if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); - if (value) { - char *tmp; - PyObject *old_str = PyObject_Str(value); - PyErr_Clear(); - Py_XINCREF(type); - - PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); - Py_DECREF(value); - } else { - PyErr_SetString(PyExc_RuntimeError, mesg); - } -} - -#if defined(SWIG_PYTHON_NO_THREADS) -# if defined(SWIG_PYTHON_THREADS) -# undef SWIG_PYTHON_THREADS -# endif -#endif -#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ -# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) -# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ -# define SWIG_PYTHON_USE_GIL -# endif -# endif -# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ -# ifndef SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() -# endif -# ifdef __cplusplus /* C++ code */ - class SWIG_Python_Thread_Block { - bool status; - PyGILState_STATE state; - public: - void end() { if (status) { PyGILState_Release(state); status = false;} } - SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} - ~SWIG_Python_Thread_Block() { end(); } - }; - class SWIG_Python_Thread_Allow { - bool status; - PyThreadState *save; - public: - void end() { if (status) { PyEval_RestoreThread(save); status = false; }} - SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} - ~SWIG_Python_Thread_Allow() { end(); } - }; -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block -# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow -# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() -# else /* C code */ -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() -# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() -# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) -# endif -# else /* Old thread way, not implemented, user must provide it */ -# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) -# define SWIG_PYTHON_INITIALIZE_THREADS -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) -# define SWIG_PYTHON_THREAD_END_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# endif -# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) -# define SWIG_PYTHON_THREAD_END_ALLOW -# endif -# endif -#else /* No thread support */ -# define SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# define SWIG_PYTHON_THREAD_END_BLOCK -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# define SWIG_PYTHON_THREAD_END_ALLOW -#endif - -/* ----------------------------------------------------------------------------- - * Python API portion that goes into the runtime - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* ----------------------------------------------------------------------------- - * Constant declarations - * ----------------------------------------------------------------------------- */ - -/* Constant Types */ -#define SWIG_PY_POINTER 4 -#define SWIG_PY_BINARY 5 - -/* Constant information structure */ -typedef struct swig_const_info { - int type; - char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_const_info; - - -/* ----------------------------------------------------------------------------- - * Wrapper of PyInstanceMethod_New() used in Python 3 - * It is exported to the generated module, used for -fastproxy - * ----------------------------------------------------------------------------- */ -#if PY_VERSION_HEX >= 0x03000000 -SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) -{ - return PyInstanceMethod_New(func); -} -#else -SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func)) -{ - return NULL; -} -#endif - -#ifdef __cplusplus -} -#endif - - -/* ----------------------------------------------------------------------------- - * pyrun.swg - * - * This file contains the runtime support for Python modules - * and includes code for managing global variables and pointer - * type checking. - * - * ----------------------------------------------------------------------------- */ - -/* Common SWIG API */ - -/* for raw pointers */ -#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) -#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) -#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) - -#ifdef SWIGPYTHON_BUILTIN -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) -#else -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) -#endif - -#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) - -#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) -#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) -#define swig_owntype int - -/* for raw packed data */ -#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - -/* for class or struct pointers */ -#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) -#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) - -/* for C or C++ function pointers */ -#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) -#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) - -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - - -/* Runtime API */ - -#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata) -#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) -#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) - -#define SWIG_SetErrorObj SWIG_Python_SetErrorObj -#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg -#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) -#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail - - -/* Runtime API implementation */ - -/* Error manipulation */ - -SWIGINTERN void -SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetObject(errtype, obj); - Py_DECREF(obj); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -SWIGINTERN void -SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetString(errtype, msg); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) - -/* Set a constant value */ - -#if defined(SWIGPYTHON_BUILTIN) - -SWIGINTERN void -SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { - PyObject *s = PyString_InternFromString(key); - PyList_Append(seq, s); - Py_DECREF(s); -} - -SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { -#if PY_VERSION_HEX < 0x02030000 - PyDict_SetItemString(d, (char *)name, obj); -#else - PyDict_SetItemString(d, name, obj); -#endif - Py_DECREF(obj); - if (public_interface) - SwigPyBuiltin_AddPublicSymbol(public_interface, name); -} - -#else - -SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { -#if PY_VERSION_HEX < 0x02030000 - PyDict_SetItemString(d, (char *)name, obj); -#else - PyDict_SetItemString(d, name, obj); -#endif - Py_DECREF(obj); -} - -#endif - -/* Append a value to the result obj */ - -SWIGINTERN PyObject* -SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { -#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) - if (!result) { - result = obj; - } else if (result == Py_None) { - Py_DECREF(result); - result = obj; - } else { - if (!PyList_Check(result)) { - PyObject *o2 = result; - result = PyList_New(1); - PyList_SetItem(result, 0, o2); - } - PyList_Append(result,obj); - Py_DECREF(obj); - } - return result; -#else - PyObject* o2; - PyObject* o3; - if (!result) { - result = obj; - } else if (result == Py_None) { - Py_DECREF(result); - result = obj; - } else { - if (!PyTuple_Check(result)) { - o2 = result; - result = PyTuple_New(1); - PyTuple_SET_ITEM(result, 0, o2); - } - o3 = PyTuple_New(1); - PyTuple_SET_ITEM(o3, 0, obj); - o2 = result; - result = PySequence_Concat(o2, o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - return result; -#endif -} - -/* Unpack the argument tuple */ - -SWIGINTERN int -SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) -{ - if (!args) { - if (!min && !max) { - return 1; - } else { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", - name, (min == max ? "" : "at least "), (int)min); - return 0; - } - } - if (!PyTuple_Check(args)) { - if (min <= 1 && max >= 1) { - int i; - objs[0] = args; - for (i = 1; i < max; ++i) { - objs[i] = 0; - } - return 2; - } - PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); - return 0; - } else { - Py_ssize_t l = PyTuple_GET_SIZE(args); - if (l < min) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at least "), (int)min, (int)l); - return 0; - } else if (l > max) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at most "), (int)max, (int)l); - return 0; - } else { - int i; - for (i = 0; i < l; ++i) { - objs[i] = PyTuple_GET_ITEM(args, i); - } - for (; l < max; ++l) { - objs[l] = 0; - } - return i + 1; - } - } -} - -/* A functor is a function object with one single object argument */ -#if PY_VERSION_HEX >= 0x02020000 -#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); -#else -#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); -#endif - -/* - Helper for static pointer initialization for both C and C++ code, for example - static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); -*/ -#ifdef __cplusplus -#define SWIG_STATIC_POINTER(var) var -#else -#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var -#endif - -/* ----------------------------------------------------------------------------- - * Pointer declarations - * ----------------------------------------------------------------------------- */ - -/* Flags for new pointer objects */ -#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) -#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) - -#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) - -#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) -#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) - -#ifdef __cplusplus -extern "C" { -#endif - -/* How to access Py_None */ -#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# ifndef SWIG_PYTHON_NO_BUILD_NONE -# ifndef SWIG_PYTHON_BUILD_NONE -# define SWIG_PYTHON_BUILD_NONE -# endif -# endif -#endif - -#ifdef SWIG_PYTHON_BUILD_NONE -# ifdef Py_None -# undef Py_None -# define Py_None SWIG_Py_None() -# endif -SWIGRUNTIMEINLINE PyObject * -_SWIG_Py_None(void) -{ - PyObject *none = Py_BuildValue((char*)""); - Py_DECREF(none); - return none; -} -SWIGRUNTIME PyObject * -SWIG_Py_None(void) -{ - static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); - return none; -} -#endif - -/* The python void return value */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Py_Void(void) -{ - PyObject *none = Py_None; - Py_INCREF(none); - return none; -} - -/* SwigPyClientData */ - -typedef struct { - PyObject *klass; - PyObject *newraw; - PyObject *newargs; - PyObject *destroy; - int delargs; - int implicitconv; - PyTypeObject *pytype; -} SwigPyClientData; - -SWIGRUNTIMEINLINE int -SWIG_Python_CheckImplicit(swig_type_info *ty) -{ - SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; - return data ? data->implicitconv : 0; -} - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_ExceptionType(swig_type_info *desc) { - SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; - PyObject *klass = data ? data->klass : 0; - return (klass ? klass : PyExc_RuntimeError); -} - - -SWIGRUNTIME SwigPyClientData * -SwigPyClientData_New(PyObject* obj) -{ - if (!obj) { - return 0; - } else { - SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); - /* the klass element */ - data->klass = obj; - Py_INCREF(data->klass); - /* the newraw method and newargs arguments used to create a new raw instance */ - if (PyClass_Check(obj)) { - data->newraw = 0; - data->newargs = obj; - Py_INCREF(obj); - } else { -#if (PY_VERSION_HEX < 0x02020000) - data->newraw = 0; -#else - data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); -#endif - if (data->newraw) { - Py_INCREF(data->newraw); - data->newargs = PyTuple_New(1); - PyTuple_SetItem(data->newargs, 0, obj); - } else { - data->newargs = obj; - } - Py_INCREF(data->newargs); - } - /* the destroy method, aka as the C++ delete method */ - data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); - if (PyErr_Occurred()) { - PyErr_Clear(); - data->destroy = 0; - } - if (data->destroy) { - int flags; - Py_INCREF(data->destroy); - flags = PyCFunction_GET_FLAGS(data->destroy); -#ifdef METH_O - data->delargs = !(flags & (METH_O)); -#else - data->delargs = 0; -#endif - } else { - data->delargs = 0; - } - data->implicitconv = 0; - data->pytype = 0; - return data; - } -} - -SWIGRUNTIME void -SwigPyClientData_Del(SwigPyClientData *data) { - Py_XDECREF(data->newraw); - Py_XDECREF(data->newargs); - Py_XDECREF(data->destroy); -} - -/* =============== SwigPyObject =====================*/ - -typedef struct { - PyObject_HEAD - void *ptr; - swig_type_info *ty; - int own; - PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif -} SwigPyObject; - -SWIGRUNTIME PyObject * -SwigPyObject_long(SwigPyObject *v) -{ - return PyLong_FromVoidPtr(v->ptr); -} - -SWIGRUNTIME PyObject * -SwigPyObject_format(const char* fmt, SwigPyObject *v) -{ - PyObject *res = NULL; - PyObject *args = PyTuple_New(1); - if (args) { - if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { - PyObject *ofmt = SWIG_Python_str_FromChar(fmt); - if (ofmt) { -#if PY_VERSION_HEX >= 0x03000000 - res = PyUnicode_Format(ofmt,args); -#else - res = PyString_Format(ofmt,args); -#endif - Py_DECREF(ofmt); - } - Py_DECREF(args); - } - } - return res; -} - -SWIGRUNTIME PyObject * -SwigPyObject_oct(SwigPyObject *v) -{ - return SwigPyObject_format("%o",v); -} - -SWIGRUNTIME PyObject * -SwigPyObject_hex(SwigPyObject *v) -{ - return SwigPyObject_format("%x",v); -} - -SWIGRUNTIME PyObject * -#ifdef METH_NOARGS -SwigPyObject_repr(SwigPyObject *v) -#else -SwigPyObject_repr(SwigPyObject *v, PyObject *args) -#endif -{ - const char *name = SWIG_TypePrettyName(v->ty); - PyObject *repr = SWIG_Python_str_FromFormat("", (name ? name : "unknown"), (void *)v); - if (v->next) { -# ifdef METH_NOARGS - PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); -# else - PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); -# endif -# if PY_VERSION_HEX >= 0x03000000 - PyObject *joined = PyUnicode_Concat(repr, nrep); - Py_DecRef(repr); - Py_DecRef(nrep); - repr = joined; -# else - PyString_ConcatAndDel(&repr,nrep); -# endif - } - return repr; -} - -SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) -{ - void *i = v->ptr; - void *j = w->ptr; - return (i < j) ? -1 : ((i > j) ? 1 : 0); -} - -/* Added for Python 3.x, would it also be useful for Python 2.x? */ -SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) -{ - PyObject* res; - if( op != Py_EQ && op != Py_NE ) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); - return res; -} - - -SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); - -#ifdef SWIGPYTHON_BUILTIN -static swig_type_info *SwigPyObject_stype = 0; -SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { - SwigPyClientData *cd; - assert(SwigPyObject_stype); - cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; - assert(cd); - assert(cd->pytype); - return cd->pytype; -} -#else -SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); - return type; -} -#endif - -SWIGRUNTIMEINLINE int -SwigPyObject_Check(PyObject *op) { -#ifdef SWIGPYTHON_BUILTIN - PyTypeObject *target_tp = SwigPyObject_type(); - if (PyType_IsSubtype(op->ob_type, target_tp)) - return 1; - return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); -#else - return (Py_TYPE(op) == SwigPyObject_type()) - || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); -#endif -} - -SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own); - -SWIGRUNTIME void -SwigPyObject_dealloc(PyObject *v) -{ - SwigPyObject *sobj = (SwigPyObject *) v; - PyObject *next = sobj->next; - if (sobj->own == SWIG_POINTER_OWN) { - swig_type_info *ty = sobj->ty; - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; - PyObject *destroy = data ? data->destroy : 0; - if (destroy) { - /* destroy is always a VARARGS method */ - PyObject *res; - if (data->delargs) { - /* we need to create a temporary object to carry the destroy operation */ - PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); - res = SWIG_Python_CallFunctor(destroy, tmp); - Py_DECREF(tmp); - } else { - PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); - PyObject *mself = PyCFunction_GET_SELF(destroy); - res = ((*meth)(mself, v)); - } - Py_XDECREF(res); - } -#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - else { - const char *name = SWIG_TypePrettyName(ty); - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); - } -#endif - } - Py_XDECREF(next); - PyObject_DEL(v); -} - -SWIGRUNTIME PyObject* -SwigPyObject_append(PyObject* v, PyObject* next) -{ - SwigPyObject *sobj = (SwigPyObject *) v; -#ifndef METH_O - PyObject *tmp = 0; - if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; - next = tmp; -#endif - if (!SwigPyObject_Check(next)) { - return NULL; - } - sobj->next = next; - Py_INCREF(next); - return SWIG_Py_Void(); -} - -SWIGRUNTIME PyObject* -#ifdef METH_NOARGS -SwigPyObject_next(PyObject* v) -#else -SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -#endif -{ - SwigPyObject *sobj = (SwigPyObject *) v; - if (sobj->next) { - Py_INCREF(sobj->next); - return sobj->next; - } else { - return SWIG_Py_Void(); - } -} - -SWIGINTERN PyObject* -#ifdef METH_NOARGS -SwigPyObject_disown(PyObject *v) -#else -SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -#endif -{ - SwigPyObject *sobj = (SwigPyObject *)v; - sobj->own = 0; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -#ifdef METH_NOARGS -SwigPyObject_acquire(PyObject *v) -#else -SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -#endif -{ - SwigPyObject *sobj = (SwigPyObject *)v; - sobj->own = SWIG_POINTER_OWN; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -SwigPyObject_own(PyObject *v, PyObject *args) -{ - PyObject *val = 0; -#if (PY_VERSION_HEX < 0x02020000) - if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) -#elif (PY_VERSION_HEX < 0x02050000) - if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) -#else - if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) -#endif - { - return NULL; - } - else - { - SwigPyObject *sobj = (SwigPyObject *)v; - PyObject *obj = PyBool_FromLong(sobj->own); - if (val) { -#ifdef METH_NOARGS - if (PyObject_IsTrue(val)) { - SwigPyObject_acquire(v); - } else { - SwigPyObject_disown(v); - } -#else - if (PyObject_IsTrue(val)) { - SwigPyObject_acquire(v,args); - } else { - SwigPyObject_disown(v,args); - } -#endif - } - return obj; - } -} - -#ifdef METH_O -static PyMethodDef -swigobject_methods[] = { - {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"}, - {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, - {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, - {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, - {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, - {0, 0, 0, 0} -}; -#else -static PyMethodDef -swigobject_methods[] = { - {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, - {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, - {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, - {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, - {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, - {0, 0, 0, 0} -}; -#endif - -#if PY_VERSION_HEX < 0x02020000 -SWIGINTERN PyObject * -SwigPyObject_getattr(SwigPyObject *sobj,char *name) -{ - return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); -} -#endif - -SWIGRUNTIME PyTypeObject* -SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; - - static PyNumberMethods SwigPyObject_as_number = { - (binaryfunc)0, /*nb_add*/ - (binaryfunc)0, /*nb_subtract*/ - (binaryfunc)0, /*nb_multiply*/ - /* nb_divide removed in Python 3 */ -#if PY_VERSION_HEX < 0x03000000 - (binaryfunc)0, /*nb_divide*/ -#endif - (binaryfunc)0, /*nb_remainder*/ - (binaryfunc)0, /*nb_divmod*/ - (ternaryfunc)0,/*nb_power*/ - (unaryfunc)0, /*nb_negative*/ - (unaryfunc)0, /*nb_positive*/ - (unaryfunc)0, /*nb_absolute*/ - (inquiry)0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ -#if PY_VERSION_HEX < 0x03000000 - 0, /*nb_coerce*/ -#endif - (unaryfunc)SwigPyObject_long, /*nb_int*/ -#if PY_VERSION_HEX < 0x03000000 - (unaryfunc)SwigPyObject_long, /*nb_long*/ -#else - 0, /*nb_reserved*/ -#endif - (unaryfunc)0, /*nb_float*/ -#if PY_VERSION_HEX < 0x03000000 - (unaryfunc)SwigPyObject_oct, /*nb_oct*/ - (unaryfunc)SwigPyObject_hex, /*nb_hex*/ -#endif -#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ -#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ -#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ -#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ - 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ -#endif - }; - - static PyTypeObject swigpyobject_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - (char *)"SwigPyObject", /* tp_name */ - sizeof(SwigPyObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - 0, /* tp_print */ -#if PY_VERSION_HEX < 0x02020000 - (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ -#else - (getattrfunc)0, /* tp_getattr */ -#endif - (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX >= 0x03000000 - 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ -#else - (cmpfunc)SwigPyObject_compare, /* tp_compare */ -#endif - (reprfunc)SwigPyObject_repr, /* tp_repr */ - &SwigPyObject_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#if PY_VERSION_HEX >= 0x02020000 - 0, /* tp_iter */ - 0, /* tp_iternext */ - swigobject_methods, /* 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 */ - 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 */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - swigpyobject_type = tmp; - type_init = 1; -#if PY_VERSION_HEX < 0x02020000 - swigpyobject_type.ob_type = &PyType_Type; -#else - if (PyType_Ready(&swigpyobject_type) < 0) - return NULL; -#endif - } - return &swigpyobject_type; -} - -SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own) -{ - SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); - if (sobj) { - sobj->ptr = ptr; - sobj->ty = ty; - sobj->own = own; - sobj->next = 0; - } - return (PyObject *)sobj; -} - -/* ----------------------------------------------------------------------------- - * Implements a simple Swig Packed type, and use it instead of string - * ----------------------------------------------------------------------------- */ - -typedef struct { - PyObject_HEAD - void *pack; - swig_type_info *ty; - size_t size; -} SwigPyPacked; - -SWIGRUNTIME int -SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) -{ - char result[SWIG_BUFFER_SIZE]; - fputs("pack, v->size, 0, sizeof(result))) { - fputs("at ", fp); - fputs(result, fp); - } - fputs(v->ty->name,fp); - fputs(">", fp); - return 0; -} - -SWIGRUNTIME PyObject * -SwigPyPacked_repr(SwigPyPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { - return SWIG_Python_str_FromFormat("", result, v->ty->name); - } else { - return SWIG_Python_str_FromFormat("", v->ty->name); - } -} - -SWIGRUNTIME PyObject * -SwigPyPacked_str(SwigPyPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ - return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); - } else { - return SWIG_Python_str_FromChar(v->ty->name); - } -} - -SWIGRUNTIME int -SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) -{ - size_t i = v->size; - size_t j = w->size; - int s = (i < j) ? -1 : ((i > j) ? 1 : 0); - return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); -} - -SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); - -SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); - return type; -} - -SWIGRUNTIMEINLINE int -SwigPyPacked_Check(PyObject *op) { - return ((op)->ob_type == SwigPyPacked_TypeOnce()) - || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); -} - -SWIGRUNTIME void -SwigPyPacked_dealloc(PyObject *v) -{ - if (SwigPyPacked_Check(v)) { - SwigPyPacked *sobj = (SwigPyPacked *) v; - free(sobj->pack); - } - PyObject_DEL(v); -} - -SWIGRUNTIME PyTypeObject* -SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; - static PyTypeObject swigpypacked_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ -#if PY_VERSION_HEX>=0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - (char *)"SwigPyPacked", /* tp_name */ - sizeof(SwigPyPacked), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ - (printfunc)SwigPyPacked_print, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 - 0, /* tp_reserved in 3.0.1 */ -#else - (cmpfunc)SwigPyPacked_compare, /* tp_compare */ -#endif - (reprfunc)SwigPyPacked_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)SwigPyPacked_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#if PY_VERSION_HEX >= 0x02020000 - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* 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 */ - 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 */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - swigpypacked_type = tmp; - type_init = 1; -#if PY_VERSION_HEX < 0x02020000 - swigpypacked_type.ob_type = &PyType_Type; -#else - if (PyType_Ready(&swigpypacked_type) < 0) - return NULL; -#endif - } - return &swigpypacked_type; -} - -SWIGRUNTIME PyObject * -SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) -{ - SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); - if (sobj) { - void *pack = malloc(size); - if (pack) { - memcpy(pack, ptr, size); - sobj->pack = pack; - sobj->ty = ty; - sobj->size = size; - } else { - PyObject_DEL((PyObject *) sobj); - sobj = 0; - } - } - return (PyObject *) sobj; -} - -SWIGRUNTIME swig_type_info * -SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) -{ - if (SwigPyPacked_Check(obj)) { - SwigPyPacked *sobj = (SwigPyPacked *)obj; - if (sobj->size != size) return 0; - memcpy(ptr, sobj->pack, size); - return sobj->ty; - } else { - return 0; - } -} - -/* ----------------------------------------------------------------------------- - * pointers/data manipulation - * ----------------------------------------------------------------------------- */ - -SWIGRUNTIMEINLINE PyObject * -_SWIG_This(void) -{ - return SWIG_Python_str_FromChar("this"); -} - -static PyObject *swig_this = NULL; - -SWIGRUNTIME PyObject * -SWIG_This(void) -{ - if (swig_this == NULL) - swig_this = _SWIG_This(); - return swig_this; -} - -/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ - -/* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 -#define SWIG_PYTHON_SLOW_GETSET_THIS -#endif - -SWIGRUNTIME SwigPyObject * -SWIG_Python_GetSwigThis(PyObject *pyobj) -{ - PyObject *obj; - - if (SwigPyObject_Check(pyobj)) - return (SwigPyObject *) pyobj; - -#ifdef SWIGPYTHON_BUILTIN - (void)obj; -# ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { - pyobj = PyWeakref_GET_OBJECT(pyobj); - if (pyobj && SwigPyObject_Check(pyobj)) - return (SwigPyObject*) pyobj; - } -# endif - return NULL; -#else - - obj = 0; - -#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) - if (PyInstance_Check(pyobj)) { - obj = _PyInstance_Lookup(pyobj, SWIG_This()); - } else { - PyObject **dictptr = _PyObject_GetDictPtr(pyobj); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; - } else { -#ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); - return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; - } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } - } - } -#else - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } -#endif - if (obj && !SwigPyObject_Check(obj)) { - /* a PyObject is called 'this', try to get the 'real this' - SwigPyObject from it */ - return SWIG_Python_GetSwigThis(obj); - } - return (SwigPyObject *)obj; -#endif -} - -/* Acquire a pointer value */ - -SWIGRUNTIME int -SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own == SWIG_POINTER_OWN) { - SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); - if (sobj) { - int oldown = sobj->own; - sobj->own = own; - return oldown; - } - } - return 0; -} - -/* Convert a pointer value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { - int res; - SwigPyObject *sobj; - int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; - - if (!obj) - return SWIG_ERROR; - if (obj == Py_None && !implicit_conv) { - if (ptr) - *ptr = 0; - return SWIG_OK; - } - - res = SWIG_ERROR; - - sobj = SWIG_Python_GetSwigThis(obj); - if (own) - *own = 0; - while (sobj) { - void *vptr = sobj->ptr; - if (ty) { - swig_type_info *to = sobj->ty; - if (to == ty) { - /* no type cast needed */ - if (ptr) *ptr = vptr; - break; - } else { - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) { - sobj = (SwigPyObject *)sobj->next; - } else { - if (ptr) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ - if (own) - *own = *own | SWIG_CAST_NEW_MEMORY; - } - } - break; - } - } - } else { - if (ptr) *ptr = vptr; - break; - } - } - if (sobj) { - if (own) - *own = *own | sobj->own; - if (flags & SWIG_POINTER_DISOWN) { - sobj->own = 0; - } - res = SWIG_OK; - } else { - if (implicit_conv) { - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; - if (data && !data->implicitconv) { - PyObject *klass = data->klass; - if (klass) { - PyObject *impconv; - data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ - impconv = SWIG_Python_CallFunctor(klass, obj); - data->implicitconv = 0; - if (PyErr_Occurred()) { - PyErr_Clear(); - impconv = 0; - } - if (impconv) { - SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); - if (iobj) { - void *vptr; - res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); - if (SWIG_IsOK(res)) { - if (ptr) { - *ptr = vptr; - /* transfer the ownership to 'ptr' */ - iobj->own = 0; - res = SWIG_AddCast(res); - res = SWIG_AddNewMask(res); - } else { - res = SWIG_AddCast(res); - } - } - } - Py_DECREF(impconv); - } - } - } - } - if (!SWIG_IsOK(res) && obj == Py_None) { - if (ptr) - *ptr = 0; - if (PyErr_Occurred()) - PyErr_Clear(); - res = SWIG_OK; - } - } - return res; -} - -/* Convert a function ptr value */ - -SWIGRUNTIME int -SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { - if (!PyCFunction_Check(obj)) { - return SWIG_ConvertPtr(obj, ptr, ty, 0); - } else { - void *vptr = 0; - - /* here we get the method pointer for callbacks */ - const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); - const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; - if (desc) - desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; - if (!desc) - return SWIG_ERROR; - if (ty) { - swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (tc) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } else { - return SWIG_ERROR; - } - } else { - *ptr = vptr; - } - return SWIG_OK; - } -} - -/* Convert a packed value value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { - swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); - if (!to) return SWIG_ERROR; - if (ty) { - if (to != ty) { - /* check type cast? */ - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) return SWIG_ERROR; - } - } - return SWIG_OK; -} - -/* ----------------------------------------------------------------------------- - * Create a new pointer object - * ----------------------------------------------------------------------------- */ - -/* - Create a new instance object, without calling __init__, and set the - 'this' attribute. -*/ - -SWIGRUNTIME PyObject* -SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) -{ -#if (PY_VERSION_HEX >= 0x02020000) - PyObject *inst = 0; - PyObject *newraw = data->newraw; - if (newraw) { - inst = PyObject_Call(newraw, data->newargs, NULL); - if (inst) { -#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - PyDict_SetItem(dict, SWIG_This(), swig_this); - } - } -#else - PyObject *key = SWIG_This(); - PyObject_SetAttr(inst, key, swig_this); -#endif - } - } else { -#if PY_VERSION_HEX >= 0x03000000 - inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); - if (inst) { - PyObject_SetAttr(inst, SWIG_This(), swig_this); - Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; - } -#else - PyObject *dict = PyDict_New(); - if (dict) { - PyDict_SetItem(dict, SWIG_This(), swig_this); - inst = PyInstance_NewRaw(data->newargs, dict); - Py_DECREF(dict); - } -#endif - } - return inst; -#else -#if (PY_VERSION_HEX >= 0x02010000) - PyObject *inst = 0; - PyObject *dict = PyDict_New(); - if (dict) { - PyDict_SetItem(dict, SWIG_This(), swig_this); - inst = PyInstance_NewRaw(data->newargs, dict); - Py_DECREF(dict); - } - return (PyObject *) inst; -#else - PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); - if (inst == NULL) { - return NULL; - } - inst->in_class = (PyClassObject *)data->newargs; - Py_INCREF(inst->in_class); - inst->in_dict = PyDict_New(); - if (inst->in_dict == NULL) { - Py_DECREF(inst); - return NULL; - } -#ifdef Py_TPFLAGS_HAVE_WEAKREFS - inst->in_weakreflist = NULL; -#endif -#ifdef Py_TPFLAGS_GC - PyObject_GC_Init(inst); -#endif - PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); - return (PyObject *) inst; -#endif -#endif -} - -SWIGRUNTIME void -SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) -{ - PyObject *dict; -#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - } - PyDict_SetItem(dict, SWIG_This(), swig_this); - return; - } -#endif - dict = PyObject_GetAttrString(inst, (char*)"__dict__"); - PyDict_SetItem(dict, SWIG_This(), swig_this); - Py_DECREF(dict); -} - - -SWIGINTERN PyObject * -SWIG_Python_InitShadowInstance(PyObject *args) { - PyObject *obj[2]; - if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { - return NULL; - } else { - SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); - if (sthis) { - SwigPyObject_append((PyObject*) sthis, obj[1]); - } else { - SWIG_Python_SetSwigThis(obj[0], obj[1]); - } - return SWIG_Py_Void(); - } -} - -/* Create a new pointer object */ - -SWIGRUNTIME PyObject * -SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { - SwigPyClientData *clientdata; - PyObject * robj; - int own; - - if (!ptr) - return SWIG_Py_Void(); - - clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; - own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; - if (clientdata && clientdata->pytype) { - SwigPyObject *newobj; - if (flags & SWIG_BUILTIN_TP_INIT) { - newobj = (SwigPyObject*) self; - if (newobj->ptr) { - PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); - while (newobj->next) - newobj = (SwigPyObject *) newobj->next; - newobj->next = next_self; - newobj = (SwigPyObject *)next_self; - } - } else { - newobj = PyObject_New(SwigPyObject, clientdata->pytype); - } - if (newobj) { - newobj->ptr = ptr; - newobj->ty = type; - newobj->own = own; - newobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif - return (PyObject*) newobj; - } - return SWIG_Py_Void(); - } - - assert(!(flags & SWIG_BUILTIN_TP_INIT)); - - robj = SwigPyObject_New(ptr, type, own); - if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { - PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); - Py_DECREF(robj); - robj = inst; - } - return robj; -} - -/* Create a new packed object */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { - return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); -} - -/* -----------------------------------------------------------------------------* - * Get type list - * -----------------------------------------------------------------------------*/ - -#ifdef SWIG_LINK_RUNTIME -void *SWIG_ReturnGlobalTypeList(void *); -#endif - -SWIGRUNTIME swig_module_info * -SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { - static void *type_pointer = (void *)0; - /* first check if module already created */ - if (!type_pointer) { -#ifdef SWIG_LINK_RUNTIME - type_pointer = SWIG_ReturnGlobalTypeList((void *)0); -#else -# ifdef SWIGPY_USE_CAPSULE - type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); -# else - type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, - (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); -# endif - if (PyErr_Occurred()) { - PyErr_Clear(); - type_pointer = (void *)0; - } -#endif - } - return (swig_module_info *) type_pointer; -} - -#if PY_MAJOR_VERSION < 2 -/* PyModule_AddObject function was introduced in Python 2.0. The following function - is copied out of Python/modsupport.c in python version 2.3.4 */ -SWIGINTERN int -PyModule_AddObject(PyObject *m, char *name, PyObject *o) -{ - PyObject *dict; - if (!PyModule_Check(m)) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs module as first arg"); - return SWIG_ERROR; - } - if (!o) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs non-NULL value"); - return SWIG_ERROR; - } - - dict = PyModule_GetDict(m); - if (dict == NULL) { - /* Internal error -- modules must have a dict! */ - PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", - PyModule_GetName(m)); - return SWIG_ERROR; - } - if (PyDict_SetItemString(dict, name, o)) - return SWIG_ERROR; - Py_DECREF(o); - return SWIG_OK; -} -#endif - -SWIGRUNTIME void -#ifdef SWIGPY_USE_CAPSULE -SWIG_Python_DestroyModule(PyObject *obj) -#else -SWIG_Python_DestroyModule(void *vptr) -#endif -{ -#ifdef SWIGPY_USE_CAPSULE - swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); -#else - swig_module_info *swig_module = (swig_module_info *) vptr; -#endif - swig_type_info **types = swig_module->types; - size_t i; - for (i =0; i < swig_module->size; ++i) { - swig_type_info *ty = types[i]; - if (ty->owndata) { - SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; - if (data) SwigPyClientData_Del(data); - } - } - Py_DECREF(SWIG_This()); - swig_this = NULL; -} - -SWIGRUNTIME void -SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif -#ifdef SWIGPY_USE_CAPSULE - PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); - } else { - Py_XDECREF(pointer); - } -#else - PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); - if (pointer && module) { - PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); - } else { - Py_XDECREF(pointer); - } -#endif -} - -/* The python cached type query */ -SWIGRUNTIME PyObject * -SWIG_Python_TypeCache(void) { - static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); - return cache; -} - -SWIGRUNTIME swig_type_info * -SWIG_Python_TypeQuery(const char *type) -{ - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); - swig_type_info *descriptor; - if (obj) { -#ifdef SWIGPY_USE_CAPSULE - descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); -#else - descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); -#endif - } else { - swig_module_info *swig_module = SWIG_GetModule(0); - descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); - if (descriptor) { -#ifdef SWIGPY_USE_CAPSULE - obj = PyCapsule_New((void*) descriptor, NULL, NULL); -#else - obj = PyCObject_FromVoidPtr(descriptor, NULL); -#endif - PyDict_SetItem(cache, key, obj); - Py_DECREF(obj); - } - } - Py_DECREF(key); - return descriptor; -} - -/* - For backward compatibility only -*/ -#define SWIG_POINTER_EXCEPTION 0 -#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) -#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) - -SWIGRUNTIME int -SWIG_Python_AddErrMesg(const char* mesg, int infront) -{ - if (PyErr_Occurred()) { - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - PyErr_Fetch(&type, &value, &traceback); - if (value) { - char *tmp; - PyObject *old_str = PyObject_Str(value); - Py_XINCREF(type); - PyErr_Clear(); - if (infront) { - PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); - } else { - PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); - } - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); - } - return 1; - } else { - return 0; - } -} - -SWIGRUNTIME int -SWIG_Python_ArgFail(int argnum) -{ - if (PyErr_Occurred()) { - /* add information about failing argument */ - char mesg[256]; - PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); - return SWIG_Python_AddErrMesg(mesg, 1); - } else { - return 0; - } -} - -SWIGRUNTIMEINLINE const char * -SwigPyObject_GetDesc(PyObject *self) -{ - SwigPyObject *v = (SwigPyObject *)self; - swig_type_info *ty = v ? v->ty : 0; - return ty ? ty->str : ""; -} - -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - SWIG_Python_str_DelForPy3(cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - Py_XDECREF(str); - return; - } - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - -/* Convert a pointer value, signal an exception on a type mismatch */ -SWIGRUNTIME void * -SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { - void *result; - if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { - PyErr_Clear(); -#if SWIG_POINTER_EXCEPTION - if (flags) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); - SWIG_Python_ArgFail(argnum); - } -#endif - } - return result; -} - -#ifdef SWIGPYTHON_BUILTIN -SWIGRUNTIME int -SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; - PyObject *descr; - PyObject *encoded_name; - descrsetfunc f; - int res = -1; - -# ifdef Py_USING_UNICODE - if (PyString_Check(name)) { - name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); - if (!name) - return -1; - } else if (!PyUnicode_Check(name)) -# else - if (!PyString_Check(name)) -# endif - { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); - return -1; - } else { - Py_INCREF(name); - } - - if (!tp->tp_dict) { - if (PyType_Ready(tp) < 0) - goto done; - } - - descr = _PyType_Lookup(tp, name); - f = NULL; - if (descr != NULL) - f = descr->ob_type->tp_descr_set; - if (!f) { - if (PyString_Check(name)) { - encoded_name = name; - Py_INCREF(name); - } else { - encoded_name = PyUnicode_AsUTF8String(name); - } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); - Py_DECREF(encoded_name); - } else { - res = f(descr, obj, value); - } - - done: - Py_DECREF(name); - return res; -} -#endif - - -#ifdef __cplusplus -} -#endif - - - -#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) - -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else - - - - #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) - - -/* -------- TYPES TABLE (BEGIN) -------- */ - -#define SWIGTYPE_p_HashCounter swig_types[0] -#define SWIGTYPE_p_HashSet swig_types[1] -#define SWIGTYPE_p_MerDNA swig_types[2] -#define SWIGTYPE_p_QueryMerFile swig_types[3] -#define SWIGTYPE_p_ReadMerFile swig_types[4] -#define SWIGTYPE_p_StringMers swig_types[5] -#define SWIGTYPE_p_char swig_types[6] -#define SWIGTYPE_p_std__pairT_bool_uint64_t_t swig_types[7] -static swig_type_info *swig_types[9]; -static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0}; -#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) -#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) - -/* -------- TYPES TABLE (END) -------- */ - -#if (PY_VERSION_HEX <= 0x02000000) -# if !defined(SWIG_PYTHON_CLASSIC) -# error "This python version requires swig to be run with the '-classic' option" -# endif -#endif - -/*----------------------------------------------- - @(target):= _jellyfish.so - ------------------------------------------------*/ -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_init PyInit__jellyfish - -#else -# define SWIG_init init_jellyfish - -#endif -#define SWIG_name "_jellyfish" - -#define SWIGVERSION 0x030002 -#define SWIG_VERSION SWIGVERSION - - -#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) -#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) - - -#include - - -namespace swig { - class SwigPtr_PyObject { - protected: - PyObject *_obj; - - public: - SwigPtr_PyObject() :_obj(0) - { - } - - SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) - { - Py_XINCREF(_obj); - } - - SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) - { - if (initial_ref) { - Py_XINCREF(_obj); - } - } - - SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) - { - Py_XINCREF(item._obj); - Py_XDECREF(_obj); - _obj = item._obj; - return *this; - } - - ~SwigPtr_PyObject() - { - Py_XDECREF(_obj); - } - - operator PyObject *() const - { - return _obj; - } - - PyObject *operator->() const - { - return _obj; - } - }; -} - - -namespace swig { - struct SwigVar_PyObject : SwigPtr_PyObject { - SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } - - SwigVar_PyObject & operator = (PyObject* obj) - { - Py_XDECREF(_obj); - _obj = obj; - return *this; - } - }; -} - - -#include - - -#include - - -#ifdef SWIGPYTHON -#define SWIG_FILE_WITH_INIT -#endif - -#ifdef SWIGPERL -#undef seed -#undef random -#endif - -#include -#include -#undef die -#include -#include -#include -#include -#include -#undef die - - - class MerDNA : public jellyfish::mer_dna { - public: - MerDNA() = default; - MerDNA(const char* s) : jellyfish::mer_dna(s) { } - MerDNA(const MerDNA& m) : jellyfish::mer_dna(m) { } - MerDNA& operator=(const jellyfish::mer_dna& m) { *static_cast(this) = m; return *this; } - }; - - -SWIGINTERN swig_type_info* -SWIG_pchar_descriptor(void) -{ - static int init = 0; - static swig_type_info* info = 0; - if (!init) { - info = SWIG_TypeQuery("_p_char"); - init = 1; - } - return info; -} - - -SWIGINTERN int -SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) -{ -#if PY_VERSION_HEX>=0x03000000 - if (PyUnicode_Check(obj)) -#else - if (PyString_Check(obj)) -#endif - { - char *cstr; Py_ssize_t len; -#if PY_VERSION_HEX>=0x03000000 - if (!alloc && cptr) { - /* We can't allow converting without allocation, since the internal - representation of string in Python 3 is UCS-2/UCS-4 but we require - a UTF-8 representation. - TODO(bhy) More detailed explanation */ - return SWIG_RuntimeError; - } - obj = PyUnicode_AsUTF8String(obj); - PyBytes_AsStringAndSize(obj, &cstr, &len); - if(alloc) *alloc = SWIG_NEWOBJ; -#else - PyString_AsStringAndSize(obj, &cstr, &len); -#endif - if (cptr) { - if (alloc) { - /* - In python the user should not be able to modify the inner - string representation. To warranty that, if you define - SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string - buffer is always returned. - - The default behavior is just to return the pointer value, - so, be careful. - */ -#if defined(SWIG_PYTHON_SAFE_CSTRINGS) - if (*alloc != SWIG_OLDOBJ) -#else - if (*alloc == SWIG_NEWOBJ) -#endif - { - *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); - *alloc = SWIG_NEWOBJ; - } - else { - *cptr = cstr; - *alloc = SWIG_OLDOBJ; - } - } else { - #if PY_VERSION_HEX>=0x03000000 - assert(0); /* Should never reach here in Python 3 */ - #endif - *cptr = SWIG_Python_str_AsChar(obj); - } - } - if (psize) *psize = len + 1; -#if PY_VERSION_HEX>=0x03000000 - Py_XDECREF(obj); -#endif - return SWIG_OK; - } else { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor) { - void* vptr = 0; - if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { - if (cptr) *cptr = (char *) vptr; - if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; - } - } - } - return SWIG_TypeError; -} - - - - - -SWIGINTERNINLINE PyObject* - SWIG_From_unsigned_SS_int (unsigned int value) -{ - return PyInt_FromSize_t((size_t) value); -} - - -#include -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -SWIGINTERN int -SWIG_AsVal_double (PyObject *obj, double *val) -{ - int res = SWIG_TypeError; - if (PyFloat_Check(obj)) { - if (val) *val = PyFloat_AsDouble(obj); - return SWIG_OK; - } else if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - double v = PyLong_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - double d = PyFloat_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = d; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); - } else { - PyErr_Clear(); - } - } - } -#endif - return res; -} - - -#include - - -#include - - -SWIGINTERNINLINE int -SWIG_CanCastAsInteger(double *d, double min, double max) { - double x = *d; - if ((min <= x && x <= max)) { - double fx = floor(x); - double cx = ceil(x); - double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ - if ((errno == EDOM) || (errno == ERANGE)) { - errno = 0; - } else { - double summ, reps, diff; - if (rd < x) { - diff = x - rd; - } else if (rd > x) { - diff = rd - x; - } else { - return 1; - } - summ = rd + x; - reps = diff/summ; - if (reps < 8*DBL_EPSILON) { - *d = rd; - return 1; - } - } - } - return 0; -} - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) -{ -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(obj)) { - long v = PyInt_AsLong(obj); - if (v >= 0) { - if (val) *val = v; - return SWIG_OK; - } else { - return SWIG_OverflowError; - } - } else -#endif - if (PyLong_Check(obj)) { - unsigned long v = PyLong_AsUnsignedLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); -#if PY_VERSION_HEX >= 0x03000000 - { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (v < 0) { - return SWIG_OverflowError; - } - } else { - PyErr_Clear(); - } - } -#endif - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - unsigned long v = PyLong_AsUnsignedLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { - if (val) *val = (unsigned long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v > UINT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = static_cast< unsigned int >(v); - } - } - return res; -} - - -SWIGINTERNINLINE PyObject* - SWIG_From_bool (bool value) -{ - return PyBool_FromLong(value ? 1 : 0); -} - - -SWIGINTERN int -SWIG_AsCharArray(PyObject * obj, char *val, size_t size) -{ - char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; - int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); - if (SWIG_IsOK(res)) { - /* special case of single char conversion when we don't need space for NUL */ - if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; - if (csize <= size) { - if (val) { - if (csize) memcpy(val, cptr, csize*sizeof(char)); - if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); - } - if (alloc == SWIG_NEWOBJ) { - delete[] cptr; - res = SWIG_DelNewMask(res); - } - return res; - } - if (alloc == SWIG_NEWOBJ) delete[] cptr; - } - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_long (PyObject *obj, long* val) -{ - if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - long v = PyInt_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { - if (val) *val = (long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_char (PyObject * obj, char *val) -{ - int res = SWIG_AsCharArray(obj, val, 1); - if (!SWIG_IsOK(res)) { - long v; - res = SWIG_AddCast(SWIG_AsVal_long (obj, &v)); - if (SWIG_IsOK(res)) { - if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) { - if (val) *val = static_cast< char >(v); - } else { - res = SWIG_OverflowError; - } - } - } - return res; -} - - -SWIGINTERNINLINE PyObject * -SWIG_FromCharPtrAndSize(const char* carray, size_t size) -{ - if (carray) { - if (size > INT_MAX) { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - return pchar_descriptor ? - SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); - } else { -#if PY_VERSION_HEX >= 0x03000000 -#if PY_VERSION_HEX >= 0x03010000 - return PyUnicode_DecodeUTF8(carray, static_cast< int >(size), "surrogateescape"); -#else - return PyUnicode_FromStringAndSize(carray, static_cast< int >(size)); -#endif -#else - return PyString_FromStringAndSize(carray, static_cast< int >(size)); -#endif - } - } else { - return SWIG_Py_Void(); - } -} - - -SWIGINTERNINLINE PyObject * -SWIG_From_char (char c) -{ - return SWIG_FromCharPtrAndSize(&c,1); -} - -SWIGINTERN MerDNA MerDNA_dup(MerDNA const *self){ return MerDNA(*self); } -SWIGINTERN std::string MerDNA___str__(MerDNA *self){ return self->to_str(); } - -SWIGINTERNINLINE PyObject * -SWIG_From_std_string (const std::string& s) -{ - return SWIG_FromCharPtrAndSize(s.data(), s.size()); -} - -SWIGINTERN void MerDNA_set(MerDNA *self,char const *s){ *static_cast(self) = s; } -SWIGINTERN char MerDNA___getitem__(MerDNA *self,unsigned int i){ return (char)self->base(i); } -SWIGINTERN void MerDNA___setitem__(MerDNA *self,unsigned int i,char b){ self->base(i) = b; } -SWIGINTERN MerDNA &MerDNA___lshift__(MerDNA *self,char b){ self->shift_left(b); return *self; } -SWIGINTERN MerDNA &MerDNA___rshift__(MerDNA *self,char b){ self->shift_right(b); return *self; } - - class QueryMerFile { - std::unique_ptr bf; - jellyfish::mapped_file binary_map; - std::unique_ptr jf; - - public: - QueryMerFile(const char* path) throw(std::runtime_error) { - std::ifstream in(path); - if(!in.good()) - throw std::runtime_error(std::string("Can't open file '") + path + "'"); - jellyfish::file_header header(in); - jellyfish::mer_dna::k(header.key_len() / 2); - if(header.format() == "bloomcounter") { - jellyfish::hash_pair fns(header.matrix(1), header.matrix(2)); - bf.reset(new jellyfish::mer_dna_bloom_filter(header.size(), header.nb_hashes(), in, fns)); - if(!in.good()) - throw std::runtime_error("Bloom filter file is truncated"); - } else if(header.format() == "binary/sorted") { - binary_map.map(path); - jf.reset(new binary_query(binary_map.base() + header.offset(), header.key_len(), header.counter_len(), header.matrix(), - header.size() - 1, binary_map.length() - header.offset())); - } else { - throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'"); - } - } - -#ifdef SWIGPERL - unsigned int get(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); } -#else - unsigned int __getitem__(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); } -#endif - }; - - - class ReadMerFile { - std::ifstream in; - std::unique_ptr binary; - std::unique_ptr text; - - std::pair next_mer__() { - std::pair res((const MerDNA*)0, 0); - if(next_mer()) { - res.first = mer(); - res.second = count(); - } - return res; - } - - public: - ReadMerFile(const char* path) throw(std::runtime_error) : - in(path) - { - if(!in.good()) - throw std::runtime_error(std::string("Can't open file '") + path + "'"); - jellyfish::file_header header(in); - jellyfish::mer_dna::k(header.key_len() / 2); - if(header.format() == binary_dumper::format) - binary.reset(new binary_reader(in, &header)); - else if(header.format() == text_dumper::format) - text.reset(new text_reader(in, &header)); - else - throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'"); - } - - bool next_mer() { - if(binary) { - if(binary->next()) return true; - binary.reset(); - } else if(text) { - if(text->next()) return true; - text.reset(); - } - return false; - } - - const MerDNA* mer() const { return static_cast(binary ? &binary->key() : &text->key()); } - unsigned long count() const { return binary ? binary->val() : text->val(); } - -#ifdef SWIGRUBY - void each() { - if(!rb_block_given_p()) return; - while(next_mer()) { - auto m = SWIG_NewPointerObj(const_cast(mer()), SWIGTYPE_p_MerDNA, 0); - auto c = SWIG_From_unsigned_SS_long(count()); - rb_yield(rb_ary_new3(2, m, c)); - } - } -#endif - -#ifdef SWIGPERL - std::pair each() { return next_mer__(); } -#endif - -#ifdef SWIGPYTHON - ReadMerFile* __iter__() { return this; } - std::pair __next__() { return next_mer__(); } - std::pair next() { return next_mer__(); } -#endif - }; - - - #define SWIG_From_long PyLong_FromLong - - -SWIGINTERNINLINE PyObject* -SWIG_From_unsigned_SS_long (unsigned long value) -{ - return (value > LONG_MAX) ? - PyLong_FromUnsignedLong(value) : PyLong_FromLong(static_cast< long >(value)); -} - - - class HashCounter : public jellyfish::cooperative::hash_counter { - typedef jellyfish::cooperative::hash_counter super; - public: - HashCounter(size_t size, unsigned int val_len, unsigned int nb_threads = 1) : \ - super(size, jellyfish::mer_dna::k() * 2, val_len, nb_threads) - { } - - bool add(const MerDNA& m, const int& x) { - bool res; - size_t id; - super::add(m, x, &res, &id); - return res; - } - - }; - - -SWIGINTERNINLINE int -SWIG_AsVal_size_t (PyObject * obj, size_t *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); - return res; -} - - -SWIGINTERNINLINE PyObject * -SWIG_From_size_t (size_t value) -{ - return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value)); -} - - -SWIGINTERN int -SWIG_AsVal_int (PyObject * obj, int *val) -{ - long v; - int res = SWIG_AsVal_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v < INT_MIN || v > INT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = static_cast< int >(v); - } - } - return res; -} - -SWIGINTERN void HashCounter_get(HashCounter const *self,MerDNA const &m,std::pair< bool,uint64_t > *COUNT){ - COUNT->first = self->ary()->get_val_for_key(m, &COUNT->second); - } -SWIGINTERN void HashCounter___getitem__(HashCounter const *self,MerDNA const &m,std::pair< bool,uint64_t > *COUNT){ - COUNT->first = self->ary()->get_val_for_key(m, &COUNT->second); - } - - class HashSet : public jellyfish::cooperative::hash_counter { - typedef jellyfish::cooperative::hash_counter super; - public: - HashSet(size_t size, unsigned int nb_threads = 1) : \ - super(size, jellyfish::mer_dna::k() * 2, 0, nb_threads) - { } - - bool add(const MerDNA& m) { - bool res; - size_t id; - super::set(m, &res, &id); - return res; - } - }; - -SWIGINTERN bool HashSet_get(HashSet const *self,MerDNA const &m){ return self->ary()->has_key(m); } -SWIGINTERN bool HashSet___getitem__(HashSet const *self,MerDNA const &m){ return self->ary()->has_key(m); } - - class StringMers { - const char* m_current; - const char* const m_last; - const bool m_canonical; - MerDNA m_m, m_rcm; - unsigned int m_filled; - - public: - StringMers(const char* str, int len, bool canonical) - : m_current(str) - , m_last(str + len) - , m_canonical(canonical) - , m_filled(0) - { } - - bool next_mer() { - if(m_current == m_last) - return false; - - do { - int code = jellyfish::mer_dna::code(*m_current); - ++m_current; - if(code >= 0) { - m_m.shift_left(code); - if(m_canonical) - m_rcm.shift_right(m_rcm.complement(code)); - m_filled = std::min(m_filled + 1, m_m.k()); - } else - m_filled = 0; - } while(m_filled < m_m.k() && m_current != m_last); - return m_filled == m_m.k(); - } - - const MerDNA* mer() const { return !m_canonical || m_m < m_rcm ? &m_m : &m_rcm; } - - const MerDNA* next_mer__() { - return next_mer() ? mer() : nullptr; - } - - -#ifdef SWIGRUBY - void each() { - if(!rb_block_given_p()) return; - while(next_mer()) { - auto m = SWIG_NewPointerObj(const_cast(mer()), SWIGTYPE_p_MerDNA, 0); - rb_yield(m); - } - } -#endif - -#ifdef SWIGPYTHON - StringMers* __iter__() { return this; } - const MerDNA* __next__() { return next_mer__(); } - const MerDNA* next() { return next_mer__(); } -#endif - -#ifdef SWIGPERL - const MerDNA* each() { return next_mer__(); } -#endif - - }; - - StringMers* string_mers(char* str, int length) { return new StringMers(str, length, false); } - StringMers* string_canonicals(char* str, int length) { return new StringMers(str, length, true); } - - -SWIGINTERN int -SWIG_AsVal_bool (PyObject *obj, bool *val) -{ - int r; - if (!PyBool_Check(obj)) - return SWIG_ERROR; - r = PyObject_IsTrue(obj); - if (r == -1) - return SWIG_ERROR; - if (val) *val = r ? true : false; - return SWIG_OK; -} - -#ifdef __cplusplus -extern "C" { -#endif -SWIGINTERN PyObject *_wrap_new_MerDNA__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)":new_MerDNA")) SWIG_fail; - result = (MerDNA *)new MerDNA(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_MerDNA__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject * obj0 = 0 ; - MerDNA *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:new_MerDNA",&obj0)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_MerDNA" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - result = (MerDNA *)new MerDNA((char const *)arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, SWIG_POINTER_NEW | 0 ); - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_MerDNA__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - MerDNA *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:new_MerDNA",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_MerDNA" "', argument " "1"" of type '" "MerDNA const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_MerDNA" "', argument " "1"" of type '" "MerDNA const &""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = (MerDNA *)new MerDNA((MerDNA const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_MerDNA(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[2]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = args ? (int)PyObject_Length(args) : 0; - for (ii = 0; (ii < 1) && (ii < argc); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 0) { - return _wrap_new_MerDNA__SWIG_0(self, args); - } - if (argc == 1) { - int _v; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_MerDNA, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_MerDNA__SWIG_2(self, args); - } - } - if (argc == 1) { - int _v; - int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_MerDNA__SWIG_1(self, args); - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_MerDNA'.\n" - " Possible C/C++ prototypes are:\n" - " MerDNA::MerDNA()\n" - " MerDNA::MerDNA(char const *)\n" - " MerDNA::MerDNA(MerDNA const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_k__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - unsigned int result; - - if (!PyArg_ParseTuple(args,(char *)":MerDNA_k")) SWIG_fail; - result = (unsigned int)MerDNA::k(); - resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_k__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - unsigned int arg1 ; - unsigned int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - unsigned int result; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_k",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MerDNA_k" "', argument " "1"" of type '" "unsigned int""'"); - } - arg1 = static_cast< unsigned int >(val1); - result = (unsigned int)MerDNA::k(arg1); - resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_k(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[2]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = args ? (int)PyObject_Length(args) : 0; - for (ii = 0; (ii < 1) && (ii < argc); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 0) { - return _wrap_MerDNA_k__SWIG_0(self, args); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_MerDNA_k__SWIG_1(self, args); - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'MerDNA_k'.\n" - " Possible C/C++ prototypes are:\n" - " MerDNA::k()\n" - " MerDNA::k(unsigned int)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_polyA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_polyA",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_polyA" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyA(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_polyC(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_polyC",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_polyC" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyC(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_polyG(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_polyG",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_polyG" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyG(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_polyT(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_polyT",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_polyT" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyT(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_randomize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_randomize",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_randomize" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->randomize(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_is_homopolymer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_is_homopolymer",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_is_homopolymer" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = (bool)((MerDNA const *)arg1)->is_homopolymer(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_shift_left(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char result; - - if (!PyArg_ParseTuple(args,(char *)"OO:MerDNA_shift_left",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_shift_left" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA_shift_left" "', argument " "2"" of type '" "char""'"); - } - arg2 = static_cast< char >(val2); - result = (char)(arg1)->shift_left(arg2); - resultobj = SWIG_From_char(static_cast< char >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_shift_right(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char result; - - if (!PyArg_ParseTuple(args,(char *)"OO:MerDNA_shift_right",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_shift_right" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA_shift_right" "', argument " "2"" of type '" "char""'"); - } - arg2 = static_cast< char >(val2); - result = (char)(arg1)->shift_right(arg2); - resultobj = SWIG_From_char(static_cast< char >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_canonicalize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_canonicalize",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_canonicalize" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->canonicalize(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_reverse_complement(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_reverse_complement",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_reverse_complement" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->reverse_complement(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_get_canonical(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - MerDNA result; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_get_canonical",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_get_canonical" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = ((MerDNA const *)arg1)->get_canonical(); - resultobj = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_get_reverse_complement(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - MerDNA result; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_get_reverse_complement",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_get_reverse_complement" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = ((MerDNA const *)arg1)->get_reverse_complement(); - resultobj = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"OO:MerDNA___eq__",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___eq__" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MerDNA___eq__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "MerDNA___eq__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)((MerDNA const *)arg1)->operator ==((MerDNA const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA___lt__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"OO:MerDNA___lt__",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___lt__" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MerDNA___lt__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "MerDNA___lt__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)((MerDNA const *)arg1)->operator <((MerDNA const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA___gt__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"OO:MerDNA___gt__",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___gt__" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MerDNA___gt__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "MerDNA___gt__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)((MerDNA const *)arg1)->operator >((MerDNA const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_dup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - MerDNA result; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA_dup",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_dup" "', argument " "1"" of type '" "MerDNA const *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = MerDNA_dup((MerDNA const *)arg1); - resultobj = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA___str__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - std::string result; - - if (!PyArg_ParseTuple(args,(char *)"O:MerDNA___str__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___str__" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = MerDNA___str__(arg1); - resultobj = SWIG_From_std_string(static_cast< std::string >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - char *arg2 = (char *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:MerDNA_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA_set" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MerDNA_set" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = reinterpret_cast< char * >(buf2); - try { - MerDNA_set(arg1,(char const *)arg2); - } - catch(std::length_error &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) delete[] buf2; - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) delete[] buf2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - unsigned int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char result; - - if (!PyArg_ParseTuple(args,(char *)"OO:MerDNA___getitem__",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___getitem__" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA___getitem__" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - result = (char)MerDNA___getitem__(arg1,arg2); - resultobj = SWIG_From_char(static_cast< char >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - unsigned int arg2 ; - char arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - char val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:MerDNA___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___setitem__" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA___setitem__" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - ecode3 = SWIG_AsVal_char(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "MerDNA___setitem__" "', argument " "3"" of type '" "char""'"); - } - arg3 = static_cast< char >(val3); - MerDNA___setitem__(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA___lshift__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - MerDNA *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:MerDNA___lshift__",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___lshift__" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA___lshift__" "', argument " "2"" of type '" "char""'"); - } - arg2 = static_cast< char >(val2); - result = (MerDNA *) &MerDNA___lshift__(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_MerDNA___rshift__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - MerDNA *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:MerDNA___rshift__",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MerDNA___rshift__" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MerDNA___rshift__" "', argument " "2"" of type '" "char""'"); - } - arg2 = static_cast< char >(val2); - result = (MerDNA *) &MerDNA___rshift__(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_MerDNA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:delete_MerDNA",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MerDNA, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_MerDNA" "', argument " "1"" of type '" "MerDNA *""'"); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *MerDNA_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_MerDNA, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *_wrap_new_QueryMerFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject * obj0 = 0 ; - QueryMerFile *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:new_QueryMerFile",&obj0)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_QueryMerFile" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - try { - result = (QueryMerFile *)new QueryMerFile((char const *)arg1); - } - catch(std::runtime_error &_e) { - SWIG_exception_fail(SWIG_RuntimeError, (&_e)->what()); - } - - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_QueryMerFile, SWIG_POINTER_NEW | 0 ); - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_QueryMerFile___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - QueryMerFile *arg1 = (QueryMerFile *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - unsigned int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:QueryMerFile___getitem__",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QueryMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QueryMerFile___getitem__" "', argument " "1"" of type '" "QueryMerFile *""'"); - } - arg1 = reinterpret_cast< QueryMerFile * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "QueryMerFile___getitem__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "QueryMerFile___getitem__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (unsigned int)(arg1)->__getitem__((MerDNA const &)*arg2); - resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_QueryMerFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - QueryMerFile *arg1 = (QueryMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:delete_QueryMerFile",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QueryMerFile, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_QueryMerFile" "', argument " "1"" of type '" "QueryMerFile *""'"); - } - arg1 = reinterpret_cast< QueryMerFile * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *QueryMerFile_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_QueryMerFile, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *_wrap_new_ReadMerFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject * obj0 = 0 ; - ReadMerFile *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:new_ReadMerFile",&obj0)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ReadMerFile" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - try { - result = (ReadMerFile *)new ReadMerFile((char const *)arg1); - } - catch(std::runtime_error &_e) { - SWIG_exception_fail(SWIG_RuntimeError, (&_e)->what()); - } - - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ReadMerFile, SWIG_POINTER_NEW | 0 ); - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ReadMerFile_next_mer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"O:ReadMerFile_next_mer",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile_next_mer" "', argument " "1"" of type '" "ReadMerFile *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (bool)(arg1)->next_mer(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ReadMerFile_mer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - MerDNA *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:ReadMerFile_mer",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile_mer" "', argument " "1"" of type '" "ReadMerFile const *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (MerDNA *)((ReadMerFile const *)arg1)->mer(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ReadMerFile_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - unsigned long result; - - if (!PyArg_ParseTuple(args,(char *)"O:ReadMerFile_count",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile_count" "', argument " "1"" of type '" "ReadMerFile const *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (unsigned long)((ReadMerFile const *)arg1)->count(); - resultobj = SWIG_From_unsigned_SS_long(static_cast< unsigned long >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ReadMerFile___iter__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - ReadMerFile *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:ReadMerFile___iter__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile___iter__" "', argument " "1"" of type '" "ReadMerFile *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (ReadMerFile *)(arg1)->__iter__(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ReadMerFile, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ReadMerFile___next__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - std::pair< MerDNA const *,uint64_t > result; - - if (!PyArg_ParseTuple(args,(char *)"O:ReadMerFile___next__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile___next__" "', argument " "1"" of type '" "ReadMerFile *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - { - result = (arg1)->__next__();; - if(!result.first) { - PyErr_SetString(PyExc_StopIteration, "Done"); - SWIG_fail; - } - } - { - PyObject * m = SWIG_NewPointerObj(const_cast((result).first), SWIGTYPE_p_MerDNA, 0); - PyObject * c = SWIG_From_unsigned_SS_long ((result).second); - resultobj = SWIG_Python_AppendOutput(resultobj, m); - resultobj = SWIG_Python_AppendOutput(resultobj, c); - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ReadMerFile_next(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - std::pair< MerDNA const *,uint64_t > result; - - if (!PyArg_ParseTuple(args,(char *)"O:ReadMerFile_next",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ReadMerFile_next" "', argument " "1"" of type '" "ReadMerFile *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - { - result = (arg1)->next();; - if(!result.first) { - PyErr_SetString(PyExc_StopIteration, "Done"); - SWIG_fail; - } - } - { - PyObject * m = SWIG_NewPointerObj(const_cast((result).first), SWIGTYPE_p_MerDNA, 0); - PyObject * c = SWIG_From_unsigned_SS_long ((result).second); - resultobj = SWIG_Python_AppendOutput(resultobj, m); - resultobj = SWIG_Python_AppendOutput(resultobj, c); - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_ReadMerFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:delete_ReadMerFile",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ReadMerFile, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ReadMerFile" "', argument " "1"" of type '" "ReadMerFile *""'"); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *ReadMerFile_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_ReadMerFile, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *_wrap_new_HashCounter__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - size_t arg1 ; - unsigned int arg2 ; - unsigned int arg3 ; - size_t val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - unsigned int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - HashCounter *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:new_HashCounter",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_HashCounter" "', argument " "1"" of type '" "size_t""'"); - } - arg1 = static_cast< size_t >(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_HashCounter" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_HashCounter" "', argument " "3"" of type '" "unsigned int""'"); - } - arg3 = static_cast< unsigned int >(val3); - result = (HashCounter *)new HashCounter(arg1,arg2,arg3); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HashCounter, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_HashCounter__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - size_t arg1 ; - unsigned int arg2 ; - size_t val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - HashCounter *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:new_HashCounter",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_HashCounter" "', argument " "1"" of type '" "size_t""'"); - } - arg1 = static_cast< size_t >(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_HashCounter" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - result = (HashCounter *)new HashCounter(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HashCounter, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_HashCounter(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[4]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = args ? (int)PyObject_Length(args) : 0; - for (ii = 0; (ii < 3) && (ii < argc); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 2) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_HashCounter__SWIG_1(self, args); - } - } - } - if (argc == 3) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_HashCounter__SWIG_0(self, args); - } - } - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_HashCounter'.\n" - " Possible C/C++ prototypes are:\n" - " HashCounter::HashCounter(size_t,unsigned int,unsigned int)\n" - " HashCounter::HashCounter(size_t,unsigned int)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_HashCounter_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashCounter *arg1 = (HashCounter *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - size_t result; - - if (!PyArg_ParseTuple(args,(char *)"O:HashCounter_size",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_size" "', argument " "1"" of type '" "HashCounter const *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - result = ((HashCounter const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_HashCounter_val_len(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashCounter *arg1 = (HashCounter *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - unsigned int result; - - if (!PyArg_ParseTuple(args,(char *)"O:HashCounter_val_len",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_val_len" "', argument " "1"" of type '" "HashCounter const *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - result = (unsigned int)((HashCounter const *)arg1)->val_len(); - resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_HashCounter_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - int *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - int temp3 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:HashCounter_add",&obj0,&obj1,&obj2)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_add" "', argument " "1"" of type '" "HashCounter *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashCounter_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashCounter_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "HashCounter_add" "', argument " "3"" of type '" "int""'"); - } - temp3 = static_cast< int >(val3); - arg3 = &temp3; - result = (bool)(arg1)->add((MerDNA const &)*arg2,(int const &)*arg3); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_HashCounter_update_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - int *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - int temp3 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:HashCounter_update_add",&obj0,&obj1,&obj2)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_update_add" "', argument " "1"" of type '" "HashCounter *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashCounter_update_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashCounter_update_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "HashCounter_update_add" "', argument " "3"" of type '" "int""'"); - } - temp3 = static_cast< int >(val3); - arg3 = &temp3; - result = (bool)(arg1)->update_add((MerDNA const &)*arg2,(int const &)*arg3); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_HashCounter_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - std::pair< bool,uint64_t > *arg3 = (std::pair< bool,uint64_t > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - std::pair< bool,uint64_t > tmp3 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - { - arg3 = &tmp3; - } - if (!PyArg_ParseTuple(args,(char *)"OO:HashCounter_get",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter_get" "', argument " "1"" of type '" "HashCounter const *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashCounter_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashCounter_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - HashCounter_get((HashCounter const *)arg1,(MerDNA const &)*arg2,arg3); - resultobj = SWIG_Py_Void(); - { - if((arg3)->first) { - PyObject * o = SWIG_From_unsigned_SS_long ((arg3)->second); - resultobj = SWIG_Python_AppendOutput(resultobj, o); - } else { - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_Py_Void()); - } - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_HashCounter___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - std::pair< bool,uint64_t > *arg3 = (std::pair< bool,uint64_t > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - std::pair< bool,uint64_t > tmp3 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - { - arg3 = &tmp3; - } - if (!PyArg_ParseTuple(args,(char *)"OO:HashCounter___getitem__",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashCounter___getitem__" "', argument " "1"" of type '" "HashCounter const *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashCounter___getitem__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashCounter___getitem__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - HashCounter___getitem__((HashCounter const *)arg1,(MerDNA const &)*arg2,arg3); - resultobj = SWIG_Py_Void(); - { - if((arg3)->first) { - PyObject * o = SWIG_From_unsigned_SS_long ((arg3)->second); - resultobj = SWIG_Python_AppendOutput(resultobj, o); - } else { - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_Py_Void()); - } - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_HashCounter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashCounter *arg1 = (HashCounter *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:delete_HashCounter",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashCounter, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_HashCounter" "', argument " "1"" of type '" "HashCounter *""'"); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *HashCounter_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_HashCounter, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *_wrap_new_HashSet__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - size_t arg1 ; - unsigned int arg2 ; - size_t val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - HashSet *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:new_HashSet",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_HashSet" "', argument " "1"" of type '" "size_t""'"); - } - arg1 = static_cast< size_t >(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_HashSet" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = static_cast< unsigned int >(val2); - result = (HashSet *)new HashSet(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HashSet, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_HashSet__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - size_t arg1 ; - size_t val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - HashSet *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:new_HashSet",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_HashSet" "', argument " "1"" of type '" "size_t""'"); - } - arg1 = static_cast< size_t >(val1); - result = (HashSet *)new HashSet(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HashSet, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_HashSet(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[3]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = args ? (int)PyObject_Length(args) : 0; - for (ii = 0; (ii < 2) && (ii < argc); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_HashSet__SWIG_1(self, args); - } - } - if (argc == 2) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_HashSet__SWIG_0(self, args); - } - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_HashSet'.\n" - " Possible C/C++ prototypes are:\n" - " HashSet::HashSet(size_t,unsigned int)\n" - " HashSet::HashSet(size_t)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_HashSet_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashSet *arg1 = (HashSet *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - size_t result; - - if (!PyArg_ParseTuple(args,(char *)"O:HashSet_size",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashSet_size" "', argument " "1"" of type '" "HashSet const *""'"); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - result = ((HashSet const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_HashSet_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashSet *arg1 = (HashSet *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"OO:HashSet_add",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashSet_add" "', argument " "1"" of type '" "HashSet *""'"); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashSet_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashSet_add" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)(arg1)->add((MerDNA const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_HashSet_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashSet *arg1 = (HashSet *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"OO:HashSet_get",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashSet_get" "', argument " "1"" of type '" "HashSet const *""'"); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashSet_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashSet_get" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)HashSet_get((HashSet const *)arg1,(MerDNA const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_HashSet___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashSet *arg1 = (HashSet *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"OO:HashSet___getitem__",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HashSet___getitem__" "', argument " "1"" of type '" "HashSet const *""'"); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_MerDNA, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "HashSet___getitem__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "HashSet___getitem__" "', argument " "2"" of type '" "MerDNA const &""'"); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)HashSet___getitem__((HashSet const *)arg1,(MerDNA const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_HashSet(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - HashSet *arg1 = (HashSet *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:delete_HashSet",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HashSet, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_HashSet" "', argument " "1"" of type '" "HashSet *""'"); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *HashSet_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_HashSet, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *_wrap_string_mers(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - size_t size1 = 0 ; - int alloc1 = 0 ; - PyObject * obj0 = 0 ; - StringMers *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:string_mers",&obj0)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "string_mers" "', argument " "1"" of type '" "char *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - arg2 = static_cast< int >(size1 - 1); - result = (StringMers *)string_mers(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_POINTER_OWN | 0 ); - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_string_canonicals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - size_t size1 = 0 ; - int alloc1 = 0 ; - PyObject * obj0 = 0 ; - StringMers *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:string_canonicals",&obj0)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "string_canonicals" "', argument " "1"" of type '" "char *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - arg2 = static_cast< int >(size1 - 1); - result = (StringMers *)string_canonicals(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_POINTER_OWN | 0 ); - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_StringMers(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int arg2 ; - bool arg3 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; - bool val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - StringMers *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:new_StringMers",&obj0,&obj1,&obj2)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringMers" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_StringMers" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - ecode3 = SWIG_AsVal_bool(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_StringMers" "', argument " "3"" of type '" "bool""'"); - } - arg3 = static_cast< bool >(val3); - result = (StringMers *)new StringMers((char const *)arg1,arg2,arg3); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_POINTER_NEW | 0 ); - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringMers_next_mer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - bool result; - - if (!PyArg_ParseTuple(args,(char *)"O:StringMers_next_mer",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMers_next_mer" "', argument " "1"" of type '" "StringMers *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - result = (bool)(arg1)->next_mer(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringMers_mer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - MerDNA *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:StringMers_mer",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMers_mer" "', argument " "1"" of type '" "StringMers const *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - result = (MerDNA *)((StringMers const *)arg1)->mer(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringMers___iter__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - StringMers *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:StringMers___iter__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMers___iter__" "', argument " "1"" of type '" "StringMers *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - result = (StringMers *)(arg1)->__iter__(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringMers___next__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - MerDNA *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:StringMers___next__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMers___next__" "', argument " "1"" of type '" "StringMers *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - { - result = (MerDNA *)(arg1)->__next__();; - if(!result) { - PyErr_SetString(PyExc_StopIteration, "Done"); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringMers_next(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - MerDNA *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:StringMers_next",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMers_next" "', argument " "1"" of type '" "StringMers *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - { - result = (MerDNA *)(arg1)->next();; - if(!result) { - PyErr_SetString(PyExc_StopIteration, "Done"); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_StringMers(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:delete_StringMers",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_StringMers, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringMers" "', argument " "1"" of type '" "StringMers *""'"); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *StringMers_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_StringMers, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -static PyMethodDef SwigMethods[] = { - { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, - { (char *)"new_MerDNA", _wrap_new_MerDNA, METH_VARARGS, (char *)"\n" - "Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int)\n" - "Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int)\n" - "Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int)\n" - ""}, - { (char *)"MerDNA_k", _wrap_MerDNA_k, METH_VARARGS, (char *)"\n" - "Get the length of the k-mers\n" - "Set the length of the k-mers\n" - ""}, - { (char *)"MerDNA_polyA", _wrap_MerDNA_polyA, METH_VARARGS, (char *)"Change the mer to a homopolymer of A"}, - { (char *)"MerDNA_polyC", _wrap_MerDNA_polyC, METH_VARARGS, (char *)"Change the mer to a homopolymer of C"}, - { (char *)"MerDNA_polyG", _wrap_MerDNA_polyG, METH_VARARGS, (char *)"Change the mer to a homopolymer of G"}, - { (char *)"MerDNA_polyT", _wrap_MerDNA_polyT, METH_VARARGS, (char *)"Change the mer to a homopolymer of T"}, - { (char *)"MerDNA_randomize", _wrap_MerDNA_randomize, METH_VARARGS, (char *)"Change the mer to a random one"}, - { (char *)"MerDNA_is_homopolymer", _wrap_MerDNA_is_homopolymer, METH_VARARGS, (char *)"Check if the mer is a homopolymer"}, - { (char *)"MerDNA_shift_left", _wrap_MerDNA_shift_left, METH_VARARGS, (char *)"Shift a base to the left and the leftmost base is return . \"ACGT\", shift_left('A') becomes \"CGTA\" and 'A' is returned"}, - { (char *)"MerDNA_shift_right", _wrap_MerDNA_shift_right, METH_VARARGS, (char *)"Shift a base to the right and the rightmost base is return . \"ACGT\", shift_right('A') becomes \"AACG\" and 'T' is returned"}, - { (char *)"MerDNA_canonicalize", _wrap_MerDNA_canonicalize, METH_VARARGS, (char *)"Change the mer to its canonical representation"}, - { (char *)"MerDNA_reverse_complement", _wrap_MerDNA_reverse_complement, METH_VARARGS, (char *)"Change the mer to its reverse complement"}, - { (char *)"MerDNA_get_canonical", _wrap_MerDNA_get_canonical, METH_VARARGS, (char *)"Return canonical representation of the mer"}, - { (char *)"MerDNA_get_reverse_complement", _wrap_MerDNA_get_reverse_complement, METH_VARARGS, (char *)"Return the reverse complement of the mer"}, - { (char *)"MerDNA___eq__", _wrap_MerDNA___eq__, METH_VARARGS, (char *)"Equality between mers"}, - { (char *)"MerDNA___lt__", _wrap_MerDNA___lt__, METH_VARARGS, (char *)"Lexicographic less-than"}, - { (char *)"MerDNA___gt__", _wrap_MerDNA___gt__, METH_VARARGS, (char *)"Lexicographic greater-than"}, - { (char *)"MerDNA_dup", _wrap_MerDNA_dup, METH_VARARGS, (char *)"Duplicate the mer"}, - { (char *)"MerDNA___str__", _wrap_MerDNA___str__, METH_VARARGS, (char *)"Return string representation of the mer"}, - { (char *)"MerDNA_set", _wrap_MerDNA_set, METH_VARARGS, (char *)"Set the mer from a string"}, - { (char *)"MerDNA___getitem__", _wrap_MerDNA___getitem__, METH_VARARGS, (char *)"Get base i (0 <= i < k)"}, - { (char *)"MerDNA___setitem__", _wrap_MerDNA___setitem__, METH_VARARGS, (char *)"Set base i (0 <= i < k)"}, - { (char *)"MerDNA___lshift__", _wrap_MerDNA___lshift__, METH_VARARGS, (char *)"Shift a base to the left and return the mer"}, - { (char *)"MerDNA___rshift__", _wrap_MerDNA___rshift__, METH_VARARGS, (char *)"Shift a base to the right and return the mer"}, - { (char *)"delete_MerDNA", _wrap_delete_MerDNA, METH_VARARGS, (char *)"Shift a base to the right and return the mer"}, - { (char *)"MerDNA_swigregister", MerDNA_swigregister, METH_VARARGS, NULL}, - { (char *)"new_QueryMerFile", _wrap_new_QueryMerFile, METH_VARARGS, (char *)"Open the jellyfish database"}, - { (char *)"QueryMerFile___getitem__", _wrap_QueryMerFile___getitem__, METH_VARARGS, (char *)"Get the count for the mer m"}, - { (char *)"delete_QueryMerFile", _wrap_delete_QueryMerFile, METH_VARARGS, (char *)"Get the count for the mer m"}, - { (char *)"QueryMerFile_swigregister", QueryMerFile_swigregister, METH_VARARGS, NULL}, - { (char *)"new_ReadMerFile", _wrap_new_ReadMerFile, METH_VARARGS, (char *)"Open the jellyfish database"}, - { (char *)"ReadMerFile_next_mer", _wrap_ReadMerFile_next_mer, METH_VARARGS, (char *)"Move to the next mer in the file. Returns false if no mers left, true otherwise"}, - { (char *)"ReadMerFile_mer", _wrap_ReadMerFile_mer, METH_VARARGS, (char *)"Returns current mer"}, - { (char *)"ReadMerFile_count", _wrap_ReadMerFile_count, METH_VARARGS, (char *)"Returns the count of the current mer"}, - { (char *)"ReadMerFile___iter__", _wrap_ReadMerFile___iter__, METH_VARARGS, (char *)"Iterate through all the mers in the file, passing two values: a mer and its count"}, - { (char *)"ReadMerFile___next__", _wrap_ReadMerFile___next__, METH_VARARGS, (char *)"Iterate through all the mers in the file, passing two values: a mer and its count"}, - { (char *)"ReadMerFile_next", _wrap_ReadMerFile_next, METH_VARARGS, (char *)"Iterate through all the mers in the file, passing two values: a mer and its count"}, - { (char *)"delete_ReadMerFile", _wrap_delete_ReadMerFile, METH_VARARGS, (char *)"Iterate through all the mers in the file, passing two values: a mer and its count"}, - { (char *)"ReadMerFile_swigregister", ReadMerFile_swigregister, METH_VARARGS, NULL}, - { (char *)"new_HashCounter", _wrap_new_HashCounter, METH_VARARGS, (char *)"\n" - "Read a Jellyfish database sequentially\n" - "Read a Jellyfish database sequentially\n" - ""}, - { (char *)"HashCounter_size", _wrap_HashCounter_size, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"HashCounter_val_len", _wrap_HashCounter_val_len, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"HashCounter_add", _wrap_HashCounter_add, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"HashCounter_update_add", _wrap_HashCounter_update_add, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"HashCounter_get", _wrap_HashCounter_get, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"HashCounter___getitem__", _wrap_HashCounter___getitem__, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"delete_HashCounter", _wrap_delete_HashCounter, METH_VARARGS, (char *)"Extract k-mers from a sequence string"}, - { (char *)"HashCounter_swigregister", HashCounter_swigregister, METH_VARARGS, NULL}, - { (char *)"new_HashSet", _wrap_new_HashSet, METH_VARARGS, (char *)"\n" - "Read a Jellyfish database sequentially\n" - "Read a Jellyfish database sequentially\n" - ""}, - { (char *)"HashSet_size", _wrap_HashSet_size, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"HashSet_add", _wrap_HashSet_add, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"HashSet_get", _wrap_HashSet_get, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"HashSet___getitem__", _wrap_HashSet___getitem__, METH_VARARGS, (char *)"Read a Jellyfish database sequentially"}, - { (char *)"delete_HashSet", _wrap_delete_HashSet, METH_VARARGS, (char *)"Extract k-mers from a sequence string"}, - { (char *)"HashSet_swigregister", HashSet_swigregister, METH_VARARGS, NULL}, - { (char *)"string_mers", _wrap_string_mers, METH_VARARGS, (char *)"Get an iterator to the mers in the string"}, - { (char *)"string_canonicals", _wrap_string_canonicals, METH_VARARGS, (char *)"Get an iterator to the canonical mers in the string"}, - { (char *)"new_StringMers", _wrap_new_StringMers, METH_VARARGS, (char *)"Create a k-mers parser from a string. Pass true as a second argument to get canonical mers"}, - { (char *)"StringMers_next_mer", _wrap_StringMers_next_mer, METH_VARARGS, (char *)"Get the next mer. Return false if reached the end of the string."}, - { (char *)"StringMers_mer", _wrap_StringMers_mer, METH_VARARGS, (char *)"Return the current mer (or its canonical representation)"}, - { (char *)"StringMers___iter__", _wrap_StringMers___iter__, METH_VARARGS, (char *)"Return the current mer (or its canonical representation)"}, - { (char *)"StringMers___next__", _wrap_StringMers___next__, METH_VARARGS, (char *)"Return the current mer (or its canonical representation)"}, - { (char *)"StringMers_next", _wrap_StringMers_next, METH_VARARGS, (char *)"Return the current mer (or its canonical representation)"}, - { (char *)"delete_StringMers", _wrap_delete_StringMers, METH_VARARGS, (char *)"Return the current mer (or its canonical representation)"}, - { (char *)"StringMers_swigregister", StringMers_swigregister, METH_VARARGS, NULL}, - { NULL, NULL, 0, NULL } -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ - -static swig_type_info _swigt__p_HashCounter = {"_p_HashCounter", "HashCounter *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_HashSet = {"_p_HashSet", "HashSet *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_MerDNA = {"_p_MerDNA", "MerDNA *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_QueryMerFile = {"_p_QueryMerFile", "QueryMerFile *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_ReadMerFile = {"_p_ReadMerFile", "ReadMerFile *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_StringMers = {"_p_StringMers", "StringMers *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__pairT_bool_uint64_t_t = {"_p_std__pairT_bool_uint64_t_t", "std::pair< bool,uint64_t > *", 0, 0, (void*)0, 0}; - -static swig_type_info *swig_type_initial[] = { - &_swigt__p_HashCounter, - &_swigt__p_HashSet, - &_swigt__p_MerDNA, - &_swigt__p_QueryMerFile, - &_swigt__p_ReadMerFile, - &_swigt__p_StringMers, - &_swigt__p_char, - &_swigt__p_std__pairT_bool_uint64_t_t, -}; - -static swig_cast_info _swigc__p_HashCounter[] = { {&_swigt__p_HashCounter, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_HashSet[] = { {&_swigt__p_HashSet, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_MerDNA[] = { {&_swigt__p_MerDNA, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_QueryMerFile[] = { {&_swigt__p_QueryMerFile, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_ReadMerFile[] = { {&_swigt__p_ReadMerFile, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_StringMers[] = { {&_swigt__p_StringMers, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__pairT_bool_uint64_t_t[] = { {&_swigt__p_std__pairT_bool_uint64_t_t, 0, 0, 0},{0, 0, 0, 0}}; - -static swig_cast_info *swig_cast_initial[] = { - _swigc__p_HashCounter, - _swigc__p_HashSet, - _swigc__p_MerDNA, - _swigc__p_QueryMerFile, - _swigc__p_ReadMerFile, - _swigc__p_StringMers, - _swigc__p_char, - _swigc__p_std__pairT_bool_uint64_t_t, -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ - -static swig_const_info swig_const_table[] = { -{0, 0, 0, 0.0, 0, 0}}; - -#ifdef __cplusplus -} -#endif -/* ----------------------------------------------------------------------------- - * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to - * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of - * swig_module, and does all the lookup, filling in the swig_module.types - * array with the correct data and linking the correct swig_cast_info - * structures together. - * - * The generated swig_type_info structures are assigned statically to an initial - * array. We just loop through that array, and handle each type individually. - * First we lookup if this type has been already loaded, and if so, use the - * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a - * two-dimensional array. Each row corresponds to a type (there are the same - * number of rows as there are in the swig_type_initial array). Each entry in - * a column is one of the swig_cast_info structures for that type. - * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. - * - * First off, we lookup the cast->type name to see if it is already loaded. - * There are three cases to handle: - * 1) If the cast->type has already been loaded AND the type we are adding - * casting info to has not been loaded (it is in this module), THEN we - * replace the cast->type pointer with the type pointer that has already - * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the - * cast->type) are loaded, THEN the cast info has already been loaded by - * the previous module so we just ignore it. - * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will - * be correct. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* c-mode */ -#endif -#endif - -#if 0 -#define SWIGRUNTIME_DEBUG -#endif - - -SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { - size_t i; - swig_module_info *module_head, *iter; - int found, init; - - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - init = 1; - } else { - init = 0; - } - - /* Try and load any already created modules */ - module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; - iter=module_head; - do { - if (iter==&swig_module) { - found=1; - break; - } - iter=iter->next; - } while (iter!= module_head); - - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ - swig_module.next = module_head->next; - module_head->next = &swig_module; - } - - /* When multiple interpreters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - - /* Now work on filling in swig_module.types */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %d\n", swig_module.size); -#endif - for (i = 0; i < swig_module.size; ++i) { - swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; - -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); -#endif - - /* if there is another module already loaded */ - if (swig_module.next != &swig_module) { - type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); - } - if (type) { - /* Overwrite clientdata field */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found type %s\n", type->name); -#endif - if (swig_module.type_initial[i]->clientdata) { - type->clientdata = swig_module.type_initial[i]->clientdata; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); -#endif - } - } else { - type = swig_module.type_initial[i]; - } - - /* Insert casting types */ - cast = swig_module.cast_initial[i]; - while (cast->type) { - /* Don't need to add information already in the list */ - ret = 0; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); -#endif - if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); -#ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); -#endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); -#endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); -#ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); -#endif - if (!ocast) ret = 0; - } - } - - if (!ret) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); -#endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; - } - type->cast = cast; - } - cast++; - } - /* Set entry in modules->types array equal to the type */ - swig_module.types[i] = type; - } - swig_module.types[i] = 0; - -#ifdef SWIGRUNTIME_DEBUG - printf("**** SWIG_InitializeModule: Cast List ******\n"); - for (i = 0; i < swig_module.size; ++i) { - int j = 0; - swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); - while (cast->type) { - printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); - cast++; - ++j; - } - printf("---- Total casts: %d\n",j); - } - printf("**** SWIG_InitializeModule: Cast List ******\n"); -#endif -} - -/* This function will propagate the clientdata field of type to -* any new swig_type_info structures that have been added into the list -* of equivalent types. It is like calling -* SWIG_TypeClientData(type, clientdata) a second time. -*/ -SWIGRUNTIME void -SWIG_PropagateClientData(void) { - size_t i; - swig_cast_info *equiv; - static int init_run = 0; - - if (init_run) return; - init_run = 1; - - for (i = 0; i < swig_module.size; i++) { - if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); - } - equiv = equiv->next; - } - } - } -} - -#ifdef __cplusplus -#if 0 -{ - /* c-mode */ -#endif -} -#endif - - - -#ifdef __cplusplus -extern "C" { -#endif - - /* Python-specific SWIG API */ -#define SWIG_newvarlink() SWIG_Python_newvarlink() -#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) -#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) - - /* ----------------------------------------------------------------------------- - * global variable support code. - * ----------------------------------------------------------------------------- */ - - typedef struct swig_globalvar { - char *name; /* Name of global variable */ - PyObject *(*get_attr)(void); /* Return the current value */ - int (*set_attr)(PyObject *); /* Set the value */ - struct swig_globalvar *next; - } swig_globalvar; - - typedef struct swig_varlinkobject { - PyObject_HEAD - swig_globalvar *vars; - } swig_varlinkobject; - - SWIGINTERN PyObject * - swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_InternFromString(""); -#else - return PyString_FromString(""); -#endif - } - - SWIGINTERN PyObject * - swig_varlink_str(swig_varlinkobject *v) { -#if PY_VERSION_HEX >= 0x03000000 - PyObject *str = PyUnicode_InternFromString("("); - PyObject *tail; - PyObject *joined; - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - tail = PyUnicode_FromString(var->name); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - if (var->next) { - tail = PyUnicode_InternFromString(", "); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - } - } - tail = PyUnicode_InternFromString(")"); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; -#else - PyObject *str = PyString_FromString("("); - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - PyString_ConcatAndDel(&str,PyString_FromString(var->name)); - if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); - } - PyString_ConcatAndDel(&str,PyString_FromString(")")); -#endif - return str; - } - - SWIGINTERN int - swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { - char *tmp; - PyObject *str = swig_varlink_str(v); - fprintf(fp,"Swig global variables "); - fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(str); - return 0; - } - - SWIGINTERN void - swig_varlink_dealloc(swig_varlinkobject *v) { - swig_globalvar *var = v->vars; - while (var) { - swig_globalvar *n = var->next; - free(var->name); - free(var); - var = n; - } - } - - SWIGINTERN PyObject * - swig_varlink_getattr(swig_varlinkobject *v, char *n) { - PyObject *res = NULL; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->get_attr)(); - break; - } - var = var->next; - } - if (res == NULL && !PyErr_Occurred()) { - PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); - } - return res; - } - - SWIGINTERN int - swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { - int res = 1; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->set_attr)(p); - break; - } - var = var->next; - } - if (res == 1 && !PyErr_Occurred()) { - PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); - } - return res; - } - - SWIGINTERN PyTypeObject* - swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; - static PyTypeObject varlink_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - (char *)"swigvarlink", /* tp_name */ - sizeof(swig_varlinkobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ - (printfunc) swig_varlink_print, /* tp_print */ - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#if PY_VERSION_HEX >= 0x02020000 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - varlink_type = tmp; - type_init = 1; -#if PY_VERSION_HEX < 0x02020000 - varlink_type.ob_type = &PyType_Type; -#else - if (PyType_Ready(&varlink_type) < 0) - return NULL; -#endif - } - return &varlink_type; - } - - /* Create a variable linking object for use later */ - SWIGINTERN PyObject * - SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); - if (result) { - result->vars = 0; - } - return ((PyObject*) result); - } - - SWIGINTERN void - SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { - swig_varlinkobject *v = (swig_varlinkobject *) p; - swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); - if (gv) { - size_t size = strlen(name)+1; - gv->name = (char *)malloc(size); - if (gv->name) { - strncpy(gv->name,name,size); - gv->get_attr = get_attr; - gv->set_attr = set_attr; - gv->next = v->vars; - } - } - v->vars = gv; - } - - SWIGINTERN PyObject * - SWIG_globals(void) { - static PyObject *_SWIG_globals = 0; - if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); - return _SWIG_globals; - } - - /* ----------------------------------------------------------------------------- - * constants/methods manipulation - * ----------------------------------------------------------------------------- */ - - /* Install Constants */ - SWIGINTERN void - SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { - PyObject *obj = 0; - size_t i; - for (i = 0; constants[i].type; ++i) { - switch(constants[i].type) { - case SWIG_PY_POINTER: - obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); - break; - case SWIG_PY_BINARY: - obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); - break; - default: - obj = 0; - break; - } - if (obj) { - PyDict_SetItemString(d, constants[i].name, obj); - Py_DECREF(obj); - } - } - } - - /* -----------------------------------------------------------------------------*/ - /* Fix SwigMethods to carry the callback ptrs when needed */ - /* -----------------------------------------------------------------------------*/ - - SWIGINTERN void - SWIG_Python_FixMethods(PyMethodDef *methods, - swig_const_info *const_table, - swig_type_info **types, - swig_type_info **types_initial) { - size_t i; - for (i = 0; methods[i].ml_name; ++i) { - const char *c = methods[i].ml_doc; - if (c && (c = strstr(c, "swig_ptr: "))) { - int j; - swig_const_info *ci = 0; - const char *name = c + 10; - for (j = 0; const_table[j].type; ++j) { - if (strncmp(const_table[j].name, name, - strlen(const_table[j].name)) == 0) { - ci = &(const_table[j]); - break; - } - } - if (ci) { - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - strncpy(buff, methods[i].ml_doc, ldoc); - buff += ldoc; - strncpy(buff, "swig_ptr: ", 10); - buff += 10; - SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); - methods[i].ml_doc = ndoc; - } - } - } - } - } - } - -#ifdef __cplusplus -} -#endif - -/* -----------------------------------------------------------------------------* - * Partial Init method - * -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" -#endif - -SWIGEXPORT -#if PY_VERSION_HEX >= 0x03000000 -PyObject* -#else -void -#endif -SWIG_init(void) { - PyObject *m, *d, *md; -#if PY_VERSION_HEX >= 0x03000000 - static struct PyModuleDef SWIG_module = { -# if PY_VERSION_HEX >= 0x03020000 - PyModuleDef_HEAD_INIT, -# else - { - PyObject_HEAD_INIT(NULL) - NULL, /* m_init */ - 0, /* m_index */ - NULL, /* m_copy */ - }, -# endif - (char *) SWIG_name, - NULL, - -1, - SwigMethods, - NULL, - NULL, - NULL, - NULL - }; -#endif - -#if defined(SWIGPYTHON_BUILTIN) - static SwigPyClientData SwigPyObject_clientdata = { - 0, 0, 0, 0, 0, 0, 0 - }; - static PyGetSetDef this_getset_def = { - (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL - }; - static SwigPyGetSet thisown_getset_closure = { - (PyCFunction) SwigPyObject_own, - (PyCFunction) SwigPyObject_own - }; - static PyGetSetDef thisown_getset_def = { - (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure - }; - PyObject *metatype_args; - PyTypeObject *builtin_pytype; - int builtin_base_count; - swig_type_info *builtin_basetype; - PyObject *tuple; - PyGetSetDescrObject *static_getset; - PyTypeObject *metatype; - SwigPyClientData *cd; - PyObject *public_interface, *public_symbol; - PyObject *this_descr; - PyObject *thisown_descr; - int i; - - (void)builtin_pytype; - (void)builtin_base_count; - (void)builtin_basetype; - (void)tuple; - (void)static_getset; - - /* metatype is used to implement static member variables. */ - metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type); - assert(metatype_args); - metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL); - assert(metatype); - Py_DECREF(metatype_args); - metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro; - assert(PyType_Ready(metatype) >= 0); -#endif - - /* Fix SwigMethods to carry the callback ptrs when needed */ - SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); - -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule((char *) SWIG_name, SwigMethods); -#endif - md = d = PyModule_GetDict(m); - (void)md; - - SWIG_InitializeModule(0); - -#ifdef SWIGPYTHON_BUILTIN - SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); - assert(SwigPyObject_stype); - cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; - if (!cd) { - SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; - SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce(); - } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) { - PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif - } - - /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); - (void)this_descr; - - /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); - (void)thisown_descr; - - public_interface = PyList_New(0); - public_symbol = 0; - (void)public_symbol; - - PyDict_SetItemString(md, "__all__", public_interface); - Py_DECREF(public_interface); - for (i = 0; SwigMethods[i].ml_name != NULL; ++i) - SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); - for (i = 0; swig_const_table[i].name != 0; ++i) - SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); -#endif - - SWIG_InstallConstants(d,swig_const_table); - -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif -} - diff --git a/src/modifiedJellyfish/swig/ruby/swig_wrap.cpp b/src/modifiedJellyfish/swig/ruby/swig_wrap.cpp deleted file mode 100644 index f6eabfa3..00000000 --- a/src/modifiedJellyfish/swig/ruby/swig_wrap.cpp +++ /dev/null @@ -1,5193 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.2 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - -#define SWIGRUBY - - -#ifdef __cplusplus -/* SwigValueWrapper is described in swig.swg */ -template class SwigValueWrapper { - struct SwigMovePointer { - T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } - } pointer; - SwigValueWrapper& operator=(const SwigValueWrapper& rhs); - SwigValueWrapper(const SwigValueWrapper& rhs); -public: - SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } - operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -}; - -template T SwigValueInit() { - return T(); -} -#endif - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - - -/* ----------------------------------------------------------------------------- - * swigrun.swg - * - * This file contains generic C API SWIG runtime support for pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -/* This should only be incremented when either the layout of swig_type_info changes, - or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" - -/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -# define SWIG_QUOTE_STRING(x) #x -# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -# define SWIG_TYPE_TABLE_NAME -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the SWIG runtime code. - In 99.9% of the cases, SWIG just needs to declare them as 'static'. - - But only do this if strictly necessary, ie, if you have problems - with your compiler or suchlike. -*/ - -#ifndef SWIGRUNTIME -# define SWIGRUNTIME SWIGINTERN -#endif - -#ifndef SWIGRUNTIMEINLINE -# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - -/* Generic buffer size */ -#ifndef SWIG_BUFFER_SIZE -# define SWIG_BUFFER_SIZE 1024 -#endif - -/* Flags for pointer conversions */ -#define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 - -/* Flags for new pointer objects */ -#define SWIG_POINTER_OWN 0x1 - - -/* - Flags/methods for returning states. - - The SWIG conversion methods, as ConvertPtr, return an integer - that tells if the conversion was successful or not. And if not, - an error code can be returned (see swigerrors.swg for the codes). - - Use the following macros/flags to set or process the returning - states. - - In old versions of SWIG, code such as the following was usually written: - - if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { - // success code - } else { - //fail code - } - - Now you can be more explicit: - - int res = SWIG_ConvertPtr(obj,vptr,ty.flags); - if (SWIG_IsOK(res)) { - // success code - } else { - // fail code - } - - which is the same really, but now you can also do - - Type *ptr; - int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); - if (SWIG_IsOK(res)) { - // success code - if (SWIG_IsNewObj(res) { - ... - delete *ptr; - } else { - ... - } - } else { - // fail code - } - - I.e., now SWIG_ConvertPtr can return new objects and you can - identify the case and take care of the deallocation. Of course that - also requires SWIG_ConvertPtr to return new result values, such as - - int SWIG_ConvertPtr(obj, ptr,...) { - if () { - if () { - *ptr = ; - return SWIG_NEWOBJ; - } else { - *ptr = ; - return SWIG_OLDOBJ; - } - } else { - return SWIG_BADOBJ; - } - } - - Of course, returning the plain '0(success)/-1(fail)' still works, but you can be - more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - SWIG errors code. - - Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this - - int food(double) - int fooi(int); - - and you call - - food(1) // cast rank '1' (1 -> 1.0) - fooi(1) // cast rank '0' - - just use the SWIG_AddCast()/SWIG_CheckState() -*/ - -#define SWIG_OK (0) -#define SWIG_ERROR (-1) -#define SWIG_IsOK(r) (r >= 0) -#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) - -/* The CastRankLimit says how many bits are used for the cast rank */ -#define SWIG_CASTRANKLIMIT (1 << 8) -/* The NewMask denotes the object was created (using new/malloc) */ -#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ -#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) -/* Simple returning values */ -#define SWIG_BADOBJ (SWIG_ERROR) -#define SWIG_OLDOBJ (SWIG_OK) -#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) -#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ -#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) -#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) -#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) -#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) -#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) -#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - -/* Cast-Rank Mode */ -#if defined(SWIG_CASTRANK_MODE) -# ifndef SWIG_TypeRank -# define SWIG_TypeRank unsigned long -# endif -# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ -# define SWIG_MAXCASTRANK (2) -# endif -# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) -# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) -SWIGINTERNINLINE int SWIG_AddCast(int r) { - return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; -} -SWIGINTERNINLINE int SWIG_CheckState(int r) { - return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; -} -#else /* no cast-rank mode */ -# define SWIG_AddCast(r) (r) -# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) -#endif - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *(*swig_converter_func)(void *, int *); -typedef struct swig_type_info *(*swig_dycast_func)(void **); - -/* Structure to store information on one type */ -typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ - struct swig_cast_info *cast; /* linked list of types that can cast into this type */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ -} swig_type_info; - -/* Structure to store a type and conversion function used for casting */ -typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ -} swig_cast_info; - -/* Structure used to store module information - * Each module generates one structure like this, and the runtime collects - * all of these structures and stores them in a circularly linked list.*/ -typedef struct swig_module_info { - swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ - size_t size; /* Number of types in this module */ - struct swig_module_info *next; /* Pointer to next element in circularly linked list */ - swig_type_info **type_initial; /* Array of initially generated type structures */ - swig_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ -} swig_module_info; - -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class" == "Class", etc. - - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; - } - return (int)((l1 - f1) - (l2 - f2)); -} - -/* - Check type equivalence in a name list like ||... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb -*/ -SWIGRUNTIME int -SWIG_TypeCmp(const char *nb, const char *tb) { - int equiv = 1; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (equiv != 0 && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = SWIG_TypeNameComp(nb, ne, tb, te); - if (*ne) ++ne; - } - return equiv; -} - -/* - Check type equivalence in a name list like ||... - Return 0 if not equal, 1 if equal -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; -} - -/* - Check the typename -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Cast a pointer up an inheritance hierarchy -*/ -SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (!type) return NULL; - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; - } - else - return type->name; -} - -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void -SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; - /* if (ti->clientdata == clientdata) return; */ - ti->clientdata = clientdata; - - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); - } - } - cast = cast->next; - } -} -SWIGRUNTIME void -SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { - SWIG_TypeClientData(ti, clientdata); - ti->owndata = 1; -} - -/* - Search for a swig_type_info structure only by mangled name - Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - swig_module_info *iter = start; - do { - if (iter->size) { - size_t l = 0; - size_t r = iter->size - 1; - do { - /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - size_t i = (l + r) >> 1; - const char *iname = iter->types[i]->name; - if (iname) { - int compare = strcmp(name, iname); - if (compare == 0) { - return iter->types[i]; - } else if (compare < 0) { - if (i) { - r = i - 1; - } else { - break; - } - } else if (compare > 0) { - l = i + 1; - } - } else { - break; /* should never happen */ - } - } while (l <= r); - } - iter = iter->next; - } while (iter != end); - return 0; -} - -/* - Search for a swig_type_info structure for either a mangled name or a human readable name. - It first searches the mangled names of the types, which is a O(log #types) - If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - /* STEP 1: Search the name field using binary search */ - swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); - if (ret) { - return ret; - } else { - /* STEP 2: If the type hasn't been found, do a complete search - of the str field (the human readable name) */ - swig_module_info *iter = start; - do { - size_t i = 0; - for (; i < iter->size; ++i) { - if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) - return iter->types[i]; - } - iter = iter->next; - } while (iter != end); - } - - /* neither found a match */ - return 0; -} - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static const char hex[17] = "0123456789abcdef"; - const unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - unsigned char uu = *u; - *(c++) = hex[(uu & 0xf0) >> 4]; - *(c++) = hex[uu & 0xf]; - } - return c; -} - -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - char d = *(c++); - unsigned char uu; - if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); - else - return (char *) 0; - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); - else - return (char *) 0; - *u = uu; - } - return c; -} - -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} - -#ifdef __cplusplus -} -#endif - -/* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 -#define SWIG_SystemError -10 -#define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 -#define SWIG_NullReferenceError -13 - - - -#include - -/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which - * breaks using rb_intern as an lvalue, as SWIG does. We work around this - * issue for now by disabling this. - * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645 - */ -#ifdef rb_intern -# undef rb_intern -#endif - -/* Remove global macros defined in Ruby's win32.h */ -#ifdef write -# undef write -#endif -#ifdef read -# undef read -#endif -#ifdef bind -# undef bind -#endif -#ifdef close -# undef close -#endif -#ifdef connect -# undef connect -#endif - - -/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */ -#ifndef NUM2LL -#define NUM2LL(x) NUM2LONG((x)) -#endif -#ifndef LL2NUM -#define LL2NUM(x) INT2NUM((long) (x)) -#endif -#ifndef ULL2NUM -#define ULL2NUM(x) UINT2NUM((unsigned long) (x)) -#endif - -/* Ruby 1.7 doesn't (yet) define NUM2ULL() */ -#ifndef NUM2ULL -#ifdef HAVE_LONG_LONG -#define NUM2ULL(x) rb_num2ull((x)) -#else -#define NUM2ULL(x) NUM2ULONG(x) -#endif -#endif - -/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */ -/* Define these for older versions so we can just write code the new way */ -#ifndef RSTRING_LEN -# define RSTRING_LEN(x) RSTRING(x)->len -#endif -#ifndef RSTRING_PTR -# define RSTRING_PTR(x) RSTRING(x)->ptr -#endif -#ifndef RSTRING_END -# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x)) -#endif -#ifndef RARRAY_LEN -# define RARRAY_LEN(x) RARRAY(x)->len -#endif -#ifndef RARRAY_PTR -# define RARRAY_PTR(x) RARRAY(x)->ptr -#endif -#ifndef RFLOAT_VALUE -# define RFLOAT_VALUE(x) RFLOAT(x)->value -#endif -#ifndef DOUBLE2NUM -# define DOUBLE2NUM(x) rb_float_new(x) -#endif -#ifndef RHASH_TBL -# define RHASH_TBL(x) (RHASH(x)->tbl) -#endif -#ifndef RHASH_ITER_LEV -# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev) -#endif -#ifndef RHASH_IFNONE -# define RHASH_IFNONE(x) (RHASH(x)->ifnone) -#endif -#ifndef RHASH_SIZE -# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries) -#endif -#ifndef RHASH_EMPTY_P -# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0) -#endif -#ifndef RSTRUCT_LEN -# define RSTRUCT_LEN(x) RSTRUCT(x)->len -#endif -#ifndef RSTRUCT_PTR -# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr -#endif - - - -/* - * Need to be very careful about how these macros are defined, especially - * when compiling C++ code or C code with an ANSI C compiler. - * - * VALUEFUNC(f) is a macro used to typecast a C function that implements - * a Ruby method so that it can be passed as an argument to API functions - * like rb_define_method() and rb_define_singleton_method(). - * - * VOIDFUNC(f) is a macro used to typecast a C function that implements - * either the "mark" or "free" stuff for a Ruby Data object, so that it - * can be passed as an argument to API functions like Data_Wrap_Struct() - * and Data_Make_Struct(). - */ - -#ifdef __cplusplus -# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */ -# define PROTECTFUNC(f) ((VALUE (*)()) f) -# define VALUEFUNC(f) ((VALUE (*)()) f) -# define VOIDFUNC(f) ((void (*)()) f) -# else -# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */ -# define PROTECTFUNC(f) ((VALUE (*)()) f) -# define VALUEFUNC(f) ((VALUE (*)()) f) -# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) -# else /* These definitions should work for Ruby 1.7+ */ -# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) -# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) -# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) -# endif -# endif -#else -# define VALUEFUNC(f) (f) -# define VOIDFUNC(f) (f) -#endif - -/* Don't use for expressions have side effect */ -#ifndef RB_STRING_VALUE -#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s))) -#endif -#ifndef StringValue -#define StringValue(s) RB_STRING_VALUE(s) -#endif -#ifndef StringValuePtr -#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s)) -#endif -#ifndef StringValueLen -#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s)) -#endif -#ifndef SafeStringValue -#define SafeStringValue(v) do {\ - StringValue(v);\ - rb_check_safe_str(v);\ -} while (0) -#endif - -#ifndef HAVE_RB_DEFINE_ALLOC_FUNC -#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1) -#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new") -#endif - -static VALUE _mSWIG = Qnil; - -/* ----------------------------------------------------------------------------- - * error manipulation - * ----------------------------------------------------------------------------- */ - - -/* Define some additional error types */ -#define SWIG_ObjectPreviouslyDeletedError -100 - - -/* Define custom exceptions for errors that do not map to existing Ruby - exceptions. Note this only works for C++ since a global cannot be - initialized by a function in C. For C, fallback to rb_eRuntimeError.*/ - -SWIGINTERN VALUE -getNullReferenceError(void) { - static int init = 0; - static VALUE rb_eNullReferenceError ; - if (!init) { - init = 1; - rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError); - } - return rb_eNullReferenceError; -} - -SWIGINTERN VALUE -getObjectPreviouslyDeletedError(void) { - static int init = 0; - static VALUE rb_eObjectPreviouslyDeleted ; - if (!init) { - init = 1; - rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError); - } - return rb_eObjectPreviouslyDeleted; -} - - -SWIGINTERN VALUE -SWIG_Ruby_ErrorType(int SWIG_code) { - VALUE type; - switch (SWIG_code) { - case SWIG_MemoryError: - type = rb_eNoMemError; - break; - case SWIG_IOError: - type = rb_eIOError; - break; - case SWIG_RuntimeError: - type = rb_eRuntimeError; - break; - case SWIG_IndexError: - type = rb_eIndexError; - break; - case SWIG_TypeError: - type = rb_eTypeError; - break; - case SWIG_DivisionByZero: - type = rb_eZeroDivError; - break; - case SWIG_OverflowError: - type = rb_eRangeError; - break; - case SWIG_SyntaxError: - type = rb_eSyntaxError; - break; - case SWIG_ValueError: - type = rb_eArgError; - break; - case SWIG_SystemError: - type = rb_eFatal; - break; - case SWIG_AttributeError: - type = rb_eRuntimeError; - break; - case SWIG_NullReferenceError: - type = getNullReferenceError(); - break; - case SWIG_ObjectPreviouslyDeletedError: - type = getObjectPreviouslyDeletedError(); - break; - case SWIG_UnknownError: - type = rb_eRuntimeError; - break; - default: - type = rb_eRuntimeError; - } - return type; -} - - -/* This function is called when a user inputs a wrong argument to - a method. - */ -SWIGINTERN -const char* Ruby_Format_TypeError( const char* msg, - const char* type, - const char* name, - const int argn, - VALUE input ) -{ - char buf[128]; - VALUE str; - VALUE asStr; - if ( msg && *msg ) - { - str = rb_str_new2(msg); - } - else - { - str = rb_str_new(NULL, 0); - } - - str = rb_str_cat2( str, "Expected argument " ); - sprintf( buf, "%d of type ", argn-1 ); - str = rb_str_cat2( str, buf ); - str = rb_str_cat2( str, type ); - str = rb_str_cat2( str, ", but got " ); - str = rb_str_cat2( str, rb_obj_classname(input) ); - str = rb_str_cat2( str, " " ); - asStr = rb_inspect(input); - if ( RSTRING_LEN(asStr) > 30 ) - { - str = rb_str_cat( str, StringValuePtr(asStr), 30 ); - str = rb_str_cat2( str, "..." ); - } - else - { - str = rb_str_append( str, asStr ); - } - - if ( name ) - { - str = rb_str_cat2( str, "\n\tin SWIG method '" ); - str = rb_str_cat2( str, name ); - str = rb_str_cat2( str, "'" ); - } - - return StringValuePtr( str ); -} - -/* This function is called when an overloaded method fails */ -SWIGINTERN -void Ruby_Format_OverloadedError( - const int argc, - const int maxargs, - const char* method, - const char* prototypes - ) -{ - const char* msg = "Wrong # of arguments"; - if ( argc <= maxargs ) msg = "Wrong arguments"; - rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n" - "Possible C/C++ prototypes are:\n%s", - msg, method, prototypes); -} - -/* ----------------------------------------------------------------------------- - * rubytracking.swg - * - * This file contains support for tracking mappings from - * Ruby objects to C++ objects. This functionality is needed - * to implement mark functions for Ruby's mark and sweep - * garbage collector. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Ruby 1.8 actually assumes the first case. */ -#if SIZEOF_VOIDP == SIZEOF_LONG -# define SWIG2NUM(v) LONG2NUM((unsigned long)v) -# define NUM2SWIG(x) (unsigned long)NUM2LONG(x) -#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG -# define SWIG2NUM(v) LL2NUM((unsigned long long)v) -# define NUM2SWIG(x) (unsigned long long)NUM2LL(x) -#else -# error sizeof(void*) is not the same as long or long long -#endif - - -/* Global Ruby hash table to store Trackings from C/C++ - structs to Ruby Objects. -*/ -static VALUE swig_ruby_trackings = Qnil; - -/* Global variable that stores a reference to the ruby - hash table delete function. */ -static ID swig_ruby_hash_delete; - -/* Setup a Ruby hash table to store Trackings */ -SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) { - /* Create a ruby hash table to store Trackings from C++ - objects to Ruby objects. */ - - /* Try to see if some other .so has already created a - tracking hash table, which we keep hidden in an instance var - in the SWIG module. - This is done to allow multiple DSOs to share the same - tracking table. - */ - ID trackings_id = rb_intern( "@__trackings__" ); - VALUE verbose = rb_gv_get("VERBOSE"); - rb_gv_set("VERBOSE", Qfalse); - swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id ); - rb_gv_set("VERBOSE", verbose); - - /* No, it hasn't. Create one ourselves */ - if ( swig_ruby_trackings == Qnil ) - { - swig_ruby_trackings = rb_hash_new(); - rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings ); - } - - /* Now store a reference to the hash table delete function - so that we only have to look it up once.*/ - swig_ruby_hash_delete = rb_intern("delete"); -} - -/* Get a Ruby number to reference a pointer */ -SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) { - /* We cast the pointer to an unsigned long - and then store a reference to it using - a Ruby number object. */ - - /* Convert the pointer to a Ruby number */ - return SWIG2NUM(ptr); -} - -/* Get a Ruby number to reference an object */ -SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) { - /* We cast the object to an unsigned long - and then store a reference to it using - a Ruby number object. */ - - /* Convert the Object to a Ruby number */ - return SWIG2NUM(object); -} - -/* Get a Ruby object from a previously stored reference */ -SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) { - /* The provided Ruby number object is a reference - to the Ruby object we want.*/ - - /* Convert the Ruby number to a Ruby object */ - return NUM2SWIG(reference); -} - -/* Add a Tracking from a C/C++ struct to a Ruby object */ -SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) { - /* In a Ruby hash table we store the pointer and - the associated Ruby object. The trick here is - that we cannot store the Ruby object directly - if - we do then it cannot be garbage collected. So - instead we typecast it as a unsigned long and - convert it to a Ruby number object.*/ - - /* Get a reference to the pointer as a Ruby number */ - VALUE key = SWIG_RubyPtrToReference(ptr); - - /* Get a reference to the Ruby object as a Ruby number */ - VALUE value = SWIG_RubyObjectToReference(object); - - /* Store the mapping to the global hash table. */ - rb_hash_aset(swig_ruby_trackings, key, value); -} - -/* Get the Ruby object that owns the specified C/C++ struct */ -SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) { - /* Get a reference to the pointer as a Ruby number */ - VALUE key = SWIG_RubyPtrToReference(ptr); - - /* Now lookup the value stored in the global hash table */ - VALUE value = rb_hash_aref(swig_ruby_trackings, key); - - if (value == Qnil) { - /* No object exists - return nil. */ - return Qnil; - } - else { - /* Convert this value to Ruby object */ - return SWIG_RubyReferenceToObject(value); - } -} - -/* Remove a Tracking from a C/C++ struct to a Ruby object. It - is very important to remove objects once they are destroyed - since the same memory address may be reused later to create - a new object. */ -SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) { - /* Get a reference to the pointer as a Ruby number */ - VALUE key = SWIG_RubyPtrToReference(ptr); - - /* Delete the object from the hash table by calling Ruby's - do this we need to call the Hash.delete method.*/ - rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key); -} - -/* This is a helper method that unlinks a Ruby object from its - underlying C++ object. This is needed if the lifetime of the - Ruby object is longer than the C++ object */ -SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) { - VALUE object = SWIG_RubyInstanceFor(ptr); - - if (object != Qnil) { - DATA_PTR(object) = 0; - } -} - - -#ifdef __cplusplus -} -#endif - -/* ----------------------------------------------------------------------------- - * Ruby API portion that goes into the runtime - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -SWIGINTERN VALUE -SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { - if (NIL_P(target)) { - target = o; - } else { - if (TYPE(target) != T_ARRAY) { - VALUE o2 = target; - target = rb_ary_new(); - rb_ary_push(target, o2); - } - rb_ary_push(target, o); - } - return target; -} - -/* For ruby1.8.4 and earlier. */ -#ifndef RUBY_INIT_STACK - RUBY_EXTERN void Init_stack(VALUE* addr); -# define RUBY_INIT_STACK \ - VALUE variable_in_this_stack_frame; \ - Init_stack(&variable_in_this_stack_frame); -#endif - - -#ifdef __cplusplus -} -#endif - - -/* ----------------------------------------------------------------------------- - * rubyrun.swg - * - * This file contains the runtime support for Ruby modules - * and includes code for managing global variables and pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -/* For backward compatibility only */ -#define SWIG_POINTER_EXCEPTION 0 - -/* for raw pointers */ -#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0) -#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own) -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags) -#define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own) -#define swig_owntype ruby_owntype - -/* for raw packed data */ -#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags) -#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type) - -/* for class or struct pointers */ -#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) -#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) - -/* for C or C++ function pointers */ -#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0) -#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0) - -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type) - - -/* Runtime API */ - -#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule(clientdata) -#define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer) - - -/* Error manipulation */ - -#define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code) -#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg) -#define SWIG_fail goto fail - - -/* Ruby-specific SWIG API */ - -#define SWIG_InitRuntime() SWIG_Ruby_InitRuntime() -#define SWIG_define_class(ty) SWIG_Ruby_define_class(ty) -#define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty) -#define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value) -#define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty) - -#include "assert.h" - -/* ----------------------------------------------------------------------------- - * pointers/data manipulation - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - VALUE klass; - VALUE mImpl; - void (*mark)(void *); - void (*destroy)(void *); - int trackObjects; -} swig_class; - - -/* Global pointer used to keep some internal SWIG stuff */ -static VALUE _cSWIG_Pointer = Qnil; -static VALUE swig_runtime_data_type_pointer = Qnil; - -/* Global IDs used to keep some internal SWIG stuff */ -static ID swig_arity_id = 0; -static ID swig_call_id = 0; - -/* - If your swig extension is to be run within an embedded ruby and has - director callbacks, you should set -DRUBY_EMBEDDED during compilation. - This will reset ruby's stack frame on each entry point from the main - program the first time a virtual director function is invoked (in a - non-recursive way). - If this is not done, you run the risk of Ruby trashing the stack. -*/ - -#ifdef RUBY_EMBEDDED - -# define SWIG_INIT_STACK \ - if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \ - ++swig_virtual_calls; -# define SWIG_RELEASE_STACK --swig_virtual_calls; -# define Ruby_DirectorTypeMismatchException(x) \ - rb_raise( rb_eTypeError, "%s", x ); return c_result; - - static unsigned int swig_virtual_calls = 0; - -#else /* normal non-embedded extension */ - -# define SWIG_INIT_STACK -# define SWIG_RELEASE_STACK -# define Ruby_DirectorTypeMismatchException(x) \ - throw Swig::DirectorTypeMismatchException( x ); - -#endif /* RUBY_EMBEDDED */ - - -SWIGRUNTIME VALUE -getExceptionClass(void) { - static int init = 0; - static VALUE rubyExceptionClass ; - if (!init) { - init = 1; - rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception")); - } - return rubyExceptionClass; -} - -/* This code checks to see if the Ruby object being raised as part - of an exception inherits from the Ruby class Exception. If so, - the object is simply returned. If not, then a new Ruby exception - object is created and that will be returned to Ruby.*/ -SWIGRUNTIME VALUE -SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) { - VALUE exceptionClass = getExceptionClass(); - if (rb_obj_is_kind_of(obj, exceptionClass)) { - return obj; - } else { - return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)); - } -} - -/* Initialize Ruby runtime support */ -SWIGRUNTIME void -SWIG_Ruby_InitRuntime(void) -{ - if (_mSWIG == Qnil) { - _mSWIG = rb_define_module("SWIG"); - swig_call_id = rb_intern("call"); - swig_arity_id = rb_intern("arity"); - } -} - -/* Define Ruby class for C type */ -SWIGRUNTIME void -SWIG_Ruby_define_class(swig_type_info *type) -{ - char *klass_name = (char *) malloc(4 + strlen(type->name) + 1); - sprintf(klass_name, "TYPE%s", type->name); - if (NIL_P(_cSWIG_Pointer)) { - _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); - rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); - } - rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); - free((void *) klass_name); -} - -/* Create a new pointer object */ -SWIGRUNTIME VALUE -SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) -{ - int own = flags & SWIG_POINTER_OWN; - int track; - char *klass_name; - swig_class *sklass; - VALUE klass; - VALUE obj; - - if (!ptr) - return Qnil; - - if (type->clientdata) { - sklass = (swig_class *) type->clientdata; - - /* Are we tracking this class and have we already returned this Ruby object? */ - track = sklass->trackObjects; - if (track) { - obj = SWIG_RubyInstanceFor(ptr); - - /* Check the object's type and make sure it has the correct type. - It might not in cases where methods do things like - downcast methods. */ - if (obj != Qnil) { - VALUE value = rb_iv_get(obj, "@__swigtype__"); - const char* type_name = RSTRING_PTR(value); - - if (strcmp(type->name, type_name) == 0) { - return obj; - } - } - } - - /* Create a new Ruby object */ - obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), - ( own ? VOIDFUNC(sklass->destroy) : - (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 ) - ), ptr); - - /* If tracking is on for this class then track this object. */ - if (track) { - SWIG_RubyAddTracking(ptr, obj); - } - } else { - klass_name = (char *) malloc(4 + strlen(type->name) + 1); - sprintf(klass_name, "TYPE%s", type->name); - klass = rb_const_get(_mSWIG, rb_intern(klass_name)); - free((void *) klass_name); - obj = Data_Wrap_Struct(klass, 0, 0, ptr); - } - rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name)); - - return obj; -} - -/* Create a new class instance (always owned) */ -SWIGRUNTIME VALUE -SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type) -{ - VALUE obj; - swig_class *sklass = (swig_class *) type->clientdata; - obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0); - rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name)); - return obj; -} - -/* Get type mangle from class name */ -SWIGRUNTIMEINLINE char * -SWIG_Ruby_MangleStr(VALUE obj) -{ - VALUE stype = rb_iv_get(obj, "@__swigtype__"); - return StringValuePtr(stype); -} - -/* Acquire a pointer value */ -typedef void (*ruby_owntype)(void*); - -SWIGRUNTIME ruby_owntype -SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) { - if (obj) { - ruby_owntype oldown = RDATA(obj)->dfree; - RDATA(obj)->dfree = own; - return oldown; - } else { - return 0; - } -} - -/* Convert a pointer value */ -SWIGRUNTIME int -SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own) -{ - char *c; - swig_cast_info *tc; - void *vptr = 0; - - /* Grab the pointer */ - if (NIL_P(obj)) { - *ptr = 0; - return SWIG_OK; - } else { - if (TYPE(obj) != T_DATA) { - return SWIG_ERROR; - } - Data_Get_Struct(obj, void, vptr); - } - - if (own) *own = RDATA(obj)->dfree; - - /* Check to see if the input object is giving up ownership - of the underlying C struct or C++ object. If so then we - need to reset the destructor since the Ruby object no - longer owns the underlying C++ object.*/ - if (flags & SWIG_POINTER_DISOWN) { - /* Is tracking on for this class? */ - int track = 0; - if (ty && ty->clientdata) { - swig_class *sklass = (swig_class *) ty->clientdata; - track = sklass->trackObjects; - } - - if (track) { - /* We are tracking objects for this class. Thus we change the destructor - * to SWIG_RubyRemoveTracking. This allows us to - * remove the mapping from the C++ to Ruby object - * when the Ruby object is garbage collected. If we don't - * do this, then it is possible we will return a reference - * to a Ruby object that no longer exists thereby crashing Ruby. */ - RDATA(obj)->dfree = SWIG_RubyRemoveTracking; - } else { - RDATA(obj)->dfree = 0; - } - } - - /* Do type-checking if type info was provided */ - if (ty) { - if (ty->clientdata) { - if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) { - if (vptr == 0) { - /* The object has already been deleted */ - return SWIG_ObjectPreviouslyDeletedError; - } - *ptr = vptr; - return SWIG_OK; - } - } - if ((c = SWIG_MangleStr(obj)) == NULL) { - return SWIG_ERROR; - } - tc = SWIG_TypeCheck(c, ty); - if (!tc) { - return SWIG_ERROR; - } else { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc, vptr, &newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } - } else { - *ptr = vptr; - } - - return SWIG_OK; -} - -/* Check convert */ -SWIGRUNTIMEINLINE int -SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty) -{ - char *c = SWIG_MangleStr(obj); - if (!c) return 0; - return SWIG_TypeCheck(c,ty) != 0; -} - -SWIGRUNTIME VALUE -SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) { - char result[1024]; - char *r = result; - if ((2*sz + 1 + strlen(type->name)) > 1000) return 0; - *(r++) = '_'; - r = SWIG_PackData(r, ptr, sz); - strcpy(r, type->name); - return rb_str_new2(result); -} - -/* Convert a packed value value */ -SWIGRUNTIME int -SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) { - swig_cast_info *tc; - const char *c; - - if (TYPE(obj) != T_STRING) goto type_error; - c = StringValuePtr(obj); - /* Pointer values must start with leading underscore */ - if (*c != '_') goto type_error; - c++; - c = SWIG_UnpackData(c, ptr, sz); - if (ty) { - tc = SWIG_TypeCheck(c, ty); - if (!tc) goto type_error; - } - return SWIG_OK; - - type_error: - return SWIG_ERROR; -} - -SWIGRUNTIME swig_module_info * -SWIG_Ruby_GetModule(void *SWIGUNUSEDPARM(clientdata)) -{ - VALUE pointer; - swig_module_info *ret = 0; - VALUE verbose = rb_gv_get("VERBOSE"); - - /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */ - rb_gv_set("VERBOSE", Qfalse); - - /* first check if pointer already created */ - pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); - if (pointer != Qnil) { - Data_Get_Struct(pointer, swig_module_info, ret); - } - - /* reinstate warnings */ - rb_gv_set("VERBOSE", verbose); - return ret; -} - -SWIGRUNTIME void -SWIG_Ruby_SetModule(swig_module_info *pointer) -{ - /* register a new class */ - VALUE cl = rb_define_class("swig_runtime_data", rb_cObject); - /* create and store the structure pointer to a global variable */ - swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer); - rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer); -} - -/* This function can be used to check whether a proc or method or similarly - callable function has been passed. Usually used in a %typecheck, like: - - %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) { - $result = SWIG_Ruby_isCallable( $input ); - } - */ -SWIGINTERN -int SWIG_Ruby_isCallable( VALUE proc ) -{ - if ( rb_respond_to( proc, swig_call_id ) ) - return 1; - return 0; -} - -/* This function can be used to check the arity (number of arguments) - a proc or method can take. Usually used in a %typecheck. - Valid arities will be that equal to minimal or those < 0 - which indicate a variable number of parameters at the end. - */ -SWIGINTERN -int SWIG_Ruby_arity( VALUE proc, int minimal ) -{ - if ( rb_respond_to( proc, swig_arity_id ) ) - { - VALUE num = rb_funcall( proc, swig_arity_id, 0 ); - int arity = NUM2INT(num); - if ( arity < 0 && (arity+1) < -minimal ) return 1; - if ( arity == minimal ) return 1; - return 1; - } - return 0; -} - - -#ifdef __cplusplus -} -#endif - - - -#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) - -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else - - - - #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0) - - -/* -------- TYPES TABLE (BEGIN) -------- */ - -#define SWIGTYPE_p_HashCounter swig_types[0] -#define SWIGTYPE_p_HashSet swig_types[1] -#define SWIGTYPE_p_MerDNA swig_types[2] -#define SWIGTYPE_p_QueryMerFile swig_types[3] -#define SWIGTYPE_p_ReadMerFile swig_types[4] -#define SWIGTYPE_p_StringMers swig_types[5] -#define SWIGTYPE_p_char swig_types[6] -#define SWIGTYPE_p_std__pairT_bool_uint64_t_t swig_types[7] -static swig_type_info *swig_types[9]; -static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0}; -#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) -#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) - -/* -------- TYPES TABLE (END) -------- */ - -#define SWIG_init Init_jellyfish -#define SWIG_name "Jellyfish" - -static VALUE mJellyfish; - -#define SWIG_RUBY_THREAD_BEGIN_BLOCK -#define SWIG_RUBY_THREAD_END_BLOCK - - -#define SWIGVERSION 0x030002 -#define SWIG_VERSION SWIGVERSION - - -#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) -#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) - - -#include - - -#include - - -#include - - -#ifdef __cplusplus -extern "C" { -#endif - -/* Ruby 1.9 changed the file name of this header */ -#ifdef HAVE_RUBY_IO_H -#include "ruby/io.h" -#else -#include "rubyio.h" -#endif - -#ifdef __cplusplus -} -#endif - - -#ifdef __cplusplus -extern "C" { -#endif -#ifdef HAVE_SYS_TIME_H -# include -struct timeval rb_time_timeval(VALUE); -#endif -#ifdef __cplusplus -} -#endif - - -#ifdef SWIGPYTHON -#define SWIG_FILE_WITH_INIT -#endif - -#ifdef SWIGPERL -#undef seed -#undef random -#endif - -#include -#include -#undef die -#include -#include -#include -#include -#include -#undef die - - - class MerDNA : public jellyfish::mer_dna { - public: - MerDNA() = default; - MerDNA(const char* s) : jellyfish::mer_dna(s) { } - MerDNA(const MerDNA& m) : jellyfish::mer_dna(m) { } - MerDNA& operator=(const jellyfish::mer_dna& m) { *static_cast(this) = m; return *this; } - }; - - -SWIGINTERN swig_type_info* -SWIG_pchar_descriptor(void) -{ - static int init = 0; - static swig_type_info* info = 0; - if (!init) { - info = SWIG_TypeQuery("_p_char"); - init = 1; - } - return info; -} - - -SWIGINTERN int -SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc) -{ - if (TYPE(obj) == T_STRING) { - char *cstr = StringValuePtr(obj); - size_t size = RSTRING_LEN(obj) + 1; - if (cptr) { - if (alloc) { - if (*alloc == SWIG_NEWOBJ) { - *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size))); - } else { - *cptr = cstr; - *alloc = SWIG_OLDOBJ; - } - } - } - if (psize) *psize = size; - return SWIG_OK; - } else { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor) { - void* vptr = 0; - if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { - if (cptr) *cptr = (char *)vptr; - if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; - } - } - } - return SWIG_TypeError; -} - - - - - -#include -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -SWIGINTERN VALUE -SWIG_ruby_failed(void) -{ - return Qnil; -} - - -/*@SWIG:/usr/share/swig3.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args) -{ - VALUE obj = args[0]; - VALUE type = TYPE(obj); - unsigned long *res = (unsigned long *)(args[1]); - *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj); - return obj; -} -/*@SWIG@*/ - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val) -{ - VALUE type = TYPE(obj); - if ((type == T_FIXNUM) || (type == T_BIGNUM)) { - unsigned long v; - VALUE a[2]; - a[0] = obj; - a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { - if (val) *val = v; - return SWIG_OK; - } - } - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v > UINT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = static_cast< unsigned int >(v); - } - } - return res; -} - - - #define SWIG_From_long LONG2NUM - - -SWIGINTERNINLINE VALUE -SWIG_From_unsigned_SS_long (unsigned long value) -{ - return ULONG2NUM(value); -} - - -SWIGINTERNINLINE VALUE -SWIG_From_unsigned_SS_int (unsigned int value) -{ - return SWIG_From_unsigned_SS_long (value); -} - - -SWIGINTERNINLINE VALUE -SWIG_From_bool (bool value) -{ - return value ? Qtrue : Qfalse; -} - - -SWIGINTERN int -SWIG_AsCharArray(VALUE obj, char *val, size_t size) -{ - char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; - int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); - if (SWIG_IsOK(res)) { - /* special case of single char conversion when we don't need space for NUL */ - if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; - if (csize <= size) { - if (val) { - if (csize) memcpy(val, cptr, csize*sizeof(char)); - if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); - } - if (alloc == SWIG_NEWOBJ) { - delete[] cptr; - res = SWIG_DelNewMask(res); - } - return res; - } - if (alloc == SWIG_NEWOBJ) delete[] cptr; - } - return SWIG_TypeError; -} - - -/*@SWIG:/usr/share/swig3.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args) -{ - VALUE obj = args[0]; - VALUE type = TYPE(obj); - long *res = (long *)(args[1]); - *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj); - return obj; -} -/*@SWIG@*/ - -SWIGINTERN int -SWIG_AsVal_long (VALUE obj, long* val) -{ - VALUE type = TYPE(obj); - if ((type == T_FIXNUM) || (type == T_BIGNUM)) { - long v; - VALUE a[2]; - a[0] = obj; - a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { - if (val) *val = v; - return SWIG_OK; - } - } - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_char (VALUE obj, char *val) -{ - int res = SWIG_AsCharArray(obj, val, 1); - if (!SWIG_IsOK(res)) { - long v; - res = SWIG_AddCast(SWIG_AsVal_long (obj, &v)); - if (SWIG_IsOK(res)) { - if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) { - if (val) *val = static_cast< char >(v); - } else { - res = SWIG_OverflowError; - } - } - } - return res; -} - - -SWIGINTERNINLINE VALUE -SWIG_FromCharPtrAndSize(const char* carray, size_t size) -{ - if (carray) { - if (size > LONG_MAX) { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - return pchar_descriptor ? - SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil; - } else { - return rb_str_new(carray, static_cast< long >(size)); - } - } else { - return Qnil; - } -} - - -SWIGINTERNINLINE VALUE -SWIG_From_char (char c) -{ - return SWIG_FromCharPtrAndSize(&c,1); -} - -SWIGINTERN MerDNA MerDNA_dup(MerDNA const *self){ return MerDNA(*self); } -SWIGINTERN std::string MerDNA___str__(MerDNA *self){ return self->to_str(); } - -SWIGINTERNINLINE VALUE -SWIG_From_std_string (const std::string& s) -{ - return SWIG_FromCharPtrAndSize(s.data(), s.size()); -} - -SWIGINTERN void MerDNA_set(MerDNA *self,char const *s){ *static_cast(self) = s; } -SWIGINTERN char MerDNA___getitem__(MerDNA *self,unsigned int i){ return (char)self->base(i); } -SWIGINTERN void MerDNA___setitem__(MerDNA *self,unsigned int i,char b){ self->base(i) = b; } -SWIGINTERN MerDNA &MerDNA___lshift__(MerDNA *self,char b){ self->shift_left(b); return *self; } -SWIGINTERN MerDNA &MerDNA___rshift__(MerDNA *self,char b){ self->shift_right(b); return *self; } - - class QueryMerFile { - std::unique_ptr bf; - jellyfish::mapped_file binary_map; - std::unique_ptr jf; - - public: - QueryMerFile(const char* path) throw(std::runtime_error) { - std::ifstream in(path); - if(!in.good()) - throw std::runtime_error(std::string("Can't open file '") + path + "'"); - jellyfish::file_header header(in); - jellyfish::mer_dna::k(header.key_len() / 2); - if(header.format() == "bloomcounter") { - jellyfish::hash_pair fns(header.matrix(1), header.matrix(2)); - bf.reset(new jellyfish::mer_dna_bloom_filter(header.size(), header.nb_hashes(), in, fns)); - if(!in.good()) - throw std::runtime_error("Bloom filter file is truncated"); - } else if(header.format() == "binary/sorted") { - binary_map.map(path); - jf.reset(new binary_query(binary_map.base() + header.offset(), header.key_len(), header.counter_len(), header.matrix(), - header.size() - 1, binary_map.length() - header.offset())); - } else { - throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'"); - } - } - -#ifdef SWIGPERL - unsigned int get(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); } -#else - unsigned int __getitem__(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); } -#endif - }; - - - class ReadMerFile { - std::ifstream in; - std::unique_ptr binary; - std::unique_ptr text; - - std::pair next_mer__() { - std::pair res((const MerDNA*)0, 0); - if(next_mer()) { - res.first = mer(); - res.second = count(); - } - return res; - } - - public: - ReadMerFile(const char* path) throw(std::runtime_error) : - in(path) - { - if(!in.good()) - throw std::runtime_error(std::string("Can't open file '") + path + "'"); - jellyfish::file_header header(in); - jellyfish::mer_dna::k(header.key_len() / 2); - if(header.format() == binary_dumper::format) - binary.reset(new binary_reader(in, &header)); - else if(header.format() == text_dumper::format) - text.reset(new text_reader(in, &header)); - else - throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'"); - } - - bool next_mer() { - if(binary) { - if(binary->next()) return true; - binary.reset(); - } else if(text) { - if(text->next()) return true; - text.reset(); - } - return false; - } - - const MerDNA* mer() const { return static_cast(binary ? &binary->key() : &text->key()); } - unsigned long count() const { return binary ? binary->val() : text->val(); } - -#ifdef SWIGRUBY - void each() { - if(!rb_block_given_p()) return; - while(next_mer()) { - auto m = SWIG_NewPointerObj(const_cast(mer()), SWIGTYPE_p_MerDNA, 0); - auto c = SWIG_From_unsigned_SS_long(count()); - rb_yield(rb_ary_new3(2, m, c)); - } - } -#endif - -#ifdef SWIGPERL - std::pair each() { return next_mer__(); } -#endif - -#ifdef SWIGPYTHON - ReadMerFile* __iter__() { return this; } - std::pair __next__() { return next_mer__(); } - std::pair next() { return next_mer__(); } -#endif - }; - - - class HashCounter : public jellyfish::cooperative::hash_counter { - typedef jellyfish::cooperative::hash_counter super; - public: - HashCounter(size_t size, unsigned int val_len, unsigned int nb_threads = 1) : \ - super(size, jellyfish::mer_dna::k() * 2, val_len, nb_threads) - { } - - bool add(const MerDNA& m, const int& x) { - bool res; - size_t id; - super::add(m, x, &res, &id); - return res; - } - - }; - - -SWIGINTERNINLINE int -SWIG_AsVal_size_t (VALUE obj, size_t *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); - return res; -} - - -SWIGINTERNINLINE VALUE -SWIG_From_size_t (size_t value) -{ - return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value)); -} - - -SWIGINTERN int -SWIG_AsVal_int (VALUE obj, int *val) -{ - long v; - int res = SWIG_AsVal_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v < INT_MIN || v > INT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = static_cast< int >(v); - } - } - return res; -} - -SWIGINTERN void HashCounter_get(HashCounter const *self,MerDNA const &m,std::pair< bool,uint64_t > *COUNT){ - COUNT->first = self->ary()->get_val_for_key(m, &COUNT->second); - } -SWIGINTERN void HashCounter___getitem__(HashCounter const *self,MerDNA const &m,std::pair< bool,uint64_t > *COUNT){ - COUNT->first = self->ary()->get_val_for_key(m, &COUNT->second); - } - - class HashSet : public jellyfish::cooperative::hash_counter { - typedef jellyfish::cooperative::hash_counter super; - public: - HashSet(size_t size, unsigned int nb_threads = 1) : \ - super(size, jellyfish::mer_dna::k() * 2, 0, nb_threads) - { } - - bool add(const MerDNA& m) { - bool res; - size_t id; - super::set(m, &res, &id); - return res; - } - }; - -SWIGINTERN bool HashSet_get(HashSet const *self,MerDNA const &m){ return self->ary()->has_key(m); } -SWIGINTERN bool HashSet___getitem__(HashSet const *self,MerDNA const &m){ return self->ary()->has_key(m); } - - class StringMers { - const char* m_current; - const char* const m_last; - const bool m_canonical; - MerDNA m_m, m_rcm; - unsigned int m_filled; - - public: - StringMers(const char* str, int len, bool canonical) - : m_current(str) - , m_last(str + len) - , m_canonical(canonical) - , m_filled(0) - { } - - bool next_mer() { - if(m_current == m_last) - return false; - - do { - int code = jellyfish::mer_dna::code(*m_current); - ++m_current; - if(code >= 0) { - m_m.shift_left(code); - if(m_canonical) - m_rcm.shift_right(m_rcm.complement(code)); - m_filled = std::min(m_filled + 1, m_m.k()); - } else - m_filled = 0; - } while(m_filled < m_m.k() && m_current != m_last); - return m_filled == m_m.k(); - } - - const MerDNA* mer() const { return !m_canonical || m_m < m_rcm ? &m_m : &m_rcm; } - - const MerDNA* next_mer__() { - return next_mer() ? mer() : nullptr; - } - - -#ifdef SWIGRUBY - void each() { - if(!rb_block_given_p()) return; - while(next_mer()) { - auto m = SWIG_NewPointerObj(const_cast(mer()), SWIGTYPE_p_MerDNA, 0); - rb_yield(m); - } - } -#endif - -#ifdef SWIGPYTHON - StringMers* __iter__() { return this; } - const MerDNA* __next__() { return next_mer__(); } - const MerDNA* next() { return next_mer__(); } -#endif - -#ifdef SWIGPERL - const MerDNA* each() { return next_mer__(); } -#endif - - }; - - StringMers* string_mers(char* str, int length) { return new StringMers(str, length, false); } - StringMers* string_canonicals(char* str, int length) { return new StringMers(str, length, true); } - - -SWIGINTERN int -SWIG_AsVal_bool (VALUE obj, bool *val) -{ - if (obj == Qtrue) { - if (val) *val = true; - return SWIG_OK; - } else if (obj == Qfalse) { - if (val) *val = false; - return SWIG_OK; - } else { - int res = 0; - if (SWIG_AsVal_int (obj, &res) == SWIG_OK) { - if (val) *val = res ? true : false; - return SWIG_OK; - } - } - return SWIG_TypeError; -} - - -/* - Document-class: Jellyfish::MerDNA - - call-seq: - - -Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int). -*/ -static swig_class SwigClassMerDNA; - - -/* - Document-method: Jellyfish::MerDNA.new - - call-seq: - - - - -Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int). -*/ -SWIGINTERN VALUE -_wrap_new_MerDNA__SWIG_0(int argc, VALUE *argv, VALUE self) { - MerDNA *result = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - result = (MerDNA *)new MerDNA(); - DATA_PTR(self) = result; - return self; -fail: - return Qnil; -} - - -SWIGINTERN VALUE -_wrap_new_MerDNA__SWIG_1(int argc, VALUE *argv, VALUE self) { - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - MerDNA *result = 0 ; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","MerDNA", 1, argv[0] )); - } - arg1 = reinterpret_cast< char * >(buf1); - result = (MerDNA *)new MerDNA((char const *)arg1); - DATA_PTR(self) = result; - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return self; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return Qnil; -} - - -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC -SWIGINTERN VALUE -_wrap_MerDNA_allocate(VALUE self) { -#else - SWIGINTERN VALUE - _wrap_MerDNA_allocate(int argc, VALUE *argv, VALUE self) { -#endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_MerDNA); -#ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); -#endif - return vresult; - } - - -SWIGINTERN VALUE -_wrap_new_MerDNA__SWIG_2(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = 0 ; - void *argp1 ; - int res1 = 0 ; - MerDNA *result = 0 ; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const &","MerDNA", 1, argv[0] )); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","MerDNA", 1, argv[0])); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = (MerDNA *)new MerDNA((MerDNA const &)*arg1); - DATA_PTR(self) = result; - return self; -fail: - return Qnil; -} - - -SWIGINTERN VALUE _wrap_new_MerDNA(int nargs, VALUE *args, VALUE self) { - int argc; - VALUE argv[1]; - int ii; - - argc = nargs; - if (argc > 1) SWIG_fail; - for (ii = 0; (ii < argc); ++ii) { - argv[ii] = args[ii]; - } - if (argc == 0) { - return _wrap_new_MerDNA__SWIG_0(nargs, args, self); - } - if (argc == 1) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_MerDNA, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_MerDNA__SWIG_2(nargs, args, self); - } - } - if (argc == 1) { - int _v; - int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_MerDNA__SWIG_1(nargs, args, self); - } - } - -fail: - Ruby_Format_OverloadedError( argc, 1, "MerDNA.new", - " MerDNA.new()\n" - " MerDNA.new(char const *)\n" - " MerDNA.new(MerDNA const &)\n"); - - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.k - - call-seq: - k -> unsigned int - k(arg2) -> unsigned int - -Get the length of the k-mers. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_k__SWIG_0(int argc, VALUE *argv, VALUE self) { - unsigned int result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - result = (unsigned int)MerDNA::k(); - vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); - return vresult; -fail: - return Qnil; -} - - -SWIGINTERN VALUE -_wrap_MerDNA_k__SWIG_1(int argc, VALUE *argv, VALUE self) { - unsigned int arg1 ; - unsigned int val1 ; - int ecode1 = 0 ; - unsigned int result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","MerDNA::k", 1, argv[0] )); - } - arg1 = static_cast< unsigned int >(val1); - result = (unsigned int)MerDNA::k(arg1); - vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); - return vresult; -fail: - return Qnil; -} - - -SWIGINTERN VALUE _wrap_MerDNA_k(int nargs, VALUE *args, VALUE self) { - int argc; - VALUE argv[1]; - int ii; - - argc = nargs; - if (argc > 1) SWIG_fail; - for (ii = 0; (ii < argc); ++ii) { - argv[ii] = args[ii]; - } - if (argc == 0) { - return _wrap_MerDNA_k__SWIG_0(nargs, args, self); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_MerDNA_k__SWIG_1(nargs, args, self); - } - } - -fail: - Ruby_Format_OverloadedError( argc, 1, "MerDNA.k", - " unsigned int MerDNA.k()\n" - " unsigned int MerDNA.k(unsigned int)\n"); - - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.polyA - - call-seq: - polyA - -Change the mer to a homopolymer of A. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_polyAN___(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","polyA", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyA(); - return Qnil; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.polyC - - call-seq: - polyC - -Change the mer to a homopolymer of C. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_polyCN___(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","polyC", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyC(); - return Qnil; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.polyG - - call-seq: - polyG - -Change the mer to a homopolymer of G. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_polyGN___(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","polyG", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyG(); - return Qnil; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.polyT - - call-seq: - polyT - -Change the mer to a homopolymer of T. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_polyTN___(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","polyT", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->polyT(); - return Qnil; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.randomize - - call-seq: - randomize - -Change the mer to a random one. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_randomizeN___(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","randomize", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->randomize(); - return Qnil; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.is_homopolymer - - call-seq: - is_homopolymer -> bool - -Check if the mer is a homopolymer. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_is_homopolymer(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","is_homopolymer", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = (bool)((MerDNA const *)arg1)->is_homopolymer(); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.shift_left - - call-seq: - shift_left(arg2) -> char - -Shift a base to the left and the leftmost base is return . "ACGT", shift_left('A') becomes "CGTA" and 'A' is returned. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_shift_left(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - char result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","shift_left", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char(argv[0], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "char","shift_left", 2, argv[0] )); - } - arg2 = static_cast< char >(val2); - result = (char)(arg1)->shift_left(arg2); - vresult = SWIG_From_char(static_cast< char >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.shift_right - - call-seq: - shift_right(arg2) -> char - -Shift a base to the right and the rightmost base is return . "ACGT", shift_right('A') becomes "AACG" and 'T' is returned. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_shift_right(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - char result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","shift_right", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char(argv[0], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "char","shift_right", 2, argv[0] )); - } - arg2 = static_cast< char >(val2); - result = (char)(arg1)->shift_right(arg2); - vresult = SWIG_From_char(static_cast< char >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.canonicalize - - call-seq: - canonicalize - -Change the mer to its canonical representation. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_canonicalizeN___(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","canonicalize", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->canonicalize(); - return Qnil; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.reverse_complement - - call-seq: - reverse_complement - -Change the mer to its reverse complement. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_reverse_complementN___(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","reverse_complement", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - (arg1)->reverse_complement(); - return Qnil; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.get_canonical - - call-seq: - get_canonical -> MerDNA - -Return canonical representation of the mer. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_get_canonical(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - MerDNA result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","get_canonical", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = ((MerDNA const *)arg1)->get_canonical(); - vresult = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | 0 ); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.get_reverse_complement - - call-seq: - get_reverse_complement -> MerDNA - -Return the reverse complement of the mer. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_get_reverse_complement(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - MerDNA result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","get_reverse_complement", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = ((MerDNA const *)arg1)->get_reverse_complement(); - vresult = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | 0 ); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.== - - call-seq: - ==(arg2) -> bool - -Equality between mers. -*/ -SWIGINTERN VALUE -_wrap_MerDNA___eq__(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","operator ==", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","operator ==", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","operator ==", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)((MerDNA const *)arg1)->operator ==((MerDNA const &)*arg2); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.< - - call-seq: - <(arg2) -> bool - -Lexicographic less-than. -*/ -SWIGINTERN VALUE -_wrap_MerDNA___lt__(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","operator <", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","operator <", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","operator <", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)((MerDNA const *)arg1)->operator <((MerDNA const &)*arg2); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.> - - call-seq: - >(arg2) -> bool - -Lexicographic greater-than. -*/ -SWIGINTERN VALUE -_wrap_MerDNA___gt__(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","operator >", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","operator >", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","operator >", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)((MerDNA const *)arg1)->operator >((MerDNA const &)*arg2); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.dup - - call-seq: - dup -> MerDNA - -Duplicate the mer. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_dup(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - MerDNA result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","dup", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = MerDNA_dup((MerDNA const *)arg1); - vresult = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | 0 ); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.to_s - - call-seq: - to_s -> std::string - -Return string representation of the mer. -*/ -SWIGINTERN VALUE -_wrap_MerDNA___str__(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::string result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__str__", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - result = MerDNA___str__(arg1); - vresult = SWIG_From_std_string(static_cast< std::string >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.set - - call-seq: - set(s) - -Set the mer from a string. -*/ -SWIGINTERN VALUE -_wrap_MerDNA_set(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - char *arg2 = (char *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","set", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","set", 2, argv[0] )); - } - arg2 = reinterpret_cast< char * >(buf2); - try { - MerDNA_set(arg1,(char const *)arg2); - } - catch(std::length_error &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - - if (alloc2 == SWIG_NEWOBJ) delete[] buf2; - return Qnil; -fail: - if (alloc2 == SWIG_NEWOBJ) delete[] buf2; - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.[] - - call-seq: - [](i) -> char - -Get base i (0 <= i < k). -*/ -SWIGINTERN VALUE -_wrap_MerDNA___getitem__(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - unsigned int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - char result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__getitem__", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","__getitem__", 2, argv[0] )); - } - arg2 = static_cast< unsigned int >(val2); - result = (char)MerDNA___getitem__(arg1,arg2); - vresult = SWIG_From_char(static_cast< char >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.[]= - - call-seq: - []=(i, b) - -Set base i (0 <= i < k). -*/ -SWIGINTERN VALUE -_wrap_MerDNA___setitem__(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - unsigned int arg2 ; - char arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - char val3 ; - int ecode3 = 0 ; - - if ((argc < 2) || (argc > 2)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__setitem__", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","__setitem__", 2, argv[0] )); - } - arg2 = static_cast< unsigned int >(val2); - ecode3 = SWIG_AsVal_char(argv[1], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "char","__setitem__", 3, argv[1] )); - } - arg3 = static_cast< char >(val3); - MerDNA___setitem__(arg1,arg2,arg3); - return Qnil; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.<< - - call-seq: - <<(b) -> MerDNA - -Shift a base to the left and return the mer. -*/ -SWIGINTERN VALUE -_wrap_MerDNA___lshift__(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - MerDNA *result = 0 ; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__lshift__", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char(argv[0], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "char","__lshift__", 2, argv[0] )); - } - arg2 = static_cast< char >(val2); - result = (MerDNA *) &MerDNA___lshift__(arg1,arg2); - vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::MerDNA.>> - - call-seq: - >>(b) -> MerDNA - -Shift a base to the right and return the mer. -*/ -SWIGINTERN VALUE -_wrap_MerDNA___rshift__(int argc, VALUE *argv, VALUE self) { - MerDNA *arg1 = (MerDNA *) 0 ; - char arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char val2 ; - int ecode2 = 0 ; - MerDNA *result = 0 ; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__rshift__", 1, self )); - } - arg1 = reinterpret_cast< MerDNA * >(argp1); - ecode2 = SWIG_AsVal_char(argv[0], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "char","__rshift__", 2, argv[0] )); - } - arg2 = static_cast< char >(val2); - result = (MerDNA *) &MerDNA___rshift__(arg1,arg2); - vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return vresult; -fail: - return Qnil; -} - - -SWIGINTERN void -free_MerDNA(MerDNA *arg1) { - delete arg1; -} - - -/* - Document-class: Jellyfish::QueryMerFile - - call-seq: - - -Give random access to a Jellyfish database. Given a mer, it returns the count associated with that mer. -*/ -static swig_class SwigClassQueryMerFile; - -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC -SWIGINTERN VALUE -_wrap_QueryMerFile_allocate(VALUE self) { -#else - SWIGINTERN VALUE - _wrap_QueryMerFile_allocate(int argc, VALUE *argv, VALUE self) { -#endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_QueryMerFile); -#ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); -#endif - return vresult; - } - - - -/* - Document-method: Jellyfish::QueryMerFile.new - - call-seq: - - -Open the jellyfish database. -*/ -SWIGINTERN VALUE -_wrap_new_QueryMerFile(int argc, VALUE *argv, VALUE self) { - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - QueryMerFile *result = 0 ; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","QueryMerFile", 1, argv[0] )); - } - arg1 = reinterpret_cast< char * >(buf1); - try { - result = (QueryMerFile *)new QueryMerFile((char const *)arg1); - DATA_PTR(self) = result; - } - catch(std::runtime_error &_e) { - SWIG_exception_fail(SWIG_RuntimeError, (&_e)->what()); - } - - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return self; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return Qnil; -} - - - -/* - Document-method: Jellyfish::QueryMerFile.[] - - call-seq: - [](m) -> unsigned int - -Get the count for the mer m. -*/ -SWIGINTERN VALUE -_wrap_QueryMerFile___getitem__(int argc, VALUE *argv, VALUE self) { - QueryMerFile *arg1 = (QueryMerFile *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - unsigned int result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_QueryMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QueryMerFile *","__getitem__", 1, self )); - } - arg1 = reinterpret_cast< QueryMerFile * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","__getitem__", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","__getitem__", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (unsigned int)(arg1)->__getitem__((MerDNA const &)*arg2); - vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); - return vresult; -fail: - return Qnil; -} - - -SWIGINTERN void -free_QueryMerFile(QueryMerFile *arg1) { - delete arg1; -} - - -/* - Document-class: Jellyfish::ReadMerFile - - call-seq: - - -Read a Jellyfish database sequentially. -*/ -static swig_class SwigClassReadMerFile; - -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC -SWIGINTERN VALUE -_wrap_ReadMerFile_allocate(VALUE self) { -#else - SWIGINTERN VALUE - _wrap_ReadMerFile_allocate(int argc, VALUE *argv, VALUE self) { -#endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_ReadMerFile); -#ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); -#endif - return vresult; - } - - - -/* - Document-method: Jellyfish::ReadMerFile.new - - call-seq: - - -Open the jellyfish database. -*/ -SWIGINTERN VALUE -_wrap_new_ReadMerFile(int argc, VALUE *argv, VALUE self) { - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - ReadMerFile *result = 0 ; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","ReadMerFile", 1, argv[0] )); - } - arg1 = reinterpret_cast< char * >(buf1); - try { - result = (ReadMerFile *)new ReadMerFile((char const *)arg1); - DATA_PTR(self) = result; - } - catch(std::runtime_error &_e) { - SWIG_exception_fail(SWIG_RuntimeError, (&_e)->what()); - } - - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return self; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return Qnil; -} - - - -/* - Document-method: Jellyfish::ReadMerFile.next_mer - - call-seq: - next_mer -> bool - -Move to the next mer in the file. Returns false if no mers left, true otherwise. -*/ -SWIGINTERN VALUE -_wrap_ReadMerFile_next_mer(int argc, VALUE *argv, VALUE self) { - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ReadMerFile *","next_mer", 1, self )); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (bool)(arg1)->next_mer(); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::ReadMerFile.mer - - call-seq: - mer -> MerDNA - -Returns current mer. -*/ -SWIGINTERN VALUE -_wrap_ReadMerFile_mer(int argc, VALUE *argv, VALUE self) { - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - MerDNA *result = 0 ; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ReadMerFile const *","mer", 1, self )); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (MerDNA *)((ReadMerFile const *)arg1)->mer(); - vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::ReadMerFile.count - - call-seq: - count -> unsigned long - -Returns the count of the current mer. -*/ -SWIGINTERN VALUE -_wrap_ReadMerFile_count(int argc, VALUE *argv, VALUE self) { - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - unsigned long result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ReadMerFile const *","count", 1, self )); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - result = (unsigned long)((ReadMerFile const *)arg1)->count(); - vresult = SWIG_From_unsigned_SS_long(static_cast< unsigned long >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::ReadMerFile.each - - call-seq: - each - -Iterate through all the mers in the file, passing two values: a mer and its count. -*/ -SWIGINTERN VALUE -_wrap_ReadMerFile_each(int argc, VALUE *argv, VALUE self) { - ReadMerFile *arg1 = (ReadMerFile *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ReadMerFile *","each", 1, self )); - } - arg1 = reinterpret_cast< ReadMerFile * >(argp1); - (arg1)->each(); - return Qnil; -fail: - return Qnil; -} - - -SWIGINTERN void -free_ReadMerFile(ReadMerFile *arg1) { - delete arg1; -} - - -/* - Document-class: Jellyfish::HashCounter - - call-seq: - - -Read a Jellyfish database sequentially. -*/ -static swig_class SwigClassHashCounter; - - -/* - Document-method: Jellyfish::HashCounter.new - - call-seq: - - - -Read a Jellyfish database sequentially. -*/ -SWIGINTERN VALUE -_wrap_new_HashCounter__SWIG_0(int argc, VALUE *argv, VALUE self) { - size_t arg1 ; - unsigned int arg2 ; - unsigned int arg3 ; - size_t val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - unsigned int val3 ; - int ecode3 = 0 ; - HashCounter *result = 0 ; - - if ((argc < 3) || (argc > 3)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; - } - ecode1 = SWIG_AsVal_size_t(argv[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "size_t","HashCounter", 1, argv[0] )); - } - arg1 = static_cast< size_t >(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","HashCounter", 2, argv[1] )); - } - arg2 = static_cast< unsigned int >(val2); - ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "unsigned int","HashCounter", 3, argv[2] )); - } - arg3 = static_cast< unsigned int >(val3); - result = (HashCounter *)new HashCounter(arg1,arg2,arg3); - DATA_PTR(self) = result; - return self; -fail: - return Qnil; -} - - -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC -SWIGINTERN VALUE -_wrap_HashCounter_allocate(VALUE self) { -#else - SWIGINTERN VALUE - _wrap_HashCounter_allocate(int argc, VALUE *argv, VALUE self) { -#endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_HashCounter); -#ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); -#endif - return vresult; - } - - -SWIGINTERN VALUE -_wrap_new_HashCounter__SWIG_1(int argc, VALUE *argv, VALUE self) { - size_t arg1 ; - unsigned int arg2 ; - size_t val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - HashCounter *result = 0 ; - - if ((argc < 2) || (argc > 2)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; - } - ecode1 = SWIG_AsVal_size_t(argv[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "size_t","HashCounter", 1, argv[0] )); - } - arg1 = static_cast< size_t >(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","HashCounter", 2, argv[1] )); - } - arg2 = static_cast< unsigned int >(val2); - result = (HashCounter *)new HashCounter(arg1,arg2); - DATA_PTR(self) = result; - return self; -fail: - return Qnil; -} - - -SWIGINTERN VALUE _wrap_new_HashCounter(int nargs, VALUE *args, VALUE self) { - int argc; - VALUE argv[3]; - int ii; - - argc = nargs; - if (argc > 3) SWIG_fail; - for (ii = 0; (ii < argc); ++ii) { - argv[ii] = args[ii]; - } - if (argc == 2) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_HashCounter__SWIG_1(nargs, args, self); - } - } - } - if (argc == 3) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_HashCounter__SWIG_0(nargs, args, self); - } - } - } - } - -fail: - Ruby_Format_OverloadedError( argc, 3, "HashCounter.new", - " HashCounter.new(size_t size, unsigned int val_len, unsigned int nb_threads)\n" - " HashCounter.new(size_t size, unsigned int val_len)\n"); - - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashCounter.size - - call-seq: - size -> size_t - -Size or Length of the HashCounter. -*/ -SWIGINTERN VALUE -_wrap_HashCounter_size(int argc, VALUE *argv, VALUE self) { - HashCounter *arg1 = (HashCounter *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter const *","size", 1, self )); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - result = ((HashCounter const *)arg1)->size(); - vresult = SWIG_From_size_t(static_cast< size_t >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashCounter.val_len - - call-seq: - val_len -> unsigned int - -Read a Jellyfish database sequentially. -*/ -SWIGINTERN VALUE -_wrap_HashCounter_val_len(int argc, VALUE *argv, VALUE self) { - HashCounter *arg1 = (HashCounter *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - unsigned int result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter const *","val_len", 1, self )); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - result = (unsigned int)((HashCounter const *)arg1)->val_len(); - vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashCounter.add - - call-seq: - add(m, x) -> bool - -Read a Jellyfish database sequentially. -*/ -SWIGINTERN VALUE -_wrap_HashCounter_add(int argc, VALUE *argv, VALUE self) { - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - int *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int temp3 ; - int val3 ; - int ecode3 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 2) || (argc > 2)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter *","add", 1, self )); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","add", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","add", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - ecode3 = SWIG_AsVal_int(argv[1], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","add", 3, argv[1] )); - } - temp3 = static_cast< int >(val3); - arg3 = &temp3; - result = (bool)(arg1)->add((MerDNA const &)*arg2,(int const &)*arg3); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashCounter.update_add - - call-seq: - update_add(arg2, arg3) -> bool - -Read a Jellyfish database sequentially. -*/ -SWIGINTERN VALUE -_wrap_HashCounter_update_add(int argc, VALUE *argv, VALUE self) { - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - int *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - int temp3 ; - int val3 ; - int ecode3 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 2) || (argc > 2)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter *","update_add", 1, self )); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","update_add", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","update_add", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - ecode3 = SWIG_AsVal_int(argv[1], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","update_add", 3, argv[1] )); - } - temp3 = static_cast< int >(val3); - arg3 = &temp3; - result = (bool)(arg1)->update_add((MerDNA const &)*arg2,(int const &)*arg3); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashCounter.get - - call-seq: - get(m) - -Read a Jellyfish database sequentially. -*/ -SWIGINTERN VALUE -_wrap_HashCounter_get(int argc, VALUE *argv, VALUE self) { - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - std::pair< bool,uint64_t > *arg3 = (std::pair< bool,uint64_t > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - std::pair< bool,uint64_t > tmp3 ; - VALUE vresult = Qnil; - - { - arg3 = &tmp3; - } - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter const *","get", 1, self )); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","get", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","get", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - HashCounter_get((HashCounter const *)arg1,(MerDNA const &)*arg2,arg3); - { - if((arg3)->first) { - VALUE o = SWIG_From_unsigned_SS_long ((arg3)->second); - vresult = SWIG_Ruby_AppendOutput(vresult, o); - } else { - vresult = SWIG_Ruby_AppendOutput(vresult, Qnil); - } - } - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashCounter.[] - - call-seq: - [](m) - -Element accessor/slicing. -*/ -SWIGINTERN VALUE -_wrap_HashCounter___getitem__(int argc, VALUE *argv, VALUE self) { - HashCounter *arg1 = (HashCounter *) 0 ; - MerDNA *arg2 = 0 ; - std::pair< bool,uint64_t > *arg3 = (std::pair< bool,uint64_t > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - std::pair< bool,uint64_t > tmp3 ; - VALUE vresult = Qnil; - - { - arg3 = &tmp3; - } - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter const *","__getitem__", 1, self )); - } - arg1 = reinterpret_cast< HashCounter * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","__getitem__", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","__getitem__", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - HashCounter___getitem__((HashCounter const *)arg1,(MerDNA const &)*arg2,arg3); - { - if((arg3)->first) { - VALUE o = SWIG_From_unsigned_SS_long ((arg3)->second); - vresult = SWIG_Ruby_AppendOutput(vresult, o); - } else { - vresult = SWIG_Ruby_AppendOutput(vresult, Qnil); - } - } - return vresult; -fail: - return Qnil; -} - - -SWIGINTERN void -free_HashCounter(HashCounter *arg1) { - delete arg1; -} - - -/* - Document-class: Jellyfish::HashSet - - call-seq: - - -Read a Jellyfish database sequentially. -*/ -static swig_class SwigClassHashSet; - - -/* - Document-method: Jellyfish::HashSet.new - - call-seq: - - - -Read a Jellyfish database sequentially. -*/ -SWIGINTERN VALUE -_wrap_new_HashSet__SWIG_0(int argc, VALUE *argv, VALUE self) { - size_t arg1 ; - unsigned int arg2 ; - size_t val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - HashSet *result = 0 ; - - if ((argc < 2) || (argc > 2)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; - } - ecode1 = SWIG_AsVal_size_t(argv[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "size_t","HashSet", 1, argv[0] )); - } - arg1 = static_cast< size_t >(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","HashSet", 2, argv[1] )); - } - arg2 = static_cast< unsigned int >(val2); - result = (HashSet *)new HashSet(arg1,arg2); - DATA_PTR(self) = result; - return self; -fail: - return Qnil; -} - - -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC -SWIGINTERN VALUE -_wrap_HashSet_allocate(VALUE self) { -#else - SWIGINTERN VALUE - _wrap_HashSet_allocate(int argc, VALUE *argv, VALUE self) { -#endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_HashSet); -#ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); -#endif - return vresult; - } - - -SWIGINTERN VALUE -_wrap_new_HashSet__SWIG_1(int argc, VALUE *argv, VALUE self) { - size_t arg1 ; - size_t val1 ; - int ecode1 = 0 ; - HashSet *result = 0 ; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - ecode1 = SWIG_AsVal_size_t(argv[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "size_t","HashSet", 1, argv[0] )); - } - arg1 = static_cast< size_t >(val1); - result = (HashSet *)new HashSet(arg1); - DATA_PTR(self) = result; - return self; -fail: - return Qnil; -} - - -SWIGINTERN VALUE _wrap_new_HashSet(int nargs, VALUE *args, VALUE self) { - int argc; - VALUE argv[2]; - int ii; - - argc = nargs; - if (argc > 2) SWIG_fail; - for (ii = 0; (ii < argc); ++ii) { - argv[ii] = args[ii]; - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_HashSet__SWIG_1(nargs, args, self); - } - } - if (argc == 2) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_HashSet__SWIG_0(nargs, args, self); - } - } - } - -fail: - Ruby_Format_OverloadedError( argc, 2, "HashSet.new", - " HashSet.new(size_t size, unsigned int nb_threads)\n" - " HashSet.new(size_t size)\n"); - - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashSet.size - - call-seq: - size -> size_t - -Size or Length of the HashSet. -*/ -SWIGINTERN VALUE -_wrap_HashSet_size(int argc, VALUE *argv, VALUE self) { - HashSet *arg1 = (HashSet *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashSet const *","size", 1, self )); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - result = ((HashSet const *)arg1)->size(); - vresult = SWIG_From_size_t(static_cast< size_t >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashSet.add - - call-seq: - add(m) -> bool - -Read a Jellyfish database sequentially. -*/ -SWIGINTERN VALUE -_wrap_HashSet_add(int argc, VALUE *argv, VALUE self) { - HashSet *arg1 = (HashSet *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashSet *","add", 1, self )); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","add", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","add", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)(arg1)->add((MerDNA const &)*arg2); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashSet.get - - call-seq: - get(m) -> bool - -Read a Jellyfish database sequentially. -*/ -SWIGINTERN VALUE -_wrap_HashSet_get(int argc, VALUE *argv, VALUE self) { - HashSet *arg1 = (HashSet *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashSet const *","get", 1, self )); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","get", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","get", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)HashSet_get((HashSet const *)arg1,(MerDNA const &)*arg2); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::HashSet.[] - - call-seq: - [](m) -> bool - -Element accessor/slicing. -*/ -SWIGINTERN VALUE -_wrap_HashSet___getitem__(int argc, VALUE *argv, VALUE self) { - HashSet *arg1 = (HashSet *) 0 ; - MerDNA *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashSet, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashSet const *","__getitem__", 1, self )); - } - arg1 = reinterpret_cast< HashSet * >(argp1); - res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","__getitem__", 2, argv[0] )); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","__getitem__", 2, argv[0])); - } - arg2 = reinterpret_cast< MerDNA * >(argp2); - result = (bool)HashSet___getitem__((HashSet const *)arg1,(MerDNA const &)*arg2); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - -SWIGINTERN void -free_HashSet(HashSet *arg1) { - delete arg1; -} - - -/* - Document-method: Jellyfish.string_mers - - call-seq: - string_mers(str) -> StringMers - -Get an iterator to the mers in the string. -*/ -SWIGINTERN VALUE -_wrap_string_mers(int argc, VALUE *argv, VALUE self) { - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - size_t size1 = 0 ; - int alloc1 = 0 ; - StringMers *result = 0 ; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, &size1, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char *","string_mers", 1, argv[0] )); - } - arg1 = reinterpret_cast< char * >(buf1); - arg2 = static_cast< int >(size1 - 1); - result = (StringMers *)string_mers(arg1,arg2); - vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_POINTER_OWN | 0 ); - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return vresult; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return Qnil; -} - - - -/* - Document-method: Jellyfish.string_canonicals - - call-seq: - string_canonicals(str) -> StringMers - -Get an iterator to the canonical mers in the string. -*/ -SWIGINTERN VALUE -_wrap_string_canonicals(int argc, VALUE *argv, VALUE self) { - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - size_t size1 = 0 ; - int alloc1 = 0 ; - StringMers *result = 0 ; - VALUE vresult = Qnil; - - if ((argc < 1) || (argc > 1)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; - } - res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, &size1, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char *","string_canonicals", 1, argv[0] )); - } - arg1 = reinterpret_cast< char * >(buf1); - arg2 = static_cast< int >(size1 - 1); - result = (StringMers *)string_canonicals(arg1,arg2); - vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_POINTER_OWN | 0 ); - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return vresult; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return Qnil; -} - - - -/* - Document-class: Jellyfish::StringMers - - call-seq: - - -Extract k-mers from a sequence string. -*/ -static swig_class SwigClassStringMers; - -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC -SWIGINTERN VALUE -_wrap_StringMers_allocate(VALUE self) { -#else - SWIGINTERN VALUE - _wrap_StringMers_allocate(int argc, VALUE *argv, VALUE self) { -#endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_StringMers); -#ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); -#endif - return vresult; - } - - - -/* - Document-method: Jellyfish::StringMers.new - - call-seq: - - -Create a k-mers parser from a string. Pass true as a second argument to get canonical mers. -*/ -SWIGINTERN VALUE -_wrap_new_StringMers(int argc, VALUE *argv, VALUE self) { - char *arg1 = (char *) 0 ; - int arg2 ; - bool arg3 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; - bool val3 ; - int ecode3 = 0 ; - StringMers *result = 0 ; - - if ((argc < 3) || (argc > 3)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; - } - res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","StringMers", 1, argv[0] )); - } - arg1 = reinterpret_cast< char * >(buf1); - ecode2 = SWIG_AsVal_int(argv[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","StringMers", 2, argv[1] )); - } - arg2 = static_cast< int >(val2); - ecode3 = SWIG_AsVal_bool(argv[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","StringMers", 3, argv[2] )); - } - arg3 = static_cast< bool >(val3); - result = (StringMers *)new StringMers((char const *)arg1,arg2,arg3); - DATA_PTR(self) = result; - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return self; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return Qnil; -} - - - -/* - Document-method: Jellyfish::StringMers.next_mer - - call-seq: - next_mer -> bool - -Get the next mer. Return false if reached the end of the string.. -*/ -SWIGINTERN VALUE -_wrap_StringMers_next_mer(int argc, VALUE *argv, VALUE self) { - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - bool result; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "StringMers *","next_mer", 1, self )); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - result = (bool)(arg1)->next_mer(); - vresult = SWIG_From_bool(static_cast< bool >(result)); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::StringMers.mer - - call-seq: - mer -> MerDNA - -Return the current mer (or its canonical representation). -*/ -SWIGINTERN VALUE -_wrap_StringMers_mer(int argc, VALUE *argv, VALUE self) { - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - MerDNA *result = 0 ; - VALUE vresult = Qnil; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "StringMers const *","mer", 1, self )); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - result = (MerDNA *)((StringMers const *)arg1)->mer(); - vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 ); - return vresult; -fail: - return Qnil; -} - - - -/* - Document-method: Jellyfish::StringMers.each - - call-seq: - each - -Iterate through all the mers in the string. -*/ -SWIGINTERN VALUE -_wrap_StringMers_each(int argc, VALUE *argv, VALUE self) { - StringMers *arg1 = (StringMers *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((argc < 0) || (argc > 0)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; - } - res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_StringMers, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "StringMers *","each", 1, self )); - } - arg1 = reinterpret_cast< StringMers * >(argp1); - (arg1)->each(); - return Qnil; -fail: - return Qnil; -} - - -SWIGINTERN void -free_StringMers(StringMers *arg1) { - delete arg1; -} - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ - -static swig_type_info _swigt__p_HashCounter = {"_p_HashCounter", "HashCounter *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_HashSet = {"_p_HashSet", "HashSet *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_MerDNA = {"_p_MerDNA", "MerDNA *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_QueryMerFile = {"_p_QueryMerFile", "QueryMerFile *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_ReadMerFile = {"_p_ReadMerFile", "ReadMerFile *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_StringMers = {"_p_StringMers", "StringMers *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__pairT_bool_uint64_t_t = {"_p_std__pairT_bool_uint64_t_t", "std::pair< bool,uint64_t > *", 0, 0, (void*)0, 0}; - -static swig_type_info *swig_type_initial[] = { - &_swigt__p_HashCounter, - &_swigt__p_HashSet, - &_swigt__p_MerDNA, - &_swigt__p_QueryMerFile, - &_swigt__p_ReadMerFile, - &_swigt__p_StringMers, - &_swigt__p_char, - &_swigt__p_std__pairT_bool_uint64_t_t, -}; - -static swig_cast_info _swigc__p_HashCounter[] = { {&_swigt__p_HashCounter, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_HashSet[] = { {&_swigt__p_HashSet, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_MerDNA[] = { {&_swigt__p_MerDNA, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_QueryMerFile[] = { {&_swigt__p_QueryMerFile, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_ReadMerFile[] = { {&_swigt__p_ReadMerFile, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_StringMers[] = { {&_swigt__p_StringMers, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__pairT_bool_uint64_t_t[] = { {&_swigt__p_std__pairT_bool_uint64_t_t, 0, 0, 0},{0, 0, 0, 0}}; - -static swig_cast_info *swig_cast_initial[] = { - _swigc__p_HashCounter, - _swigc__p_HashSet, - _swigc__p_MerDNA, - _swigc__p_QueryMerFile, - _swigc__p_ReadMerFile, - _swigc__p_StringMers, - _swigc__p_char, - _swigc__p_std__pairT_bool_uint64_t_t, -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ - -/* ----------------------------------------------------------------------------- - * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to - * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of - * swig_module, and does all the lookup, filling in the swig_module.types - * array with the correct data and linking the correct swig_cast_info - * structures together. - * - * The generated swig_type_info structures are assigned statically to an initial - * array. We just loop through that array, and handle each type individually. - * First we lookup if this type has been already loaded, and if so, use the - * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a - * two-dimensional array. Each row corresponds to a type (there are the same - * number of rows as there are in the swig_type_initial array). Each entry in - * a column is one of the swig_cast_info structures for that type. - * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. - * - * First off, we lookup the cast->type name to see if it is already loaded. - * There are three cases to handle: - * 1) If the cast->type has already been loaded AND the type we are adding - * casting info to has not been loaded (it is in this module), THEN we - * replace the cast->type pointer with the type pointer that has already - * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the - * cast->type) are loaded, THEN the cast info has already been loaded by - * the previous module so we just ignore it. - * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will - * be correct. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* c-mode */ -#endif -#endif - -#if 0 -#define SWIGRUNTIME_DEBUG -#endif - - -SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { - size_t i; - swig_module_info *module_head, *iter; - int found, init; - - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - init = 1; - } else { - init = 0; - } - - /* Try and load any already created modules */ - module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; - iter=module_head; - do { - if (iter==&swig_module) { - found=1; - break; - } - iter=iter->next; - } while (iter!= module_head); - - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ - swig_module.next = module_head->next; - module_head->next = &swig_module; - } - - /* When multiple interpreters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - - /* Now work on filling in swig_module.types */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %d\n", swig_module.size); -#endif - for (i = 0; i < swig_module.size; ++i) { - swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; - -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); -#endif - - /* if there is another module already loaded */ - if (swig_module.next != &swig_module) { - type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); - } - if (type) { - /* Overwrite clientdata field */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found type %s\n", type->name); -#endif - if (swig_module.type_initial[i]->clientdata) { - type->clientdata = swig_module.type_initial[i]->clientdata; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); -#endif - } - } else { - type = swig_module.type_initial[i]; - } - - /* Insert casting types */ - cast = swig_module.cast_initial[i]; - while (cast->type) { - - /* Don't need to add information already in the list */ - ret = 0; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); -#endif - if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); -#ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); -#endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); -#endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); -#ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); -#endif - if (!ocast) ret = 0; - } - } - - if (!ret) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); -#endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; - } - type->cast = cast; - } - cast++; - } - /* Set entry in modules->types array equal to the type */ - swig_module.types[i] = type; - } - swig_module.types[i] = 0; - -#ifdef SWIGRUNTIME_DEBUG - printf("**** SWIG_InitializeModule: Cast List ******\n"); - for (i = 0; i < swig_module.size; ++i) { - int j = 0; - swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); - while (cast->type) { - printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); - cast++; - ++j; - } - printf("---- Total casts: %d\n",j); - } - printf("**** SWIG_InitializeModule: Cast List ******\n"); -#endif -} - -/* This function will propagate the clientdata field of type to -* any new swig_type_info structures that have been added into the list -* of equivalent types. It is like calling -* SWIG_TypeClientData(type, clientdata) a second time. -*/ -SWIGRUNTIME void -SWIG_PropagateClientData(void) { - size_t i; - swig_cast_info *equiv; - static int init_run = 0; - - if (init_run) return; - init_run = 1; - - for (i = 0; i < swig_module.size; i++) { - if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); - } - equiv = equiv->next; - } - } - } -} - -#ifdef __cplusplus -#if 0 -{ /* c-mode */ -#endif -} -#endif - -/* - -*/ -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT void Init_jellyfish(void) { - size_t i; - - SWIG_InitRuntime(); - mJellyfish = rb_define_module("Jellyfish"); - - SWIG_InitializeModule(0); - for (i = 0; i < swig_module.size; i++) { - SWIG_define_class(swig_module.types[i]); - } - - SWIG_RubyInitializeTrackings(); - - SwigClassMerDNA.klass = rb_define_class_under(mJellyfish, "MerDNA", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_MerDNA, (void *) &SwigClassMerDNA); - rb_define_alloc_func(SwigClassMerDNA.klass, _wrap_MerDNA_allocate); - rb_define_method(SwigClassMerDNA.klass, "initialize", VALUEFUNC(_wrap_new_MerDNA), -1); - rb_define_singleton_method(SwigClassMerDNA.klass, "k", VALUEFUNC(_wrap_MerDNA_k), -1); - rb_define_method(SwigClassMerDNA.klass, "polyA!", VALUEFUNC(_wrap_MerDNA_polyAN___), -1); - rb_define_method(SwigClassMerDNA.klass, "polyC!", VALUEFUNC(_wrap_MerDNA_polyCN___), -1); - rb_define_method(SwigClassMerDNA.klass, "polyG!", VALUEFUNC(_wrap_MerDNA_polyGN___), -1); - rb_define_method(SwigClassMerDNA.klass, "polyT!", VALUEFUNC(_wrap_MerDNA_polyTN___), -1); - rb_define_method(SwigClassMerDNA.klass, "randomize!", VALUEFUNC(_wrap_MerDNA_randomizeN___), -1); - rb_define_method(SwigClassMerDNA.klass, "is_homopolymer", VALUEFUNC(_wrap_MerDNA_is_homopolymer), -1); - rb_define_method(SwigClassMerDNA.klass, "shift_left", VALUEFUNC(_wrap_MerDNA_shift_left), -1); - rb_define_method(SwigClassMerDNA.klass, "shift_right", VALUEFUNC(_wrap_MerDNA_shift_right), -1); - rb_define_method(SwigClassMerDNA.klass, "canonicalize!", VALUEFUNC(_wrap_MerDNA_canonicalizeN___), -1); - rb_define_method(SwigClassMerDNA.klass, "reverse_complement!", VALUEFUNC(_wrap_MerDNA_reverse_complementN___), -1); - rb_define_method(SwigClassMerDNA.klass, "get_canonical", VALUEFUNC(_wrap_MerDNA_get_canonical), -1); - rb_define_method(SwigClassMerDNA.klass, "get_reverse_complement", VALUEFUNC(_wrap_MerDNA_get_reverse_complement), -1); - rb_define_method(SwigClassMerDNA.klass, "==", VALUEFUNC(_wrap_MerDNA___eq__), -1); - rb_define_method(SwigClassMerDNA.klass, "<", VALUEFUNC(_wrap_MerDNA___lt__), -1); - rb_define_method(SwigClassMerDNA.klass, ">", VALUEFUNC(_wrap_MerDNA___gt__), -1); - rb_define_method(SwigClassMerDNA.klass, "dup", VALUEFUNC(_wrap_MerDNA_dup), -1); - rb_define_method(SwigClassMerDNA.klass, "to_s", VALUEFUNC(_wrap_MerDNA___str__), -1); - rb_define_method(SwigClassMerDNA.klass, "set", VALUEFUNC(_wrap_MerDNA_set), -1); - rb_define_method(SwigClassMerDNA.klass, "[]", VALUEFUNC(_wrap_MerDNA___getitem__), -1); - rb_define_method(SwigClassMerDNA.klass, "[]=", VALUEFUNC(_wrap_MerDNA___setitem__), -1); - rb_define_method(SwigClassMerDNA.klass, "<<", VALUEFUNC(_wrap_MerDNA___lshift__), -1); - rb_define_method(SwigClassMerDNA.klass, ">>", VALUEFUNC(_wrap_MerDNA___rshift__), -1); - SwigClassMerDNA.mark = 0; - SwigClassMerDNA.destroy = (void (*)(void *)) free_MerDNA; - SwigClassMerDNA.trackObjects = 0; - - SwigClassQueryMerFile.klass = rb_define_class_under(mJellyfish, "QueryMerFile", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_QueryMerFile, (void *) &SwigClassQueryMerFile); - rb_define_alloc_func(SwigClassQueryMerFile.klass, _wrap_QueryMerFile_allocate); - rb_define_method(SwigClassQueryMerFile.klass, "initialize", VALUEFUNC(_wrap_new_QueryMerFile), -1); - rb_define_method(SwigClassQueryMerFile.klass, "[]", VALUEFUNC(_wrap_QueryMerFile___getitem__), -1); - SwigClassQueryMerFile.mark = 0; - SwigClassQueryMerFile.destroy = (void (*)(void *)) free_QueryMerFile; - SwigClassQueryMerFile.trackObjects = 0; - - SwigClassReadMerFile.klass = rb_define_class_under(mJellyfish, "ReadMerFile", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_ReadMerFile, (void *) &SwigClassReadMerFile); - rb_include_module(SwigClassReadMerFile.klass, rb_eval_string("Enumerable")); - rb_define_alloc_func(SwigClassReadMerFile.klass, _wrap_ReadMerFile_allocate); - rb_define_method(SwigClassReadMerFile.klass, "initialize", VALUEFUNC(_wrap_new_ReadMerFile), -1); - rb_define_method(SwigClassReadMerFile.klass, "next_mer", VALUEFUNC(_wrap_ReadMerFile_next_mer), -1); - rb_define_method(SwigClassReadMerFile.klass, "mer", VALUEFUNC(_wrap_ReadMerFile_mer), -1); - rb_define_method(SwigClassReadMerFile.klass, "count", VALUEFUNC(_wrap_ReadMerFile_count), -1); - rb_define_method(SwigClassReadMerFile.klass, "each", VALUEFUNC(_wrap_ReadMerFile_each), -1); - SwigClassReadMerFile.mark = 0; - SwigClassReadMerFile.destroy = (void (*)(void *)) free_ReadMerFile; - SwigClassReadMerFile.trackObjects = 0; - - SwigClassHashCounter.klass = rb_define_class_under(mJellyfish, "HashCounter", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_HashCounter, (void *) &SwigClassHashCounter); - rb_define_alloc_func(SwigClassHashCounter.klass, _wrap_HashCounter_allocate); - rb_define_method(SwigClassHashCounter.klass, "initialize", VALUEFUNC(_wrap_new_HashCounter), -1); - rb_define_method(SwigClassHashCounter.klass, "size", VALUEFUNC(_wrap_HashCounter_size), -1); - rb_define_method(SwigClassHashCounter.klass, "val_len", VALUEFUNC(_wrap_HashCounter_val_len), -1); - rb_define_method(SwigClassHashCounter.klass, "add", VALUEFUNC(_wrap_HashCounter_add), -1); - rb_define_method(SwigClassHashCounter.klass, "update_add", VALUEFUNC(_wrap_HashCounter_update_add), -1); - rb_define_method(SwigClassHashCounter.klass, "get", VALUEFUNC(_wrap_HashCounter_get), -1); - rb_define_method(SwigClassHashCounter.klass, "[]", VALUEFUNC(_wrap_HashCounter___getitem__), -1); - SwigClassHashCounter.mark = 0; - SwigClassHashCounter.destroy = (void (*)(void *)) free_HashCounter; - SwigClassHashCounter.trackObjects = 0; - - SwigClassHashSet.klass = rb_define_class_under(mJellyfish, "HashSet", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_HashSet, (void *) &SwigClassHashSet); - rb_define_alloc_func(SwigClassHashSet.klass, _wrap_HashSet_allocate); - rb_define_method(SwigClassHashSet.klass, "initialize", VALUEFUNC(_wrap_new_HashSet), -1); - rb_define_method(SwigClassHashSet.klass, "size", VALUEFUNC(_wrap_HashSet_size), -1); - rb_define_method(SwigClassHashSet.klass, "add", VALUEFUNC(_wrap_HashSet_add), -1); - rb_define_method(SwigClassHashSet.klass, "get", VALUEFUNC(_wrap_HashSet_get), -1); - rb_define_method(SwigClassHashSet.klass, "[]", VALUEFUNC(_wrap_HashSet___getitem__), -1); - SwigClassHashSet.mark = 0; - SwigClassHashSet.destroy = (void (*)(void *)) free_HashSet; - SwigClassHashSet.trackObjects = 0; - rb_define_module_function(mJellyfish, "string_mers", VALUEFUNC(_wrap_string_mers), -1); - rb_define_module_function(mJellyfish, "string_canonicals", VALUEFUNC(_wrap_string_canonicals), -1); - - rb_eval_string("class String\n" - " def mers(&b); it = Jellyfish::string_mers(self); b ? it.each(&b) : it; end\n" - " def canonicals(&b); it = Jellyfish::string_canonicals(self, &b); b ? it.each(&b) : it; end\n" - "end"); - - - SwigClassStringMers.klass = rb_define_class_under(mJellyfish, "StringMers", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_StringMers, (void *) &SwigClassStringMers); - rb_include_module(SwigClassStringMers.klass, rb_eval_string("Enumerable")); - rb_define_alloc_func(SwigClassStringMers.klass, _wrap_StringMers_allocate); - rb_define_method(SwigClassStringMers.klass, "initialize", VALUEFUNC(_wrap_new_StringMers), -1); - rb_define_method(SwigClassStringMers.klass, "next_mer", VALUEFUNC(_wrap_StringMers_next_mer), -1); - rb_define_method(SwigClassStringMers.klass, "mer", VALUEFUNC(_wrap_StringMers_mer), -1); - rb_define_method(SwigClassStringMers.klass, "each", VALUEFUNC(_wrap_StringMers_each), -1); - SwigClassStringMers.mark = 0; - SwigClassStringMers.destroy = (void (*)(void *)) free_StringMers; - SwigClassStringMers.trackObjects = 0; -} - diff --git a/src/modifiedJellyfish/swig/string_mers.i b/src/modifiedJellyfish/swig/string_mers.i deleted file mode 100644 index 064ee064..00000000 --- a/src/modifiedJellyfish/swig/string_mers.i +++ /dev/null @@ -1,143 +0,0 @@ -/****************************************/ -/* Iterator of all the mers in a string */ -/****************************************/ -#ifdef SWIGPYTHON -%exception __next__ { - $action; - if(!result) { - PyErr_SetString(PyExc_StopIteration, "Done"); - SWIG_fail; - } - } -%exception next { - $action; - if(!result) { - PyErr_SetString(PyExc_StopIteration, "Done"); - SWIG_fail; - } - } -#endif - -%{ - class StringMers { - const char* m_current; - const char* const m_last; - const bool m_canonical; - MerDNA m_m, m_rcm; - unsigned int m_filled; - - public: - StringMers(const char* str, int len, bool canonical) - : m_current(str) - , m_last(str + len) - , m_canonical(canonical) - , m_filled(0) - { } - - bool next_mer() { - if(m_current == m_last) - return false; - - do { - int code = jellyfish::mer_dna::code(*m_current); - ++m_current; - if(code >= 0) { - m_m.shift_left(code); - if(m_canonical) - m_rcm.shift_right(m_rcm.complement(code)); - m_filled = std::min(m_filled + 1, m_m.k()); - } else - m_filled = 0; - } while(m_filled < m_m.k() && m_current != m_last); - return m_filled == m_m.k(); - } - - const MerDNA* mer() const { return !m_canonical || m_m < m_rcm ? &m_m : &m_rcm; } - - const MerDNA* next_mer__() { - return next_mer() ? mer() : nullptr; - } - - -#ifdef SWIGRUBY - void each() { - if(!rb_block_given_p()) return; - while(next_mer()) { - auto m = SWIG_NewPointerObj(const_cast(mer()), SWIGTYPE_p_MerDNA, 0); - rb_yield(m); - } - } -#endif - -#ifdef SWIGPYTHON - StringMers* __iter__() { return this; } - const MerDNA* __next__() { return next_mer__(); } - const MerDNA* next() { return next_mer__(); } -#endif - -#ifdef SWIGPERL - const MerDNA* each() { return next_mer__(); } -#endif - - }; - - StringMers* string_mers(char* str, int length) { return new StringMers(str, length, false); } - StringMers* string_canonicals(char* str, int length) { return new StringMers(str, length, true); } -%} - -%apply (char *STRING, int LENGTH) { (char* str, int length) }; -%newobject string_mers; -%newobject string_canonicals; -%feature("autodoc", "Get an iterator to the mers in the string"); -StringMers* string_mers(char* str, int length); -%feature("autodoc", "Get an iterator to the canonical mers in the string"); -StringMers* string_canonicals(char* str, int length); - -#ifdef SWIGRUBY -%mixin StringMers "Enumerable"; -%init %{ - rb_eval_string("class String\n" - " def mers(&b); it = Jellyfish::string_mers(self); b ? it.each(&b) : it; end\n" - " def canonicals(&b); it = Jellyfish::string_canonicals(self, &b); b ? it.each(&b) : it; end\n" - "end"); -%} -#endif - -/* #ifdef SWIGPERL */ -/* // For perl, return an empty array at end of iterator */ -/* %typemap(out) const MerDNA* { */ -/* if($1) { */ -/* SWIG_Object m = SWIG_NewPointerObj(const_cast($1), SWIGTYPE_p_MerDNA, 0); */ -/* %append_output(m); */ -/* } */ -/* } */ -/* #endif */ - - -%feature("autodoc", "Extract k-mers from a sequence string"); -class StringMers { -public: - %feature("autodoc", "Create a k-mers parser from a string. Pass true as a second argument to get canonical mers"); - StringMers(const char* str, int len, bool canonical); - - %feature("autodoc", "Get the next mer. Return false if reached the end of the string."); - bool next_mer(); - - %feature("autodoc", "Return the current mer (or its canonical representation)"); - const MerDNA* mer() const; - -#ifdef SWIGRUBY - %feature("autodoc", "Iterate through all the mers in the string"); - void each(); -#endif - -#ifdef SWIGPYTHON - StringMers* __iter__(); - const MerDNA* __next__(); - const MerDNA* next(); -#endif - -#ifdef SWIGPERL - MerDNA* each(); -#endif -}; diff --git a/ten_shards_100_regions.tsv b/ten_shards_100_regions.tsv new file mode 120000 index 00000000..e0347cc1 --- /dev/null +++ b/ten_shards_100_regions.tsv @@ -0,0 +1 @@ +/mnt/run_dir/region_files/ten_shards_100_regions.tsv \ No newline at end of file diff --git a/testRun/Child.bam b/testRun/Child.bam deleted file mode 100644 index fb1a2b58..00000000 Binary files a/testRun/Child.bam and /dev/null differ diff --git a/testRun/Child.mate1.fastq b/testRun/Child.mate1.fastq deleted file mode 100644 index 19d2557f..00000000 --- a/testRun/Child.mate1.fastq +++ /dev/null @@ -1,8716 +0,0 @@ -@E00271:189:HT3C3CCXX:1:1101:23835:7691 -GTGCCCAGCACACGCTTCCAAGACGCTGTCCTTAAGGAGATTATAGCCAGGTCAGGTAAGAAAACATAAAACATCTTTTAAAATTAGTGTCAATCCAAAAGCTGTCACAAGGGACCATGTCTTATAAAATATATACAAAAATAGGAGTCCC -+ -A assembly -> interpret -> VCF. +# +# Run directly: bash f1_trio_denovo.sh +# Or submit: sbatch f1_trio_denovo.sh +#SBATCH --account=marth-rw +#SBATCH --partition=marth-rw +#SBATCH --job-name=rufus_f1_trio +#SBATCH --nodes=1 +#SBATCH --cpus-per-task=8 +#SBATCH --mem=32G +#SBATCH --time=01:00:00 +#SBATCH --output=%x_%j.out +#SBATCH --error=%x_%j.err +set -euo pipefail + +# sbatch copies this script to the spool dir, so BASH_SOURCE-derived paths break. See F4. +HERE="${FUNCTIONAL_CASES_DIR:-${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}}" +FIX="$(cd "$HERE/../fixtures" 2>/dev/null && pwd)" || { + echo "ERROR: cannot locate fixtures from HERE=$HERE"; exit 1; } +DATA=/uufs/chpc.utah.edu/common/HIPAA/u0746015/marth_software/RUFUS/resources/reg_test_files +SIF=${SIF:-$DATA/rufus_dev.sif} +OUT=${OUT:-$DATA/runs/f1_trio} +THREADS=${SLURM_CPUS_PER_TASK:-8} +WINDOW=10 # positional tolerance: RUFUS may left-align / represent an MNV or INS differently + +# Dev-loop overlay: bind local file(s) over the container to validate a fix BEFORE rebuilding the +# image and round-tripping through CI. Same pattern as editing files mounted over the container. +# EXTRA_BIND=/path/to/repo/scripts/Foo.pl:/opt/RUFUS/scripts/Foo.pl sbatch f1_trio_denovo.sh +EXTRA_BIND=${EXTRA_BIND:-} + +REF=$FIX/ref/tiny.fa +CHILD=$FIX/trio/child.bam +MOM=$FIX/trio/mother.bam +DAD=$FIX/trio/father.bam +DENOVO=$FIX/designed/denovo.vcf # expected TO be called +GERMLINE=$FIX/designed/germline.vcf # expected NOT to be called + +rm -rf "$OUT"; mkdir -p "$OUT"; cd "$OUT" +module load apptainer 2>/dev/null || true +command -v apptainer >/dev/null || { echo "ERROR: apptainer unavailable"; exit 1; } +[ -f "$SIF" ] || { echo "ERROR: SIF not found: $SIF"; exit 1; } +for f in "$REF" "$CHILD" "$MOM" "$DAD" "$DENOVO" "$GERMLINE"; do + [ -f "$f" ] || { echo "ERROR: fixture missing: $f (run make_fixtures.sh)"; exit 1; } +done + +echo "=== F1 trio de novo | $(date) ===" +echo " subject : child.bam (germline HOM + de novo HET)" +echo " controls : mother.bam, father.bam" +echo " expect : $(grep -vc '^#' "$DENOVO") de novo CALLED, $(grep -vc '^#' "$GERMLINE") germline NOT called" +echo + +BINDS="$FIX,$OUT,$DATA" +if [ -n "$EXTRA_BIND" ]; then + BINDS="$BINDS,$EXTRA_BIND" + echo " OVERLAY : $EXTRA_BIND (testing an uncommitted local fix)" + echo +fi + +set +e +apptainer exec --bind "$BINDS" "$SIF" \ + bash /opt/RUFUS/runRufus.sh \ + -s "$CHILD" -c "$MOM" -c "$DAD" -r "$REF" \ + -k 25 -L -m 5 -R chr20 -t "$THREADS" -z + # -L is REQUIRED here and is the shipped default (setup_slurm hardcodes `-k 25 -L -vs`). + # RUFUS labels these de novo calls X-Mosaic/5I-Mosaic/3X-Mosaic; without -L the post-filter + # VilterAutosomeOnly.withoutMosaic strips every one of them and the VCF comes back empty + # even though RUFUS.interpret found all three at the correct positions. +RC=$? +set -e +echo "runRufus exit: $RC" + +STATUS=$(cat "$OUT/region_status.log" 2>/dev/null || echo "") +echo "region_status: $STATUS" +WORK="$OUT/rufus_chr20" +fail() { echo "RESULT: FAIL — $*"; exit 1; } + +# ---- preconditions: prove the pipeline actually ran on ALL THREE samples ---- +echo "-- preconditions --" +for s in child mother father; do + JH="$WORK/$s.bam.chr20.generator.Jhash"; HI="$JH.histo" + [ -s "$JH" ] || fail "$s: Jhash missing/empty — jellyfish did not run (OOM signature)" + [ -s "$HI" ] || fail "$s: histo missing/empty" + TOT=$(awk '{s+=$2} END{print s+0}' "$HI") + [ "$TOT" -ge 100000 ] || fail "$s: only $TOT distinct kmers — counting did not really run" + MODE=$(awk 'BEGIN{m=-1;c=0} {if($2+0>m){m=$2+0;c=$1+0}} END{print c}' "$HI") + echo " $s: distinct=$TOT modal_depth=$MODE OK" +done + +# ---- collect calls ---- +VCF=$(ls "$OUT"/temp.RUFUS.Final.*.vcf.gz "$OUT"/RUFUS.Final.*.vcf.gz 2>/dev/null | head -1 || true) +[ -n "$VCF" ] || fail "no VCF emitted (status: $STATUS) — expected de novo calls" +CALLS=$OUT/calls.tsv +zcat "$VCF" | awk -F'\t' '!/^#/ {print $1"\t"$2"\t"$4"\t"$5}' > "$CALLS" +NCALL=$(wc -l < "$CALLS") +echo "-- calls: $NCALL total (VCF: $(basename "$VCF")) --" + +# helper: is there a call within +-WINDOW of position $1 ? +called_near() { awk -F'\t' -v p="$1" -v w="$WINDOW" '$2>=p-w && $2<=p+w {f=1} END{exit !f}' "$CALLS"; } + +# ---- RECALL: every de novo must be called ---- +echo "-- recall (de novo, must be CALLED) --" +MISS=0 +while IFS=$'\t' read -r _c pos _i ref alt _rest; do + if called_near "$pos"; then + echo " de novo @$pos ($ref>$alt) CALLED" + else + echo " de novo @$pos ($ref>$alt) *** MISSED ***"; MISS=$((MISS+1)) + fi +done < <(grep -v '^#' "$DENOVO") + +# ---- SPECIFICITY: no germline may be called ---- +echo "-- specificity (germline, must NOT be called) --" +FP=0 +while IFS=$'\t' read -r _c pos _i ref alt _rest; do + if called_near "$pos"; then + echo " germline @$pos ($ref>$alt) *** FALSELY CALLED ***"; FP=$((FP+1)) + else + echo " germline @$pos ($ref>$alt) correctly absent" + fi +done < <(grep -v '^#' "$GERMLINE") + +# ---- PRECISION: every call must be attributable to a planted de novo locus ---- +# NB: record count > planted count is EXPECTED and fine — bcftools norm atomizes a planted MNV +# into one record per base (ATC>CGA becomes A>C, T>G, C>A sharing one ID). What must not happen +# is a call landing somewhere we planted nothing. +echo "-- precision (no calls outside a planted locus) --" +UNEXP=0 +while IFS=$'\t' read -r _c pos _r _a; do + ok=0 + while read -r dp; do + if [ "$pos" -ge $((dp-WINDOW)) ] && [ "$pos" -le $((dp+WINDOW)) ]; then ok=1; break; fi + done < <(grep -v '^#' "$DENOVO" | cut -f2) + if [ "$ok" -eq 0 ]; then echo " *** UNEXPECTED call @$pos ***"; UNEXP=$((UNEXP+1)); fi +done < "$CALLS" +[ "$UNEXP" -eq 0 ] && echo " all $NCALL call(s) map to a planted locus OK" + +NDN=$(grep -vc '^#' "$DENOVO") +echo +echo "-- summary --" +echo " unexpected calls : $UNEXP" +echo " de novo recalled : $((NDN-MISS))/$NDN" +echo " germline leaked : $FP" +echo " total calls : $NCALL" + +[ "$MISS" -eq 0 ] || fail "$MISS de novo variant(s) missed" +[ "$FP" -eq 0 ] || fail "$FP germline variant(s) leaked into the call set" +[ "$UNEXP" -eq 0 ] || fail "$UNEXP call(s) at loci where nothing was planted (false positives)" +echo "RESULT: PASS — all $NDN de novo called, no germline leaked" +exit 0 diff --git a/tests/functional/cases/f2_somatic.sh b/tests/functional/cases/f2_somatic.sh new file mode 100644 index 00000000..fa975511 --- /dev/null +++ b/tests/functional/cases/f2_somatic.sh @@ -0,0 +1,164 @@ +#!/bin/bash +# F2 — TUMOR/NORMAL SOMATIC (single-control path; the COLO829-shaped test on fixtures). +# +# tumor = germline background + somatic variants (somatic HET ~0.5, germline HOM) +# normal = germline background only +# +# Two assertions: +# RECALL every planted SOMATIC variant must be CALLED (incl. the 1kb deletion — the only +# fixture variant exercising the large-SV assembly path) +# SPECIFICITY every shared GERMLINE variant must NOT be called (present in the normal control, +# so subtraction must remove it) +# +# Differs from F1 only in configuration: ONE control instead of a trio. +# +# Run directly: bash f2_somatic.sh +# Or submit: sbatch f2_somatic.sh +#SBATCH --account=marth-rw +#SBATCH --partition=marth-rw +#SBATCH --job-name=rufus_f2_somatic +#SBATCH --nodes=1 +#SBATCH --cpus-per-task=8 +#SBATCH --mem=32G +#SBATCH --time=01:00:00 +#SBATCH --output=%x_%j.out +#SBATCH --error=%x_%j.err +set -euo pipefail + +# sbatch copies this script to the spool dir, so BASH_SOURCE-derived paths break. See F4. +HERE="${FUNCTIONAL_CASES_DIR:-${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}}" +FIX="$(cd "$HERE/../fixtures" 2>/dev/null && pwd)" || { + echo "ERROR: cannot locate fixtures from HERE=$HERE"; exit 1; } +DATA=/uufs/chpc.utah.edu/common/HIPAA/u0746015/marth_software/RUFUS/resources/reg_test_files +SIF=${SIF:-$DATA/rufus_dev.sif} +OUT=${OUT:-$DATA/runs/f2_somatic} +THREADS=${SLURM_CPUS_PER_TASK:-8} +WINDOW=10 # positional tolerance: RUFUS may left-align / atomize a call vs the planted pos + +# Dev-loop overlay: bind local file(s) over the container to validate a fix before a CI rebuild. +# EXTRA_BIND=/path/to/repo/scripts/Foo.pl:/opt/RUFUS/scripts/Foo.pl sbatch f2_somatic.sh +EXTRA_BIND=${EXTRA_BIND:-} + +REF=$FIX/ref/tiny.fa +TUMOR=$FIX/somatic/tumor.bam +NORMAL=$FIX/somatic/normal.bam +SOMATIC=$FIX/designed/somatic.vcf # expected TO be called +GERMLINE=$FIX/designed/germline.vcf # expected NOT to be called + +rm -rf "$OUT"; mkdir -p "$OUT"; cd "$OUT" +module load apptainer 2>/dev/null || true +command -v apptainer >/dev/null || { echo "ERROR: apptainer unavailable"; exit 1; } +[ -f "$SIF" ] || { echo "ERROR: SIF not found: $SIF"; exit 1; } +for f in "$REF" "$TUMOR" "$NORMAL" "$SOMATIC" "$GERMLINE"; do + [ -f "$f" ] || { echo "ERROR: fixture missing: $f (run make_fixtures.sh)"; exit 1; } +done + +echo "=== F2 tumor/normal somatic | $(date) ===" +echo " subject : tumor.bam (germline HOM + somatic HET)" +echo " control : normal.bam (germline only)" +echo " expect : $(grep -vc '^#' "$SOMATIC") somatic CALLED, $(grep -vc '^#' "$GERMLINE") germline NOT called" +echo + +BINDS="$FIX,$OUT,$DATA" +if [ -n "$EXTRA_BIND" ]; then + BINDS="$BINDS,$EXTRA_BIND" + echo " OVERLAY : $EXTRA_BIND (testing an uncommitted local fix)"; echo +fi + +set +e +apptainer exec --bind "$BINDS" "$SIF" \ + bash /opt/RUFUS/runRufus.sh \ + -s "$TUMOR" -c "$NORMAL" -r "$REF" \ + -k 25 -L -m 5 -R chr20 -t "$THREADS" -z + # -L is the shipped default (setup_slurm hardcodes `-k 25 -L -vs`); somatic HET calls are + # labelled *-Mosaic and are stripped by VilterAutosomeOnly.withoutMosaic when -L is absent. +RC=$? +set -e +echo "runRufus exit: $RC" + +STATUS=$(cat "$OUT/region_status.log" 2>/dev/null || echo "") +echo "region_status: $STATUS" +WORK="$OUT/rufus_chr20" +fail() { echo "RESULT: FAIL — $*"; exit 1; } + +# ---- preconditions: prove the pipeline actually ran on BOTH samples ---- +echo "-- preconditions --" +for s in tumor normal; do + JH="$WORK/$s.bam.chr20.generator.Jhash"; HI="$JH.histo" + [ -s "$JH" ] || fail "$s: Jhash missing/empty — jellyfish did not run (OOM signature)" + [ -s "$HI" ] || fail "$s: histo missing/empty" + TOT=$(awk '{s+=$2} END{print s+0}' "$HI") + [ "$TOT" -ge 100000 ] || fail "$s: only $TOT distinct kmers — counting did not really run" + MODE=$(awk 'BEGIN{m=-1;c=0} {if($2+0>m){m=$2+0;c=$1+0}} END{print c}' "$HI") + echo " $s: distinct=$TOT modal_depth=$MODE OK" +done + +# ---- collect calls ---- +VCF=$(ls "$OUT"/temp.RUFUS.Final.*.vcf.gz "$OUT"/RUFUS.Final.*.vcf.gz 2>/dev/null | head -1 || true) +[ -n "$VCF" ] || fail "no VCF emitted (status: $STATUS) — expected somatic calls" +CALLS=$OUT/calls.tsv +zcat "$VCF" | awk -F'\t' '!/^#/ {print $1"\t"$2"\t"$4"\t"$5}' > "$CALLS" +NCALL=$(wc -l < "$CALLS") +echo "-- calls: $NCALL total (VCF: $(basename "$VCF")) --" + +called_near() { awk -F'\t' -v p="$1" -v w="$WINDOW" '$2>=p-w && $2<=p+w {f=1} END{exit !f}' "$CALLS"; } + +# ---- RECALL: every somatic must be called ---- +echo "-- recall (somatic, must be CALLED) --" +MISS=0 +while IFS=$'\t' read -r _c pos _i ref alt _rest; do + klass=$(( ${#ref} > 50 || ${#alt} > 50 ? 1 : 0 )) # flag the large event for the log + tag=$([ "$klass" -eq 1 ] && echo " [large SV]" || echo "") + if called_near "$pos"; then + echo " somatic @$pos (${ref:0:8}>${alt:0:8})$tag CALLED" + else + echo " somatic @$pos (${ref:0:8}>${alt:0:8})$tag *** MISSED ***"; MISS=$((MISS+1)) + fi +done < <(grep -v '^#' "$SOMATIC") + +# ---- SPECIFICITY: no germline may be called ---- +echo "-- specificity (germline, must NOT be called) --" +FP=0 +while IFS=$'\t' read -r _c pos _i ref alt _rest; do + if called_near "$pos"; then + echo " germline @$pos (${ref:0:8}>${alt:0:8}) *** FALSELY CALLED ***"; FP=$((FP+1)) + else + echo " germline @$pos (${ref:0:8}>${alt:0:8}) correctly absent" + fi +done < <(grep -v '^#' "$GERMLINE") + +# ---- PRECISION: every call must map to a planted somatic locus ---- +# Record count > planted count is EXPECTED (bcftools norm atomizes an MNV into per-base records). +echo "-- precision (no calls outside a planted locus) --" +UNEXP=0 +while IFS=$'\t' read -r _c pos _r _a; do + ok=0 + while read -r sp; do + if [ "$pos" -ge $((sp-WINDOW)) ] && [ "$pos" -le $((sp+WINDOW)) ]; then ok=1; break; fi + done < <(grep -v '^#' "$SOMATIC" | cut -f2) + if [ "$ok" -eq 0 ]; then echo " *** UNEXPECTED call @$pos ***"; UNEXP=$((UNEXP+1)); fi +done < "$CALLS" +[ "$UNEXP" -eq 0 ] && echo " all $NCALL call(s) map to a planted locus OK" + +# ---- LARGE-SV SIZE: the 1kb deletion is the only variant exercising SV assembly. Position alone +# would pass even if RUFUS miscalled it as a small indel, so assert the event size too. ---- +echo "-- large-SV size (planted 1000bp deletion @170000) --" +SVDELTA=$(zcat "$VCF" | awk -F'\t' '!/^#/ && $2>=169990 && $2<=170010 { + d=length($4)-length($5); if(d<0)d=-d; if(d>m)m=d} END{print m+0}') +echo " largest event near 170000: ${SVDELTA}bp (expect ~1000)" +SVOK=$([ "$SVDELTA" -ge 900 ] && echo 1 || echo 0) + +NSOM=$(grep -vc '^#' "$SOMATIC") +echo +echo "-- summary --" +echo " unexpected calls : $UNEXP" +echo " somatic recalled : $((NSOM-MISS))/$NSOM" +echo " germline leaked : $FP" +echo " total calls : $NCALL" + +[ "$MISS" -eq 0 ] || fail "$MISS somatic variant(s) missed" +[ "$FP" -eq 0 ] || fail "$FP germline variant(s) leaked into the call set" +[ "$UNEXP" -eq 0 ] || fail "$UNEXP call(s) at loci where nothing was planted (false positives)" +[ "$SVOK" -eq 1 ] || fail "large deletion mis-sized: ${SVDELTA}bp near 170000, expected ~1000 (SV assembly regressed?)" +echo "RESULT: PASS — all $NSOM somatic called (incl. ${SVDELTA}bp SV), no germline leaked" +exit 0 diff --git a/tests/functional/cases/f3_input_formats.sh b/tests/functional/cases/f3_input_formats.sh new file mode 100644 index 00000000..bed9370a --- /dev/null +++ b/tests/functional/cases/f3_input_formats.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# F3 — INPUT FORMAT CONCORDANCE (BAM vs CRAM). +# +# runRufus.sh accepts bam / cram / generator for -s and -c (FASTQ is NOT a primary input — it only +# supplements the filter via -q1/-q2). The fixture CRAM is a lossless re-encode of the BAM (same +# reads), so RUFUS must produce IDENTICAL calls from either. CRAM is what the real COLO829 accuracy +# gate uses, so this exercises the -cr decode path end to end. +# +# Runs the somatic scenario twice — once from BAM, once from CRAM — and asserts: +# CONCORDANCE the two call sets are byte-identical (CHROM/POS/REF/ALT) +# RECALL both recover the planted somatic variants (so concordance isn't "both empty") +# +# Run directly: bash f3_input_formats.sh +# Or submit: sbatch f3_input_formats.sh +#SBATCH --account=marth-rw +#SBATCH --partition=marth-rw +#SBATCH --job-name=rufus_f3_formats +#SBATCH --nodes=1 +#SBATCH --cpus-per-task=8 +#SBATCH --mem=32G +#SBATCH --time=01:00:00 +#SBATCH --output=%x_%j.out +#SBATCH --error=%x_%j.err +set -euo pipefail + +# sbatch copies this script to the spool dir, so BASH_SOURCE-derived paths break. See F4. +HERE="${FUNCTIONAL_CASES_DIR:-${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}}" +FIX="$(cd "$HERE/../fixtures" 2>/dev/null && pwd)" || { echo "ERROR: cannot locate fixtures from HERE=$HERE"; exit 1; } +DATA=/uufs/chpc.utah.edu/common/HIPAA/u0746015/marth_software/RUFUS/resources/reg_test_files +SIF=${SIF:-$DATA/rufus_dev.sif} +OUTROOT=${OUTROOT:-$DATA/runs/f3_formats} +THREADS=${SLURM_CPUS_PER_TASK:-8} +WINDOW=10 + +REF=$FIX/ref/tiny.fa +SOMATIC=$FIX/designed/somatic.vcf # expected somatic loci + +module load apptainer 2>/dev/null || true +command -v apptainer >/dev/null || { echo "ERROR: apptainer unavailable"; exit 1; } +[ -f "$SIF" ] || { echo "ERROR: SIF not found: $SIF"; exit 1; } +for f in "$REF" "$FIX/somatic/tumor.bam" "$FIX/somatic/tumor.cram" "$FIX/somatic/normal.bam" "$FIX/somatic/normal.cram"; do + [ -f "$f" ] || { echo "ERROR: fixture missing: $f (run make_fixtures.sh)"; exit 1; } +done + +fail() { echo "RESULT: FAIL — $*"; exit 1; } + +# run_format