Question: Piping Input Into Picard Sortsam
2
gravatar for eva.knig
6.1 years ago by
eva.knig60
eva.knig60 wrote:

Hello everyone,

does it make any sense to (Unix) pipe input into Picard SortSam, or will SortSam wait for all the input before starting?

For example, if I have the command

samtools view -Shu in.sam | \
java -Xmx4g SortSam.jar I=/dev/stdin O=sorted.bam SO=coordinate VALIDATION_STRINGENCY=SILENT

Will SortSam already do some work on the reads it gets from samtools view (e.g. by putting new reads in place) or will it wait for ALL reads from samtools until it starts sorting? In the latter case I would have SortSam running and blocking memory without doing something for the execution time of samtools view. Does anybody know?

Thanks

picard bam • 8.0k views
ADD COMMENTlink modified 5.2 years ago by Caddymob930 • written 6.1 years ago by eva.knig60
2

I=/dev/stdin : very useful, thanks !

ADD REPLYlink written 6.1 years ago by Pierre Lindenbaum115k
6
gravatar for Caddymob
5.2 years ago by
Caddymob930
United States
Caddymob930 wrote:

Yes, picard (and most java apps should) take pipes. I do query sorts to FASTQs like this as one example:

java -Xmx30g -jar ${PICARD}/SortSam.jar \
I=$IN_BAM \
TMP_DIR=${TMP} \
MAX_RECORDS_IN_RAM=7000000 \
VALIDATION_STRINGENCY=LENIENT \
COMPRESSION_LEVEL=0 \
O=/dev/stdout \
SORT_ORDER=queryname | \ # NOTE PIPE HERE
java -Xmx12g -jar ${PICARD}/SamToFastq.jar \
I=/dev/stdin \
MAX_RECORDS_IN_RAM=3000000 \
VALIDATION_STRINGENCY=LENIENT \
F=$OUT.R1.fq \
F2=$OUT.R2.fq

O=/dev/stdout and I=/dev/stdin are quite handy :) I havent run time comparisons, but I like pipes wherever I can.

ADD COMMENTlink written 5.2 years ago by Caddymob930
1
gravatar for Irsan
6.1 years ago by
Irsan6.8k
Amsterdam
Irsan6.8k wrote:

I don't know by experience by you can try it and use

[your_command_prompt]$ top

To see if both samtools and java SortSam.jar are running at the same time

ADD COMMENTlink written 6.1 years ago by Irsan6.8k

Good idea thanks. So I was running the command and from the CPU usage one can see that both programs acutally are running (and computing) something at the same time.

ADD REPLYlink written 6.1 years ago by eva.knig60
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1654 users visited in the last hour