Difference between revisions of "Phenylketonuria/Task3/Scripts"
Line 1: | Line 1: | ||
− | This script reads an input file in ReProf format and filters the file for the secondary structur presented with H,L and E.<br> |
+ | This script reads an input file in ReProf format or PsiPred and filters the file for the secondary structur presented with H,L and E.<br> |
You can find the script in <code>/mnt/home/student/waldraffs/Masterpraktikum/Task3/filter_secStruc.pl</code> |
You can find the script in <code>/mnt/home/student/waldraffs/Masterpraktikum/Task3/filter_secStruc.pl</code> |
||
− | Usage: perl filter_secStrucpl -inp <input-file in ReProf format> -out <output-file> |
+ | Usage: perl filter_secStrucpl -inp <input-file in ReProf format> -out <output-file> -reprof|-psipred |
+ | -reprof: if the input file is result of a ReProf run |
||
+ | -psipred: if the input file is result of a PsiPred run |
||
− | The output is the secondary structure shown with the letters E, H and L. |
+ | The output is the secondary structure shown with the letters E, H and L/C. |
Code: |
Code: |
||
Line 14: | Line 16: | ||
my $inp; |
my $inp; |
||
my $out; |
my $out; |
||
+ | my $reprof = 0; |
||
+ | my $psipred = 0; |
||
# Reads the command line parameters |
# Reads the command line parameters |
||
− | for ($i=0; $i<= |
+ | for ($i=0; $i<=@ARGV;$i++){ |
if($ARGV[$i] eq "-inp"){ |
if($ARGV[$i] eq "-inp"){ |
||
$inp=$ARGV[$i+1]; |
$inp=$ARGV[$i+1]; |
||
+ | } |
||
− | }elsif($ARGV[$i] eq "-out"){ |
||
+ | if($ARGV[$i] eq "-out"){ |
||
$out=$ARGV[$i+1]; |
$out=$ARGV[$i+1]; |
||
+ | } |
||
+ | if($ARGV[$i] eq "-reprof"){ |
||
+ | $reprof = 1; |
||
+ | } |
||
+ | if($ARGV[$i] eq "-psipred"){ |
||
+ | $psipred = 1; |
||
} |
} |
||
} |
} |
||
if(!$inp && !$out){ |
if(!$inp && !$out){ |
||
− | print "Usage: filter_secStruc.pl -inp <input-file(.reprof)> -out <output-file>" |
+ | print "Usage: filter_secStruc.pl -inp <input-file(.reprof)> -out <output-file> -reprof|-psipred" |
} |
} |
||
Line 33: | Line 44: | ||
#reads input file and filters for the coloumn with secondary structure |
#reads input file and filters for the coloumn with secondary structure |
||
open (FILE,"$inp") || die $!; |
open (FILE,"$inp") || die $!; |
||
− | + | if($reprof == 1){ |
|
+ | while (my $line = <FILE>){ |
||
− | + | if($no == 1){ |
|
− | @splitLine = split(/\t/,$line); |
+ | @splitLine = split(/\t/,$line); |
− | $secstructure="$secstructure$splitLine[2]"; |
+ | $secstructure="$secstructure$splitLine[2]"; |
− | + | } |
|
− | + | if($line =~ /^No/){ |
|
− | $no = 1; |
+ | $no = 1; |
− | + | } |
|
+ | } |
||
+ | } |
||
+ | if($psipred == 1){ |
||
+ | while (my $line = <FILE>){ |
||
+ | if($line =~ /^Pred/){ |
||
+ | @splitLine = split(/ /,$line); |
||
+ | chomp($splitLine[1]); |
||
+ | $secstructure = "$secstructure$splitLine[1]"; |
||
+ | } |
||
+ | } |
||
} |
} |
||
close FILE; |
close FILE; |
Revision as of 16:28, 11 May 2013
This script reads an input file in ReProf format or PsiPred and filters the file for the secondary structur presented with H,L and E.
You can find the script in /mnt/home/student/waldraffs/Masterpraktikum/Task3/filter_secStruc.pl
Usage: perl filter_secStrucpl -inp <input-file in ReProf format> -out <output-file> -reprof|-psipred -reprof: if the input file is result of a ReProf run -psipred: if the input file is result of a PsiPred run
The output is the secondary structure shown with the letters E, H and L/C.
Code:
<source lang="perl">
- !/usr/bin/perl
my $inp; my $out; my $reprof = 0; my $psipred = 0;
- Reads the command line parameters
for ($i=0; $i<=@ARGV;$i++){ if($ARGV[$i] eq "-inp"){ $inp=$ARGV[$i+1]; } if($ARGV[$i] eq "-out"){ $out=$ARGV[$i+1]; } if($ARGV[$i] eq "-reprof"){ $reprof = 1; } if($ARGV[$i] eq "-psipred"){ $psipred = 1; } }
if(!$inp && !$out){ print "Usage: filter_secStruc.pl -inp <input-file(.reprof)> -out <output-file> -reprof|-psipred" }
my $secstructure= ""; my $no = 0;
- reads input file and filters for the coloumn with secondary structure
open (FILE,"$inp") || die $!; if($reprof == 1){ while (my $line = <FILE>){
if($no == 1){ @splitLine = split(/\t/,$line); $secstructure="$secstructure$splitLine[2]"; }
if($line =~ /^No/){ $no = 1; } } } if($psipred == 1){ while (my $line = <FILE>){ if($line =~ /^Pred/){ @splitLine = split(/ /,$line); chomp($splitLine[1]); $secstructure = "$secstructure$splitLine[1]"; } } } close FILE;
- writes output file
open(OUTFILE,">$out") || die $!; print OUTFILE $secstructure; close OUTFILE;
</source>