This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Sliding Window : discriminate partial and fully contained fragments (from a bam file)

Hello everyone,

After Next Gen Sequencing, alignment (BWA), sorting and indexing (samtools), I obtained a bam file. I would like to know there is any tool allowing me to , when using a sliding windows on a bam file, discriminate fragments fully spanning the window from the other ones ?

For instance : To calculate a score for a given window, i would add +1 for each fragment completely spanning the window and -1 for the fragments having an endpoint in the window. Any Suggestions please ?

Thanks in advance.

next-gen sequencing sequence

The aim is to infer nucleosomes locations

1 answer

I've quickly written the following tool: https://github.com/lindenb/jvarkit/wiki/Biostar234230

Not fully checked/tested.

See the code for more information about the reads that are included/discarded.

$ curl -s "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20110915_CEUtrio_b37_decoy_alignment/CEUTrio.HiSeq.WGS.b37_decoy.NA12892.clean.dedup.recal.bam" |  java -jar dist/biostar234230.jar 
#contig start   end pairs_in_window pairs_over_window   pairs_partial_overlap
1   10000   10100   0   2   240
1   10050   10150   4   615 274
1   10100   10200   0   800 276
1   10150   10250   0   216 649
1   10200   10300   0   2982    809
1   10250   10350   0   2918    207
1   10300   10400   0   1923    2851
1   10350   10450   0   227 4498
1   10400   10500   0   31  1971
(...)

Thank you Pierre !

Could you explain me how your script manages paired end reads ?

it ignores the following reads:

  • unmapped
  • secondary
  • supplementary
  • not paired
  • not properly paired

Ok Thanks. I'll try to make a python version, i'll keep you informed.

Log in to answer this question.