From: <rea...@us...> - 2009-07-29 21:17:47
|
Revision: 4497 http://sashimi.svn.sourceforge.net/sashimi/?rev=4497&view=rev Author: real_procopio Date: 2009-07-29 21:17:38 +0000 (Wed, 29 Jul 2009) Log Message: ----------- Adding front-ends to createChargeFile.pl, mergeCharges.pl (under new 'Pre-Process' section), and updateAllPaths.pl (under Utilities) Modified Paths: -------------- trunk/trans_proteomic_pipeline/CGI/tpp_gui/tpp_gui.pl Modified: trunk/trans_proteomic_pipeline/CGI/tpp_gui/tpp_gui.pl =================================================================== --- trunk/trans_proteomic_pipeline/CGI/tpp_gui/tpp_gui.pl 2009-07-29 20:34:25 UTC (rev 4496) +++ trunk/trans_proteomic_pipeline/CGI/tpp_gui/tpp_gui.pl 2009-07-29 21:17:38 UTC (rev 4497) @@ -87,6 +87,9 @@ 'xinteract' => '/usr/bin/xinteract', 'interprophet'=> '/usr/bin/InterProphetParser', 'runprophet' => '/usr/bin/ProteinProphet', + 'updateallpaths'=>'/usr/bin/updateAllPaths.pl', + 'chargefile' =>'/usr/bin/createChargeFile.pl', + 'mergecharges'=>'/usr/bin/mergeCharges.pl', ); my $in_windows = ( ($^O eq 'cygwin' )); # really this means in_cygwin, but that's a pervasive change to track @@ -131,7 +134,9 @@ 'mzxmlgen' , 'Convert to mzXML', 'mzmlgen' , 'Convert to mzML', 'mzxml2other' , 'Convert Files', - 'dta2mzxml', , 'Create mzXML file', + 'dta2mzxml' , 'Create mzXML file', + 'chargefile' , 'Create charge file', + 'mergecharges' , 'Merge charges into mzXML', 'runqualscore' , 'Run QualScore', 'runspectrast' , 'Run SpectraST', 'runtandem' , 'Run Tandem Search', @@ -143,6 +148,7 @@ 'xinteract' , 'Run XInteract', 'runinterprophet','Run InterProphet', 'runprophet' , 'Run ProteinProphet', + 'updatePaths' , 'Update File Paths', 'selectFiles' , 'Select', 'addFiles' , 'Add Files', 'saveFile' , 'Save Changes', @@ -179,6 +185,8 @@ 'conditionxml', \&pageLibraCondition, 'mzxml2search', \&pageMzXml2Other, 'dta2mzxml' , \&pageDta2MzXml, + 'chargefile' , \&pageCreateChargeFile, + 'mergecharges', \&pageMergeCharges, 'getspeclibs', \&pageGetSpecLibs, 'runspectrast', \&pageRunSpectraST, 'spectrastlib', \&pageCreateSpecLib, @@ -186,6 +194,7 @@ 'qualscore' , \&pageQualscore, 'runmascot' , \&pageRunMascot, 'runtandem' , \&pageRunTandem, + 'updatepaths', \&pageUpdateAllPaths, 'filebrowser', \&pageBrowseFiles, 'filechooser', \&fileChooser, 'showfile' , \&showFile, @@ -206,6 +215,8 @@ 'mzxml' , 'ToMzXML', 'mzml' , 'ToMzML', 'mz2other' , 'FromMzXML', + 'tocharge' , 'ToCharge', + 'chargefile' , 'ChargeFile', 'converters' , 'ToPepXML', 'searchdb' , 'SearchDatabase', 'sequest' , 'SequestParams', @@ -215,6 +226,7 @@ 'nistspeclib', 'NISTSpectralLibrary', 'xinteract' , 'XInteract', 'runprophet' , 'ProtProphet', + 'newpaths' , 'UpdatePaths', 'lastdir' , 'LastDirectory', 'copyfile' , 'CLIPBOARD', 'rawfile' , '@RAWFILE_TYPE', @@ -404,6 +416,12 @@ $page = &filterMascotFile(); } elsif ( $action eq $web_actions{'genLibraCond'} ) { $page = &generateLibraConditionFile(); + } elsif ( $action eq $web_actions{'updatePaths'} ) { + $page = &updateAllPaths(); + } elsif ( $action eq $web_actions{'chargefile'} ) { + $page = &runCreateChargeFile(); + } elsif ( $action eq $web_actions{'mergecharges'} ) { + $page = &runMergeCharges(); } elsif ( $action eq $web_actions{'mzxml2other'} ) { $page = &mzToSearch() ; } elsif ( $action eq $web_actions{'mzxmlgen'} ) { @@ -2949,6 +2967,154 @@ ######################################################################## +# runCreateChargeFile +# +# Create .charge files +# +######################################################################## +sub runCreateChargeFile { + + # Retrieve File List + my @file_list; + + for (@session_data) { + chomp; + push @file_list, $' if (/$proc_types{'tocharge'}:/); #' + } + + if (!@file_list) { + push @messages, "There are no files from which to extract charge information!"; + push @messages, "Please 'Select' file(s) to process."; + return 'chargefile'; + } + + # Build commands + # + # createChargeFile.pl [OPTIONS + <FILES>] + my @commands; + for my $file (@file_list) { + my $command = ''; + my $options = ''; + my $out_file = $file; + + my $fdir = dirname($file); + + if ($file =~ /ms2$/) { + $options .= '-f ms2 -i'; + $out_file =~ s/ms2$/charge/i; + } else { + $options .= '-f dta -d'; + $out_file .= ".charge"; + } + + $command = "$command{chargefile} $options $file"; + + $command = "$command{chdir} $fdir; " . $command; + + push @commands, ($command, $out_file); + + } + + return &prepareCommands('chargefile',@commands); + +} + + +######################################################################## +# runMergeCharges +# +# Merge charge information into mzXML files +# +######################################################################## +sub runMergeCharges { + + # Retrieve File List + my ($mzfile, $charges); + + for (@session_data) { + chomp; + $mzfile = $' if (/$proc_types{'runsearch'}:/); #' + $charges= $' if (/$proc_types{'chargefile'}:/); #' + } + + if (!($mzfile && $charges)) { + push @messages, "There are not enough files specified!"; + push @messages, "Please 'Select' file(s) to process."; + return 'mergecharges'; + } + + # Build commands + # + # mergeCharges.pl -i inputmzXMLFile -c inputChargeFile + my $command = ''; + my $options = ''; + my $out_file = ''; + + my $fdir = dirname($mzfile); + + $command = "$command{mergecharges} -i $mzfile -c $charges"; + + $command = "$command{chdir} $fdir; " . $command; + + my @commands; + push @commands, ($command, $mzfile); + + + return &prepareCommands('mergecharges',@commands); + +} + + +######################################################################## +# updateAllPaths +# +# Update file paths inside pepXML, protXML, etc files +# +######################################################################## +sub updateAllPaths { + + # Retrieve File List + my @file_list; + my $search_database; + + for (@session_data) { + chomp; + push @file_list, $' if (/$proc_types{'newpaths'}:/); #' + $search_database = $' if (/$proc_types{'searchdb'}:/); #' + } + + if (!@file_list) { + push @messages, "There are no files to update!"; + push @messages, "Please 'Select' file(s) to process."; + return 'updatepaths'; + } + + # Build commands + # + # updateAllPaths.pl [OPTIONS] <FILES> + my @commands; + for my $file (@file_list) { + my $command = ''; + my $options = '--verbose 1'; + my $out_file = $file; + + my $fdir = dirname($file); + + $options .= ' --database='.$search_database if $search_database; + + $command = "$command{updateallpaths} $options $file"; + $command = "$command{chdir} $fdir; " . $command; + + push @commands, ($command, $out_file); + + } + + return &prepareCommands('updatepaths',@commands); + +} + + +######################################################################## # generateLibraConditionFile # # Write a condition.xml file using user-supplied parameters @@ -3419,11 +3585,12 @@ # navigation tabs and menus my $page_list = ""; my @sections = ( - { name => 'Home', pages=> 'account,mzxml,filebrowser,spectrastlib'}, + { name => 'Home', pages=> 'account,chargefile,mzxml,decoyvalpeps,filebrowser,spectrastlib'}, { name => 'Account', pages=> 'account,sessions'}, + { name => 'Pre-Process', pages=> 'chargefile,mergecharges'}, { name => 'Analysis Pipeline', pages=> 'mzxml,msconvert,runsearch,topepxml,xinteract,iprophet,runprophet'}, { name => 'Decoy', pages=> 'decoyvalpeps,decoyvalprots,decoyfasta'}, - { name => 'Utilities', pages=> 'filebrowser,mzxml2search,dta2mzxml,qualscore,conditionxml'}, + { name => 'Utilities', pages=> 'filebrowser,mzxml2search,dta2mzxml,updatepaths,qualscore,conditionxml'}, { name => 'SpectraST Tools', pages=> 'spectrastlib,getspeclibs,lib2html'} ); if ($pipeline eq 'Mascot') { @@ -3438,6 +3605,8 @@ home => 'Home', account => 'Manage My Account', sessions => 'Manage Session(s)', + chargefile => 'Create Charge Files', + mergecharges=>'Merge Charges', mzxml => 'mzXML', msconvert => 'mzML*', runsearch => 'Database Search', @@ -3451,6 +3620,7 @@ filebrowser=> 'Browse Files', mzxml2search=> 'Convert mzXML Files', dta2mzxml => 'dta to mzXML', + updatepaths=> 'Update Paths', decoyfasta => 'Decoy Databases', decoyvalpeps => 'Decoy Peptide Validation', decoyvalprots => 'Decoy Protein Validation', @@ -3523,6 +3693,7 @@ if ($page eq 'home') { #special case... $tabs{account} = 'ACCOUNT'; + $tabs{chargefile} = 'PRE-PROCESS'; $tabs{mzxml} = 'ANALYSIS PIPELINE'; $tabs{decoyvalpeps}= 'DECOY'; $tabs{filebrowser} = 'UTILITIES'; @@ -5854,6 +6025,93 @@ ######################################################################## +# pageCreateChargeFile +# +# The createChargeFile page +# +######################################################################## +sub pageCreateChargeFile { + + Delete('file_ext'); + Delete('proc_type'); # otherwise it gets set wrong for sequest params file select + + # files to process (from session) + my $any_files_there = &showFiles('tocharge','chargefile','DIRS','1. Specify Directories with .dta File(s) from which to extract charges'); + + + Delete('file_ext'); + Delete('proc_type'); # delete these... + + # files to process (from session) + $any_files_there += &showFiles('tocharge','chargefile','ms2','2. Specify .ms2 files from which to extract charges'); + + + print + start_form('POST',$tpp_url), + br, + &printTitle(title=>'3. Create .charge files!'), + "<div class=formentry>"; + + if ($any_files_there) { + print + submit(-name=>'Action', + -value=>$web_actions{'chargefile'}); + } else { + print + h2('No files selected yet.'); + } + + print + endform, + "</div>\n"; + +} + + +######################################################################## +# pageMergeCharges +# +# The mergeCharges page +# +######################################################################## +sub pageMergeCharges { + + Delete('file_ext'); + Delete('proc_type'); # otherwise it gets set wrong for sequest params file select + + # files to process (from session) + my $any_files_there = &showFiles('runsearch','mergecharges','mzxml','1. Specify mz[X]ML File(s) into which to insert updated charges'); + + Delete('file_ext'); + Delete('proc_type'); # delete these... + + # files to process (from session) + my $any_charges_there = &showFiles('chargefile','mergecharges','charge','2. Specify .charge files with updated charge information'); + + + print + start_form('POST',$tpp_url), + br, + &printTitle(title=>'3. Update charge information!'), + "<div class=formentry>"; + + if ($any_files_there && $any_charges_there) { + print + submit(-name=>'Action', + -value=>$web_actions{'mergecharges'}); + } else { + print + h2('No files selected yet.'); + } + + print + endform, + "</div>\n"; + +} + + +######################################################################## # pageMzXml # # The mzXML converter page @@ -7046,6 +7304,48 @@ ######################################################################## +# pageUpdateAllPaths +# +# Specify files that need to have internal paths updated (pepXML, protXML, etc...) +# +######################################################################## +sub pageUpdateAllPaths { + + Delete('file_ext'); + Delete('proc_type'); # delete these... + + # files to process (from session) + my $any_files_there = &showFiles('newpaths','updatepaths','*','1. Select File(s) with paths to be updated to current location'); + + Delete('file_ext'); + Delete('proc_type'); # otherwise it gets set wrong for database file select + + # search database file (from session) + my $db_file_there = &showFiles('searchdb','updatepaths','*','2. [ optional ] Specify new location of search database'); + + + print + start_form('POST',$tpp_url), + br, + &printTitle(title=>'3. Update files!'), + "<div class=formentry>"; + + if ($any_files_there) { + print + submit(-name=>'Action', + -value=>$web_actions{'updatePaths'}); + } else { + print + h2('No files selected yet.'); + } + + print + endform, + "</div>\n"; +} + + +######################################################################## # pageResults # # Display command output and links to results This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |