Created
November 14, 2015 21:35
-
-
Save TamaDP/cdfb3c0ac74ec529c7eb to your computer and use it in GitHub Desktop.
no subs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
###################################################################################### | |
## enzyme_digestion.pl | |
####################################################################################### | |
use warnings; | |
use strict; | |
use diagnostics; | |
#Defining user options | |
use vars qw($opt_t $opt_l $opt_a $opt_v $opt_c $opt_h); | |
use Getopt::Std; | |
#Setting missed cleavages to a default value of 0 | |
my $n_missed_cleavages = (defined $opt_c) ? $opt_c : 0; | |
#Declaring arrays and variables | |
my (@proteins, @sequences, @peptides, @mc_peptides); | |
my ($protein,$sequence, $peptide, $unusual_counter,$unknown_counter, $protein_size,$peptide_size, $mc_peptide_size,$n,$r,$s,$i,$j); | |
############################################################################ | |
########### Main subroutine | |
########### | |
############################################################################ | |
@proteins=("DAAARAATTLTTTAKMTTTTTTCKMMFRPPPPPGGGGGGGGGGGG","ALTAMCMNVWEITYHKGSDVNRRASFAQPKPPQPPRPPLLARIKPASDASD"); | |
main(); | |
sub main { | |
# If there is no user input, error message and usage are displayed and program closes | |
# if (!getopts ('tlavc:h')) { | |
# error_out("No arguments recognized"); | |
} | |
# if ($opt_h) { | |
# help(); | |
# exit; | |
} | |
# Reading FASTA file and eliminating header and blank spaces | |
foreach $protein (@proteins) { | |
if ($protein !~ /^>/) { | |
# Counting unusual and unknown aminoacids | |
if ($protein=~ m/(BOUJZ)/g){$unusual_counter++;} | |
if ($protein=~ m/X/g) {$unknown_counter++;} | |
$protein =~ s/\s//g; | |
@sequences = chomp ($protein); | |
} | |
} | |
#### print "Hasta aqui funciona\n"; | |
for $sequence (@sequences) { | |
if ($opt_t) { | |
my @peptides = split (/(?<=[RK])(?!P)/, $sequence); | |
} | |
elsif ($opt_l) { | |
my @peptides = split (/(?<=[K])(?!P)/, $sequence); | |
} | |
elsif ($opt_a) { | |
my @peptides = split (/(?<=[R])(?!P)/, $sequence); | |
} | |
elsif ($opt_v) { | |
my @peptides = split (/(?<=[E])(?!P)/, $sequence); | |
} | |
else { | |
print "nope"; | |
# If no enzymes are selected, error message and usage are printed on the screen | |
# error_out("No enzyme selected"); | |
} | |
} | |
print "Hasta aqui si llega\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment