-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck4properpairing.pl
More file actions
executable file
·46 lines (39 loc) · 890 Bytes
/
check4properpairing.pl
File metadata and controls
executable file
·46 lines (39 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl
#
# Bradley JSC Olson
# Kansas State University
#
# Script determines if fastq sequences are paired line-by-line in two separate files
# Usage: ./check4properpairing.pl file1.fastq file2.fastq
#
use strict;
use warnings;
use Bio::SeqIO;
use 5.010;
my $io1=Bio::SeqIO->new(-file=>"<$ARGV[0]", -format=>'fastq');
my $io2=Bio::SeqIO->new(-file=>"<$ARGV[1]", -format=>'fastq');
my @seq_ids1;
while (my $seq1=$io1->next_seq)
{
push(@seq_ids1, $seq1->id);
}
my @seq_ids2;
while (my $seq2=$io2->next_seq)
{
push(@seq_ids2, $seq2->id);
}
my $i=0;
my $j=0; #Counts the number of mis-paired reads
foreach (@seq_ids1)
{
if ($seq_ids1[$i] ne $seq_ids2[$i])
{
print "These two Sequences are mis-matched! $seq_ids1[$i], $seq_ids2[$i]\n";
$j++;
}
$i++;
}
if ($j == 0) #If no mis-matched reads are paired, print that all is ok
{
print "All reads are properly paired\n";
}