-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix_infile_checker.pl
executable file
·54 lines (41 loc) · 1.28 KB
/
matrix_infile_checker.pl
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
47
48
49
50
51
52
53
54
#!/usr/bin/perl -w
use strict;
#matrixmaker_inputchecker.pl
# checks file handled to matrixmaker if there qare any missaligned columns
#open(ER,'>>',"/home/daniel/logfile_auto.log")||die "$!"; # global logfile
my$start = time;
my$linfile= $ARGV[0];
chomp $linfile;
open(IN,$linfile)|| die "$!";
########################################################################### get samlenames into array, get coordinates and basic info into arrays allenames, allecoords allebasicinfo
my@allelines= <IN>; #input file
my$mist=0;
for (my$i=0;$i<scalar(@allelines);$i++){
my$line_o_o=$allelines[$i]; # current line
my@parts=split(/\t+/,$line_o_o);
my$cord=$parts[0];
my$strand=$parts[1];
my$Refseqid=$parts[6];
my$namesmale=$parts[2];# sample
# now checking the inputfile
if(!($strand=~/[+-]/)){
warn "line $i file $linfile: strand is $strand \n";
$mist++;
}
if(!($cord=~/chr/)){
warn "line $i file $linfile: coordinates $cord does not include chromosome! \n";
$mist++;
}
if(!($Refseqid=~/N/)){
warn "line $i file $linfile: Refseqid $Refseqid does not include refseqid! \n";
$mist++;
}
if($namesmale=~/\-/){
warn "line $i file $linfile: samplename $namesmale does have a minus in it! \n";
$mist++;
}
if($mist > 0){
print "line with mistaken parts: $line_o_o\n"
}
$mist=0;
}