#!/usr/bin/perl -w ############################################## ### Huang He ### ### treatment_for_orignal_of_fasta ### ############################################## use Getopt::Long; my %opt; GetOptions(\%opt,"a=s","ac=s","f=s","am=s","ap=s","b=s","bml=s","bms=s","bv=s","c=s","help"); unless ((defined $opt{f}) or defined $opt{a} or defined $opt{am} or defined $opt{ap} or defined $opt{ac} or defined $opt{b} or defined $opt{bml} or defined $opt{bms} or defined $opt{bv} or defined $opt{c} or defined $opt{help} ){ &help (); } &help()if(defined $opt{help}); if(defined $opt{a}){ if(defined $opt{am} and defined $opt{ap} and defined $opt{ac}){ `perl /home/huanghe/research/bin/pipeline/treatment_for_rRNA/trim_fasta.pl -f $opt{f} -m $opt{am} -p $opt{ap} -c $opt{ac}`; } elsif(defined $opt{am} and defined $opt{ap} and !defined $opt{ac}){ `perl /home/huanghe/research/bin/pipeline/treatment_for_rRNA/trim_fasta.pl -f $opt{f} -m $opt{am} -p $opt{ap}`; } elsif(defined $opt{am} and !defined $opt{ap} and defined $opt{ac}){ `perl /home/huanghe/research/bin/pipeline/treatment_for_rRNA/trim_fasta.pl -f $opt{f} -m $opt{am} -c $opt{ac}`; } elsif(!defined $opt{am} and defined $opt{ap} and defined $opt{ac}){ `perl /home/huanghe/research/bin/pipeline/treatment_for_rRNA/trim_fasta.pl -f $opt{f} -p $opt{ap} -c $opt{ac}`; } elsif(!defined $opt{am} and !defined $opt{ap} and defined $opt{ac}){ `perl /home/huanghe/research/bin/pipeline/treatment_for_rRNA/trim_fasta.pl -f $opt{f} -c $opt{ac}`; } elsif(!defined $opt{am} and defined $opt{ap} and !defined $opt{ac}){ `perl /home/huanghe/research/bin/pipeline/treatment_for_rRNA/trim_fasta.pl -f $opt{f} -p $opt{ap}`; } elsif(defined $opt{am} and !defined $opt{ap} and !defined $opt{ac}){ `perl /home/huanghe/research/bin/pipeline/treatment_for_rRNA/trim_fasta.pl -f $opt{f} -m $opt{am}`; } elsif(!defined $opt{am} and !defined $opt{ap} and !defined $opt{ac}){ `perl /home/huanghe/research/bin/pipeline/treatment_for_rRNA/trim_fasta.pl -f $opt{f}`; } } if(defined $opt{a}){ if(defined $opt{b}){ `/home/huanghe/research/tools/phred_cross/./cross_match.manyreads $opt{f}.salvaged $opt{bv} -minmatch $opt{bml} -minscore $opt{bms} -screen 2>cross_match.log`; } } else{ if(defined $opt{b}){ `/home/huanghe/research/tools/phred_cross/./cross_match.manyreads $opt{f} $opt{bv} -minmatch $opt{bml} -minscore $opt{bms} -screen 2>cross_match.log`; } } if(defined $opt{a} and defined $opt{b}){ if(defined $opt{c}){ open OUT,">batchfile" or die "can't batchfile"; print OUT "unique.seqs(fasta=$opt{f}.salvaged.screen)"; `/home/huanghe/research/tools/mothur/Mothur.cen_64/mothur/mothur batchfile`; } } elsif(!defined $opt{a} and defined $opt{b}){ if(defined $opt{c}){ open OUT,">batchfile" or die "can't batchfile"; print OUT "unique.seqs(fasta=$opt{f}.screen)"; `/home/huanghe/research/tools/mothur/Mothur.cen_64/mothur/mothur batchfile`; } } elsif(defined $opt{a} and !defined $opt{b}){ if(defined $opt{c}){ open OUT,">batchfile" or die "can't batchfile"; print OUT "unique.seqs(fasta=$opt{f}.salvaged)"; `/home/huanghe/research/tools/mothur/Mothur.cen_64/mothur/mothur batchfile`; } } elsif(!defined $opt{a} and !defined $opt{b}){ if(defined $opt{c}){ open OUT,">batchfile" or die "can't batchfile"; print OUT "unique.seqs(fasta=$opt{f})"; `/home/huanghe/research/tools/mothur/Mothur.cen_64/mothur/mothur batchfile`; } } sub help{ warn <<"_EOT_"; ******* This is a help document.******** Usage: perl treatment_for_orignal_of_fasta.pl Options -f Input fasta_file key word (contains path), must be given ***************************************** -a Please input y to remove ploy tails. -am integer: The minimum length allowed for a fasta record. (Optional. Default is 50.) -ap integer: The minimum length of a Poly(A/T) sequence. (Optional. Default is 8.) -ac 1 or 0: 1 = Remove sequences with Poly(A/T) in the middle of the sequence, 0 = Don't remove. (Optional. Default is 0 = Don't remove. It returns two new fasta files: one with the removed sequences (fasta_file.removed), and one with the salvaged sequences (fasta_file.salvaged). ***************************************** -b Please input y to trim Vector Sequences. -bv the file of vector sequences (fasta format; may just be one sequence). -bml suggested minimum length to match (10 is suggested). -bms suggested minimum alignment score (10 is suggested). It returns a fasta.screen, which will contains the "vector masked" version of the original fasta file. ***caution*** input fasta file is not aviliable for big size file(<200Mb). ***************************************** -c Please input y to remove repeated sequences. It returns two new fasta files: one with the removed repeated sequences (fasta_file.unique.xxx), and one with the only name of sequences (fasta_file.names). ***************************************** If input b, it will returns a record file: fasta_file.log If input c, it will returns a batchfile and a record file mothur.xxx.logfile **************************************** _EOT_ exit(1); }