Hi guys,
I have 5 bam (ChIPseq PE data sorted by position) files that came from 5 different murine cortexes (mice that belong to the same group, so biological replicates), however I have a lot of group variability. I'm thinking to merge all this 5 bam (I know that is a dirty things) in order to make a unique bam file (already done using samtools merge) and then split (in a random way) in 5 new bam files... I'll use they to make a Differential analysis with DiffBind
However I don't find a way to split it.
I have try with following command (that allow to split just in 2 bam files...that for now could be a good starting point)
samtools view -H test.bam > f1.sam
cp f1.sam f2.sam
samtools view test.bam | awk '{if(NR%4<2){print >> "f1.sam"} else {print >> "f2.sam"}}'
but seem that the new bam files has some problem because when I try to count the reads in each bam file using
samtools view -c f1.sam > reads.txt
I obtain the following error
[E::sam_parse1] no SQ lines present in the headerls view -c f2.sam > reads.txt
[main_samview] truncated file.
Please, can someone help me?
I don't really understand what's your aim. Nevertheless what is the output of :
Below the output