Paired-End Bam Files
3 answers
I write a perl script to decide the bam file is paired-end or single end.
sub is_bamPE($){
my($bamfile)=@_;
my $is_pairedEnd;
chomp( my $line=`samtools view $bamfile | head -n 1| awk '{print \$2}'`);
my $remainder=$line%2;
print "$line\t$remainder\n";
if($remainder){
$is_pairedEnd="--paired-end"
}else{
$is_pairedEnd="--single-end"
}
return $is_pairedEnd;
}
• 0 views
•
link
Actually there are BAM files for more than 70 samples. So I have two bam files for each sample and I want to check if they really are the paired-end files of the samples or are single end but technical replicates. I was wondering of a flag or something that could be checked with a python script to show it.
• 0 views
•
link
Log in to answer this question.
am not much clear. but if you want to check whether those files are paired-end convert them to sam format using samtools and then see
I'm not sure if I understand you right, but maybe sort them by name and check if the read names are the same in the two files?
The paired-ends from the same sample should (almost*) always be mapped together, producing only 1 BAM file. If you're mapping mates separately, then you're doing things wrong.
*If you were working on an exception to this, you'd already know how to do this.