Phenylketonuria/Task3/Scripts

From Bioinformatikpedia
Revision as of 15:51, 11 May 2013 by Waldraffs (talk | contribs)

This script reads an input file in ReProf format 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>

The output is the secondary structure shown with the letters E, H and L.

Code:

<source lang="perl">

  1. !/usr/bin/perl

my $inp; my $out;

  1. Reads the command line parameters

for ($i=0; $i<=3;$i++){ if($ARGV[$i] eq "-inp"){ $inp=$ARGV[$i+1]; }elsif($ARGV[$i] eq "-out"){ $out=$ARGV[$i+1]; } }

if(!$inp && !$out){ print "Usage: filter_secStruc.pl -inp <input-file(.reprof)> -out <output-file>" }

my $secstructure= ""; my $no = 0;

  1. reads input file and filters for the coloumn with secondary structure

open (FILE,"$inp") || die $!; while (my $line = <FILE>){

if($no == 1){ @splitLine = split(/\t/,$line); $secstructure="$secstructure$splitLine[2]"; }

if($line =~ /^No/){ $no = 1; } } close FILE;

  1. writes output file

open(OUTFILE,">$out") || die $!; print OUTFILE $secstructure; close OUTFILE;

</source>