Subsetting BAM by positions

1

Hi All,

I have a .cram file and I want to keep only reads that are related to positions I am interested in.

Say the list of positions looks like this (it has about 16k positions):

           rs3094315     1        0.020130          752566 G A
          rs12124819     1        0.020242          776546 A G
          rs28765502     1        0.022137          832918 T C
           rs7419119     1        0.022518          842013 T G
            rs950122     1        0.022720          846864 G C
         rs113171913     1        0.023436          869303 C T
          rs13302957     1        0.024116          891021 G A
          rs59986066     1        0.024183          893462 C T
         rs112905931     1        0.024260          896271 C T
           rs6696609     1        0.024457          903426 C T
          rs13303368     1        0.024771          914852 G C

I tried using samtools view and the region attributes like this:

samtools view -T reference_genome/hs38DH.chr22.fa.gz NA12878.final.cram chr22:59030570-59030570 chr22:28799103-28799103 chr22:28799108-28799108 

and it works great,
but when I put the 16k positions it says its too long.

-bash: /usr/bin/samtools: Argument list too long

How do I keep only reads that have a position that appears in my position list?


file


SAM

• 43 views



Source link