I have some files (which are in .bam format(binary)) to download from a location. I can download them using wget and then want to extract some specific information from them only. For that I use samtools. What I want to know is, is there a way I can on the fly, extract what I want to from the bam file so that I don't have to download the entire bam file and then extract what I need and then delete the original bam file.
Commands used are
wget link.bam samtools view -h chr1 link.bam | samtools view -bS > condensed.bam
Can this be done without downloading the entire original bam file on my hard drive. I want to do this because I am short on space and these files are huge.
Hope to hear from you guys.