Giter Site home page Giter Site logo

Comments (3)

jsh58 avatar jsh58 commented on August 26, 2024

Thanks for the comment and suggestion. It is true that the program will fail with process substitution due to the inability to push back characters to the stream. However, the choice was made to support piping, and your proposed solution breaks that functionality. So if your modified code works for you, good. A better solution would require a bit more thought.

from ngmerge.

dariomel avatar dariomel commented on August 26, 2024

Indeed, this is just a feature request and the code I provided was meant to be an example of using gzdopen to avoid closing and reopening the input files. I did not test the modified program with all possible combinations of inputs. For example, my hacks involving fclose in function runProgram cause Segmentation fault when running the program with gzipped input files.
However, after omitting those changes, the following commands produced identical output files on my system:

NGmerge -a -1 R1.fastq.gz -2 R2.fastq.gz -o temp1.fastq -i -v -y

zcat R1.fastq.gz | NGmerge -a -1 - -2 R2.fastq.gz -o temp2.fastq -i -v -y

s='H;0~4{g;s/\n//;y/\n/\t/;p;z;h}'; paste -d'\n' <(sed -n -e$s <(zcat R1.fastq.gz)) <(sed -n -e$s <(zcat R2.fastq.gz)) | tr '\t' '\n' | NGmerge -a -1 - -o temp3.fastq -i -v -y

where the last command uses sed, paste, and tr to interleave the input FASTQ files.
So it seems that support for "piping" is not broken.
I agree that a better solution would require a bit more thought, and definitely more testing.

from ngmerge.

jsh58 avatar jsh58 commented on August 26, 2024

I was imprecise when I wrote that support for piping was broken with your modified code. It is the failure to throw an error with a streamed gzip-compressed file:

$ cat zzz3.fq.gz | ./NGmerge_edit -1- -o /dev/null -av
Warning: only one input file specified -- assuming interleaved
Processing files: -,(interleaved)
  Fragments (pairs of reads) analyzed: 0
  Successfully stitched: 0

Here are the results with the current version of NGmerge:

$ cat zzz3.fq.gz | ./NGmerge -1- -o /dev/null -av
Warning: only one input file specified -- assuming interleaved
Error! Cannot pipe in gzip compressed file (use zcat instead)

$ zcat zzz3.fq.gz | ./NGmerge -1- -o /dev/null -av
Warning: only one input file specified -- assuming interleaved
Processing files: -,(interleaved)
  Fragments (pairs of reads) analyzed: 2
  Adapters removed: 0

from ngmerge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.