From: <pcb...@us...> - 2010-07-16 18:29:32
|
Revision: 5063 http://sashimi.svn.sourceforge.net/sashimi/?rev=5063&view=rev Author: pcbrefugee Date: 2010-07-16 18:29:25 +0000 (Fri, 16 Jul 2010) Log Message: ----------- [pwiz] sync up to ProteoWizard rev 2117 - contains fixes for reading mzXML files with broken indexes. Thought I'd done this at pwiz rev 2112 but it failed due to size of commit, so trying again in pieces. This is piece 5 of 5. Revision Links: -------------- http://sashimi.svn.sourceforge.net/sashimi/?rev=2117&view=rev http://sashimi.svn.sourceforge.net/sashimi/?rev=2112&view=rev Modified Paths: -------------- trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/Jamroot.jam trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/Dialogs/OpenDataSourceDialog.cs trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/Jamfile.jam trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/seems.csproj trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/Jamfile.jam trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/chainsaw.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msaccess.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msconvert.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msdiff.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msdir.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msistats.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/mspicture.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/mzidtxt.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/peakaboo.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/pep2mzid.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/pepsum.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/tab2mzid.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/common/FullReaderList.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/common/MSDataAnalyzerApplication.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/common/MSDataAnalyzerApplicationTest.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/hello_analyzer.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/hello_analyzer_2.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/hello_msdata.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/hello_ramp.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/msbenchmark.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/mscat.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/txt2mzml.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/write_example_files.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/write_mzid_example_files.cpp trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/examples/write_traml_example_files.cpp Modified: trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/Jamroot.jam =================================================================== --- trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/Jamroot.jam 2010-07-16 18:26:57 UTC (rev 5062) +++ trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/Jamroot.jam 2010-07-16 18:29:25 UTC (rev 5063) @@ -1,5 +1,5 @@ # -# $Id: Jamroot.jam 2043 2010-06-11 19:46:18Z chambm $ +# $Id: Jamroot.jam 2117 2010-07-13 21:47:50Z frewen $ # # # Original author: Darren Kessner <da...@pr...> @@ -44,8 +44,8 @@ import testing ; # needed to enable unit-test rule import feature ; # needed for install rules +import package ; # needed for package install - if --teamcity-test-decoration in [ modules.peek : ARGV ] { if [ modules.peek : NT ] @@ -123,6 +123,9 @@ <toolset>msvc:<cxxflags>/wd4275 # warning: non dll-interface class 'base' used as base for dll-interface class 'derived' <toolset>msvc:<cxxflags>/wd4702 # warning: unreachable code (boost::lexical_cast) + # warning: _SECURE_SCL_THROWS is deprecated + <toolset>msvc:<define>_SILENCE_DEPRECATION_OF_SECURE_SCL_THROWS + # special gcc hack - Cygwin gcc 3.4.4, Ubuntu gcc 4.1.2 # warning: '__cur' might be used uninitialized in this function <toolset>gcc:<cxxflags>-Wno-uninitialized @@ -135,7 +138,8 @@ # allow "long long" even with -pedantic <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long - + + # any GCC executable that uses shared libraries must have all its code built with -fPIC <conditional>@static-with-fpic # don't call 'strip' -- causes 'Bus error' in some cases @@ -381,6 +385,8 @@ path-constant BOOST_SOURCE : $(boost_src) ; path-constant ZLIB_SOURCE : $(zlib_src) ; +using ext-boost : 1.43.0 : $(BOOST_SOURCE) : <zlib-src-location>$(ZLIB_SOURCE) ; + # HACK: bug in boost::iostreams 1.43 requires this little patch to support building with link=shared # Boost bug ticket: https://svn.boost.org/trac/boost/ticket/4335 if [ modules.peek : NT ] @@ -389,9 +395,7 @@ echo [ SHELL "copy /Y $(PWIZ_LIBRARIES_PATH)\\boost_aux\\file_descriptor.hpp $(PWIZ_LIBRARIES_PATH)\\boost_1_43_0\\boost\\iostreams\\device" ] ; } -using ext-boost : 1.43.0 : $(BOOST_SOURCE) : <zlib-src-location>$(ZLIB_SOURCE) ; - rule project-exists ( project-path ) { if [ path.exists $(project-path) ] && @@ -522,6 +526,36 @@ ; explicit msconvert ; +# for copying all libraries and headers to one dir each +alias libraries : install-pwiz-lib install-boost-headers ; +explicit libraries ; + +# default install location +local default-prefix = /usr/local ; # LINUX, MACOS +if [ modules.peek : NT ] { default-prefix = "C:\\" ; } +# set the default option value to be used when building the lib tarball +option.set prefix : $(default-prefix) ; + +local headers = [ path.glob-tree pwiz : *.h *.hpp : .svn ] ; +package.install install-pwiz-lib + : <install-source-root>$(PWIZ_ROOT_PATH) + : # executables + : pwiz + : $(headers) + ; +explicit install-pwiz-lib ; + +# move boost headers separately because install-source-root is different +local boost_headers = [ path.glob-tree $(BOOST_SOURCE)/boost : *.h *.hpp : .svn ] ; +package.install install-boost-headers + : <install-source-root>$(BOOST_SOURCE) + : # exe + : # lib + : $(boost_headers) + ; +explicit install-boost-headers ; + + # any GCC executable that uses shared libraries must have all its code built with -fPIC rule static-with-fpic ( properties * ) @@ -548,6 +582,8 @@ import common ; import property-set ; import sequence ; +import option ; +import property ; .common-location = $(PWIZ_BUILD_PATH) ; @@ -586,7 +622,45 @@ <conditional>@binary-tarball-requirements ; +rule library-tarball-requirements ( properties * ) +{ + local toolsets = [ feature.get-values <toolset> : $(properties) ] ; + local variants = [ feature.get-values <variant> : $(properties) ] ; + + # require that the location come from --prefix or default; do not allow --libdir or --includedir + if [ MATCH --libdir=(.*) : [ modules.peek : ARGV ] ] || + [ MATCH --includedir=(.*) : [ modules.peek : ARGV ] ] + { + echo "--libdir and --includedir are not supported for pwiz-lib.tar.bz2; use --prefix instead" ; + exit ; + } + local prefix = [ option.get prefix ] ; + local location = $(prefix:G=) ; + + local non-redistributables = + *ABSciex.DataAccess.WiffFileDataReader.dll *Clear?ore*.dll *rscoree.dll # ABI API + *DACServer.dll *genutil.dll *raw.dll *RawCsm.dll *Security*.dll *MetaGD32.dll *MassLynxRaw.dll ; # Waters API + + non-redistributables = [ sequence.join $(non-redistributables) : "&&exclude:" ] ; + local result = <tar-source>path-anchor:$(location)&&exclude:$(non-redistributables)&&$(location) ; + if ! <architecture> in $(properties:G) { properties += <architecture>$(.platform:L) ; } + local linkage ; + if <link>shared in $(properties) { linkage = "-shared" ; } + local name = [ common.format-name <base> <property:target-os> <property:architecture> <toolset> <property:variant> $(linkage) -$(version-tag:J=_) + : pwiz-lib : TBZ2 : [ property-set.create $(properties) ] ] ; + result += <name>$(name) <dependency>libraries <location>$(.common-location) ; + return $(result) ; +} + +tar.create pwiz-lib.tar.bz2 + : # sources are handled by the conditional + + : # requirements + <conditional>@library-tarball-requirements + ; +explicit pwiz-lib.tar.bz2 ; + # full source trees automatically build source tarballs if ! [ path.exists $(PWIZ_ROOT_PATH)/SUBSET ] @@ -630,6 +704,7 @@ exclude:*.bak exclude:cvgen*.exe exclude:svnrev.hpp + exclude:Version.cpp exclude:Reader_*_Test.data exclude:example_data/small* # large files in example_data exclude:bootstrap exclude:bin.* # boost-build intermediate directories Modified: trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/Dialogs/OpenDataSourceDialog.cs =================================================================== --- trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/Dialogs/OpenDataSourceDialog.cs 2010-07-16 18:26:57 UTC (rev 5062) +++ trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/Dialogs/OpenDataSourceDialog.cs 2010-07-16 18:29:25 UTC (rev 5063) @@ -1,5 +1,5 @@ // -// $Id: OpenDataSourceDialog.cs 1785 2010-02-02 22:57:03Z chambm $ +// $Id: OpenDataSourceDialog.cs 2088 2010-06-29 15:09:14Z chambm $ // // // Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu> @@ -30,7 +30,7 @@ using System.Xml; using System.Threading; using pwiz.CLI.cv; -using pwiz.CLI.data; +using pwiz.CLI.data; using pwiz.CLI.msdata; using pwiz.MSGraph; @@ -606,6 +606,9 @@ int driveCount = 0; foreach( DriveInfo driveInfo in DriveInfo.GetDrives() ) { + // skip this drive if there's a problem accessing its properties + try { var foo = driveInfo.VolumeLabel; } catch { continue; } + string label; string sublabel = driveInfo.Name; driveReadiness[sublabel] = driveInfo.IsReady; Modified: trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/Jamfile.jam =================================================================== --- trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/Jamfile.jam 2010-07-16 18:26:57 UTC (rev 5062) +++ trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/Jamfile.jam 2010-07-16 18:29:25 UTC (rev 5063) @@ -1,5 +1,5 @@ # -# $Id: Jamfile.jam 2016 2010-06-08 18:35:36Z brendanx $ +# $Id: Jamfile.jam 2080 2010-06-23 20:51:50Z chambm $ # # # Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu> @@ -25,69 +25,69 @@ { import path feature svnrev sequence ; path-constant SEEMS_PATH : $(PWIZ_ROOT_PATH)/pwiz_tools/SeeMS ; - - - # rule for generating a C# AssemblyInfo file - rule generate-AssemblyInfo.cs ( filepath ? : sources-with-rcs-keywords + : warn-on-missing ? : print-revision-info ? : - AssemblyTitle AssemblyDescription AssemblyCompany AssemblyProduct ) - { - # default filepath is "Properties/AssemblyInfo.cs" in the current directory - filepath ?= Properties/AssemblyInfo.cs ; - - if $(print-revision-info) { echo Generating/updating version in $(filepath) ; } - - local existing-revision-info ; - if [ path.exists $(filepath) ] - { - existing-revision-info = [ svnrev.get-revision-info $(filepath) ] ; - if $(print-revision-info) { echo Existing maximum revision: $(existing-revision-info) ; } - } - - sources-with-rcs-keywords = [ sequence.transform path.native : $(sources-with-rcs-keywords) ] ; - local revision-info = [ svnrev.get-revision-info $(sources-with-rcs-keywords) - : $(warn-on-missing) : $(print-revision-info) ] ; - - if $(print-revision-info) { echo Current maximum revision: $(revision-info) ; } - - if ! $(existing-revision-info) || - $(existing-revision-info[1]) != $(revision-info[1]) - { - local AssemblyCopyright = "Copyright \xA9 $(AssemblyCompany) $(revision-info[2])" ; - - local header-text = - "// This file was generated by the \"svnrev\" utility - // You should not modify it manually, as it may be re-generated. - // - // $Revision: $(revision-info[1]) $ - // $Date: $(revision-info[2])-$(revision-info[3])-$(revision-info[4]) $ - // - - using System.Reflection; - using System.Runtime.CompilerServices; - using System.Runtime.InteropServices; - - [assembly: AssemblyTitle(\"$(AssemblyTitle)\")] - [assembly: AssemblyDescription(\"$(AssemblyDescription)\")] - [assembly: AssemblyCompany(\"$(AssemblyCompany)\")] - [assembly: AssemblyProduct(\"$(AssemblyProduct)\")] - [assembly: AssemblyCopyright(\"$(AssemblyCopyright)\")] - [assembly: AssemblyVersion(\"$(PWIZ_MAJOR).$(PWIZ_MINOR).$(revision-info[1])\")] - [assembly: AssemblyFileVersion(\"$(PWIZ_MAJOR).$(PWIZ_MINOR).$(revision-info[1])\")] - " ; - - header-text = @($(filepath):E=$(header-text)) ; - } - - return $(revision-info) ; - } - - # generate SeeMS version header - generate-AssemblyInfo.cs $(SEEMS_PATH)/Properties/AssemblyInfo.cs : - [ path.glob-tree $(SEEMS_PATH) : *.jam *.cs ] - : #warn-on-missing - : : "SeeMS" "A visualization, annotation, and processing tool for mass spectrometry data." "Vanderbilt University" "SeeMS" ; + # rule for generating a C# AssemblyInfo file + rule generate-AssemblyInfo.cs ( filepath ? : sources-with-rcs-keywords + : warn-on-missing ? : print-revision-info ? : + AssemblyTitle AssemblyDescription AssemblyCompany AssemblyProduct ) + { + # default filepath is "Properties/AssemblyInfo.cs" in the current directory + filepath ?= Properties/AssemblyInfo.cs ; + + if $(print-revision-info) { echo Generating/updating version in $(filepath) ; } + + local existing-revision-info ; + if [ path.exists $(filepath) ] + { + existing-revision-info = [ svnrev.get-revision-info $(filepath) ] ; + if $(print-revision-info) { echo Existing maximum revision: $(existing-revision-info) ; } + } + + sources-with-rcs-keywords = [ sequence.transform path.native : $(sources-with-rcs-keywords) ] ; + local revision-info = [ svnrev.get-revision-info $(sources-with-rcs-keywords) + : $(warn-on-missing) : $(print-revision-info) ] ; + + if $(print-revision-info) { echo Current maximum revision: $(revision-info) ; } + + if ! $(existing-revision-info) || + $(existing-revision-info[1]) != $(revision-info[1]) + { + local AssemblyCopyright = "Copyright \xA9 $(AssemblyCompany) $(revision-info[2])" ; + + local header-text = + "// This file was generated by the \"svnrev\" utility + // You should not modify it manually, as it may be re-generated. + // + // $Revision: $(revision-info[1]) $ + // $Date: $(revision-info[2])-$(revision-info[3])-$(revision-info[4]) $ + // + + using System.Reflection; + using System.Runtime.CompilerServices; + using System.Runtime.InteropServices; + + [assembly: AssemblyTitle(\"$(AssemblyTitle)\")] + [assembly: AssemblyDescription(\"$(AssemblyDescription)\")] + [assembly: AssemblyCompany(\"$(AssemblyCompany)\")] + [assembly: AssemblyProduct(\"$(AssemblyProduct)\")] + [assembly: AssemblyCopyright(\"$(AssemblyCopyright)\")] + [assembly: AssemblyVersion(\"$(PWIZ_MAJOR).$(PWIZ_MINOR).$(revision-info[1])\")] + [assembly: AssemblyFileVersion(\"$(PWIZ_MAJOR).$(PWIZ_MINOR).$(revision-info[1])\")] + " ; + + header-text = @($(filepath):E=$(header-text)) ; + } + + return $(revision-info) ; + } + + # generate SeeMS version header + generate-AssemblyInfo.cs $(SEEMS_PATH)/Properties/AssemblyInfo.cs : + [ path.glob-tree $(SEEMS_PATH) : *.jam *.cs ] + : #warn-on-missing + : : "SeeMS" "A visualization, annotation, and processing tool for mass spectrometry data." "Vanderbilt University" "SeeMS" ; + + rule do_seems_build ( targets + : sources * : properties * ) { if <variant>debug in $(properties) || @@ -147,8 +147,8 @@ : # requirements <toolset>msvc:<assembly>../../pwiz/utility/bindings/CLI//pwiz_bindings_cli <conditional>@build-location + <address-model>64:<build>no <dependency>../../pwiz/utility/bindings/CLI//pwiz_bindings_cli/<location>$(SEEMS_PATH)/obj <dependency>../../pwiz/utility/bindings/CLI//pwiz_bindings_cli.xml/<location>$(SEEMS_PATH)/obj - <dependency>../../pwiz_aux/msrc/utility/vendor_api/Waters//install_pwiz_vendor_api_waters_masslynxraw/<location>$(SEEMS_PATH) ; } Modified: trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/seems.csproj =================================================================== --- trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/seems.csproj 2010-07-16 18:26:57 UTC (rev 5062) +++ trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/SeeMS/seems.csproj 2010-07-16 18:29:25 UTC (rev 5063) @@ -2,7 +2,7 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{2399F68B-D886-4D94-AB4B-700FE3E46849}</ProjectGuid> <OutputType>WinExe</OutputType> @@ -277,9 +277,6 @@ </EmbeddedResource> </ItemGroup> <ItemGroup> - <Content Include="MassLynxRaw.dll"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> <Content Include="Misc\Centroider.ico" /> <None Include="Misc\ChromatogramDataSet.xsc"> <DependentUpon>ChromatogramDataSet.xsd</DependentUpon> Modified: trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/Jamfile.jam =================================================================== --- trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/Jamfile.jam 2010-07-16 18:26:57 UTC (rev 5062) +++ trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/Jamfile.jam 2010-07-16 18:29:25 UTC (rev 5063) @@ -1,5 +1,5 @@ # -# $Id: Jamfile.jam 2038 2010-06-10 23:15:13Z broter $ +# $Id: Jamfile.jam 2099 2010-07-02 20:13:54Z broter $ # # # Original author: Darren Kessner <da...@pr...> @@ -60,6 +60,7 @@ ../../pwiz/utility/misc//pwiz_utility_image mstool-requirements : <include>../../.. + <address-model>64:<build>no ; @@ -70,24 +71,26 @@ ../../pwiz/utility/misc//pwiz_utility_image mstool-requirements : <include>../../.. + <address-model>64:<build>no ; -exe mzidtxt - : mzidtxt.cpp - ../../pwiz//pwiz_version - ../../pwiz/data/mziddata//pwiz_data_mzid +exe mzidtxt + : mzidtxt.cpp + ../../pwiz//pwiz_version + ../../pwiz/data/mziddata//pwiz_data_mzid /ext/boost//program_options - : <include>../../.. - ; - - + : <include>../../.. + ; + + exe pepsum : pepsum.cpp ../../pwiz/analysis/peptideid//pwiz_analysis_peptideid ../../pwiz/utility/misc//pwiz_utility_image mstool-requirements : <include>../../.. + <address-model>64:<build>no ; @@ -106,13 +109,13 @@ ; -exe chainsaw - : chainsaw.cpp - ../../pwiz/data/proteome//pwiz_data_proteome - ../../pwiz//pwiz_version +exe chainsaw + : chainsaw.cpp + ../../pwiz/data/proteome//pwiz_data_proteome + ../../pwiz//pwiz_version /ext/boost//program_options /ext/boost//filesystem - : <include>../../.. + : <include>../../.. ; @@ -121,16 +124,16 @@ # ../../pwiz/data/mziddata//pwiz_data_mzid # : <include>../../.. # ; - - + + exe pep2mzid : pep2mzid.cpp - ../../pwiz/data/mziddata//pwiz_data_mzid + ../../pwiz/data/mziddata//pwiz_data_mzid /ext/boost//program_options : <include>../../.. ; - - + + alias mstools : msdiff msconvert msdir msaccess mspicture peakaboo chainsaw ; Modified: trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/chainsaw.cpp =================================================================== --- trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/chainsaw.cpp 2010-07-16 18:26:57 UTC (rev 5062) +++ trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/chainsaw.cpp 2010-07-16 18:29:25 UTC (rev 5063) @@ -1,5 +1,5 @@ // -// $Id: chainsaw.cpp 1706 2010-01-15 23:44:27Z chambm $ +// $Id: chainsaw.cpp 2051 2010-06-15 18:39:13Z chambm $ // /// chainsaw.cpp /// @@ -11,16 +11,13 @@ #include "pwiz/Version.hpp" #include "pwiz/utility/misc/Filesystem.hpp" #include "pwiz/utility/misc/DateTime.hpp" +#include "pwiz/utility/misc/Std.hpp" #include "boost/program_options.hpp" -#include <iostream> -#include <fstream> -#include <string> -using namespace std; + using namespace pwiz::cv; using namespace pwiz::proteome; using namespace pwiz::util; -using boost::shared_ptr; struct Config { Modified: trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msaccess.cpp =================================================================== --- trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msaccess.cpp 2010-07-16 18:26:57 UTC (rev 5062) +++ trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msaccess.cpp 2010-07-16 18:29:25 UTC (rev 5063) @@ -1,183 +1,178 @@ -// -// $Id: msaccess.cpp 1875 2010-03-08 16:58:42Z chambm $ -// -// -// Original author: Darren Kessner <da...@pr...> -// -// Copyright 2008 Spielberg Family Center for Applied Proteomics -// Cedars Sinai Medical Center, Los Angeles, California 90048 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - - -#include "pwiz_tools/common/MSDataAnalyzerApplication.hpp" -#include "pwiz/analysis/passive/MSDataCache.hpp" -#include "pwiz/analysis/passive/MetadataReporter.hpp" -#include "pwiz/analysis/passive/RunSummary.hpp" -#include "pwiz/analysis/passive/SpectrumTable.hpp" -#include "pwiz/analysis/passive/SpectrumBinaryData.hpp" -#include "pwiz/analysis/passive/RegionSlice.hpp" -#include "pwiz/analysis/passive/RegionTIC.hpp" -#include "pwiz/analysis/passive/RegionSIC.hpp" -#include "pwiz/analysis/passive/Pseudo2DGel.hpp" -#include "pwiz/Version.hpp" -#include <iostream> -#include <iterator> -#include <stdexcept> - - -using namespace pwiz::analysis; -using boost::shared_ptr; -using namespace std; - - -template <typename analyzer_type> -void printCommandUsage(ostream& os) -{ - os << " " << analyzer_strings<analyzer_type>::id() - << " " << analyzer_strings<analyzer_type>::argsFormat() << endl - << " (" << analyzer_strings<analyzer_type>::description() << ")\n"; - - vector<string> usage = analyzer_strings<analyzer_type>::argsUsage(); - for (vector<string>::const_iterator it=usage.begin(); it!=usage.end(); ++it) - os << " " << *it << endl; - - os << endl; -} - - -void initializeAnalyzers(MSDataAnalyzerContainer& analyzers, - const vector<string>& commands) -{ - shared_ptr<MSDataCache> cache(new MSDataCache); - analyzers.push_back(cache); - - for (vector<string>::const_iterator it=commands.begin(); it!=commands.end(); ++it) - { - string name, args; - istringstream iss(*it); - iss >> name; - getline(iss, args); - - if (name == analyzer_strings<MetadataReporter>::id()) - { - MSDataAnalyzerPtr anal(new MetadataReporter); - analyzers.push_back(anal); - } - else if (name == analyzer_strings<RunSummary>::id()) - { - MSDataAnalyzerPtr anal(new RunSummary(*cache, args)); - analyzers.push_back(anal); - } - else if (name == analyzer_strings<SpectrumTable>::id()) - { - MSDataAnalyzerPtr anal(new SpectrumTable(*cache, args)); - analyzers.push_back(anal); - } - else if (name == analyzer_strings<SpectrumBinaryData>::id()) - { - MSDataAnalyzerPtr anal(new SpectrumBinaryData(*cache, args)); - analyzers.push_back(anal); - } - else if (name == analyzer_strings<RegionSlice>::id()) - { - MSDataAnalyzerPtr anal(new RegionSlice(*cache, args)); - analyzers.push_back(anal); - } - else if (name == analyzer_strings<RegionTIC>::id()) - { - MSDataAnalyzerPtr anal(new RegionTIC(*cache, args)); - analyzers.push_back(anal); - } - else if (name == analyzer_strings<RegionSIC>::id()) - { - MSDataAnalyzerPtr anal(new RegionSIC(*cache, args)); - analyzers.push_back(anal); - } - else if (name == analyzer_strings<Pseudo2DGel>::id()) - { - MSDataAnalyzerPtr anal(new Pseudo2DGel(*cache, args)); - analyzers.push_back(anal); - } - else - { - cerr << "Unknown analyzer: " << name << endl; - } - } -} - - -string usage(const MSDataAnalyzerApplication& app) -{ - ostringstream oss; - - oss << "Usage: msaccess [options] [filenames]\n" - << "MassSpecAccess - command line access to mass spec data files\n" - << "\n" - << "Options:\n" - << "\n" - << app.usageOptions - << "\n" - << "Commands:\n" - << "\n"; - - printCommandUsage<MetadataReporter>(oss); - printCommandUsage<RunSummary>(oss); - printCommandUsage<SpectrumTable>(oss); - printCommandUsage<SpectrumBinaryData>(oss); - printCommandUsage<RegionSlice>(oss); - printCommandUsage<RegionTIC>(oss); - printCommandUsage<RegionSIC>(oss); - printCommandUsage<Pseudo2DGel>(oss); - - oss << endl - << "Questions, comments, and bug reports:\n" - << "http://proteowizard.sourceforge.net\n" - << "su...@pr...\n" - << "\n" - << "ProteoWizard release: " << pwiz::Version::str() << endl - << "Build date: " << __DATE__ << " " << __TIME__ << endl; - - return oss.str(); -} - - -int main(int argc, const char* argv[]) -{ - try - { - MSDataAnalyzerApplication app(argc, argv); - MSDataAnalyzerContainer analyzers; - initializeAnalyzers(analyzers, app.commands); - - if (app.filenames.empty() || app.commands.empty()) - throw runtime_error(usage(app).c_str()); - - app.run(analyzers, &cerr); - - return 0; - } - catch (exception& e) - { - cerr << e.what() << endl; - } - catch (...) - { - cerr << "Caught unknown exception.\n"; - } - - return 1; -} - - +// +// $Id: msaccess.cpp 2051 2010-06-15 18:39:13Z chambm $ +// +// +// Original author: Darren Kessner <da...@pr...> +// +// Copyright 2008 Spielberg Family Center for Applied Proteomics +// Cedars Sinai Medical Center, Los Angeles, California 90048 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + + +#include "pwiz_tools/common/MSDataAnalyzerApplication.hpp" +#include "pwiz/analysis/passive/MSDataCache.hpp" +#include "pwiz/analysis/passive/MetadataReporter.hpp" +#include "pwiz/analysis/passive/RunSummary.hpp" +#include "pwiz/analysis/passive/SpectrumTable.hpp" +#include "pwiz/analysis/passive/SpectrumBinaryData.hpp" +#include "pwiz/analysis/passive/RegionSlice.hpp" +#include "pwiz/analysis/passive/RegionTIC.hpp" +#include "pwiz/analysis/passive/RegionSIC.hpp" +#include "pwiz/analysis/passive/Pseudo2DGel.hpp" +#include "pwiz/Version.hpp" +#include "pwiz/utility/misc/Std.hpp" + +using namespace pwiz::analysis; + + +template <typename analyzer_type> +void printCommandUsage(ostream& os) +{ + os << " " << analyzer_strings<analyzer_type>::id() + << " " << analyzer_strings<analyzer_type>::argsFormat() << endl + << " (" << analyzer_strings<analyzer_type>::description() << ")\n"; + + vector<string> usage = analyzer_strings<analyzer_type>::argsUsage(); + for (vector<string>::const_iterator it=usage.begin(); it!=usage.end(); ++it) + os << " " << *it << endl; + + os << endl; +} + + +void initializeAnalyzers(MSDataAnalyzerContainer& analyzers, + const vector<string>& commands) +{ + shared_ptr<MSDataCache> cache(new MSDataCache); + analyzers.push_back(cache); + + for (vector<string>::const_iterator it=commands.begin(); it!=commands.end(); ++it) + { + string name, args; + istringstream iss(*it); + iss >> name; + getline(iss, args); + + if (name == analyzer_strings<MetadataReporter>::id()) + { + MSDataAnalyzerPtr anal(new MetadataReporter); + analyzers.push_back(anal); + } + else if (name == analyzer_strings<RunSummary>::id()) + { + MSDataAnalyzerPtr anal(new RunSummary(*cache, args)); + analyzers.push_back(anal); + } + else if (name == analyzer_strings<SpectrumTable>::id()) + { + MSDataAnalyzerPtr anal(new SpectrumTable(*cache, args)); + analyzers.push_back(anal); + } + else if (name == analyzer_strings<SpectrumBinaryData>::id()) + { + MSDataAnalyzerPtr anal(new SpectrumBinaryData(*cache, args)); + analyzers.push_back(anal); + } + else if (name == analyzer_strings<RegionSlice>::id()) + { + MSDataAnalyzerPtr anal(new RegionSlice(*cache, args)); + analyzers.push_back(anal); + } + else if (name == analyzer_strings<RegionTIC>::id()) + { + MSDataAnalyzerPtr anal(new RegionTIC(*cache, args)); + analyzers.push_back(anal); + } + else if (name == analyzer_strings<RegionSIC>::id()) + { + MSDataAnalyzerPtr anal(new RegionSIC(*cache, args)); + analyzers.push_back(anal); + } + else if (name == analyzer_strings<Pseudo2DGel>::id()) + { + MSDataAnalyzerPtr anal(new Pseudo2DGel(*cache, args)); + analyzers.push_back(anal); + } + else + { + cerr << "Unknown analyzer: " << name << endl; + } + } +} + + +string usage(const MSDataAnalyzerApplication& app) +{ + ostringstream oss; + + oss << "Usage: msaccess [options] [filenames]\n" + << "MassSpecAccess - command line access to mass spec data files\n" + << "\n" + << "Options:\n" + << "\n" + << app.usageOptions + << "\n" + << "Commands:\n" + << "\n"; + + printCommandUsage<MetadataReporter>(oss); + printCommandUsage<RunSummary>(oss); + printCommandUsage<SpectrumTable>(oss); + printCommandUsage<SpectrumBinaryData>(oss); + printCommandUsage<RegionSlice>(oss); + printCommandUsage<RegionTIC>(oss); + printCommandUsage<RegionSIC>(oss); + printCommandUsage<Pseudo2DGel>(oss); + + oss << endl + << "Questions, comments, and bug reports:\n" + << "http://proteowizard.sourceforge.net\n" + << "su...@pr...\n" + << "\n" + << "ProteoWizard release: " << pwiz::Version::str() << endl + << "Build date: " << __DATE__ << " " << __TIME__ << endl; + + return oss.str(); +} + + +int main(int argc, const char* argv[]) +{ + try + { + MSDataAnalyzerApplication app(argc, argv); + MSDataAnalyzerContainer analyzers; + initializeAnalyzers(analyzers, app.commands); + + if (app.filenames.empty() || app.commands.empty()) + throw runtime_error(usage(app).c_str()); + + app.run(analyzers, &cerr); + + return 0; + } + catch (exception& e) + { + cerr << e.what() << endl; + } + catch (...) + { + cerr << "Caught unknown exception.\n"; + } + + return 1; +} + + Modified: trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msconvert.cpp =================================================================== --- trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msconvert.cpp 2010-07-16 18:26:57 UTC (rev 5062) +++ trunk/trans_proteomic_pipeline/extern/ProteoWizard/pwiz/pwiz_tools/commandline/msconvert.cpp 2010-07-16 18:29:25 UTC (rev 5063) @@ -1,670 +1,663 @@ -// -// $Id: msconvert.cpp 1857 2010-03-04 17:07:52Z chambm $ -// -// -// Original author: Darren Kessner <da...@pr...> -// -// Copyright 2008 Spielberg Family Center for Applied Proteomics -// Cedars-Sinai Medical Center, Los Angeles, California 90048 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - - -#include "pwiz_tools/common/FullReaderList.hpp" -#include "pwiz/data/msdata/MSDataFile.hpp" -#include "pwiz/data/msdata/MSDataMerger.hpp" -#include "pwiz/data/msdata/IO.hpp" -#include "pwiz/data/msdata/SpectrumInfo.hpp" -#include "pwiz/utility/misc/IterationListener.hpp" -#include "pwiz/analysis/spectrum_processing/SpectrumListFactory.hpp" -#include "pwiz/Version.hpp" -#include "pwiz/data/msdata/Version.hpp" -#include "pwiz/analysis/Version.hpp" -#include "boost/program_options.hpp" -#include "boost/foreach.hpp" -#include "pwiz/utility/misc/Filesystem.hpp" -#include "pwiz/utility/misc/random_access_compressed_ifstream.hpp" -#include <iostream> -#include <fstream> -#include <iterator> - - -using namespace std; -using namespace pwiz::cv; -using namespace pwiz::data; -using namespace pwiz::msdata; -using namespace pwiz::analysis; -using namespace pwiz::util; -using boost::shared_ptr; - - -struct Config -{ - vector<string> filenames; - vector<string> filters; - string outputPath; - string extension; - bool verbose; - MSDataFile::WriteConfig writeConfig; - string contactFilename; - bool merge; - - Config() - : outputPath("."), verbose(false), merge(false) - {} - - string outputFilename(const string& inputFilename, const MSData& inputMSData) const; -}; - - -string Config::outputFilename(const string& filename, const MSData& msd) const -{ - string runId = msd.run.id; - - // if necessary, adjust runId so it makes a suitable filename - if (runId.empty()) - runId = bfs::basename(filename); - else - { - string extension = bal::to_lower_copy(bfs::extension(runId)); - if (extension == ".mzml" || - extension == ".mzxml" || - extension == ".xml" || - extension == ".mgf" || - extension == ".ms2" || - extension == ".cms2") - runId = bfs::basename(runId); - } - - // this list is for Windows; it's a superset of the POSIX list - string illegalFilename = "\\/*:?<>|\""; - BOOST_FOREACH(char& c, runId) - if (illegalFilename.find(c) != string::npos) - c = '_'; - - bfs::path newFilename = runId + extension; - bfs::path fullPath = bfs::path(outputPath) / newFilename; - return fullPath.string(); -} - - -ostream& operator<<(ostream& os, const Config& config) -{ - os << "format: " << config.writeConfig << endl; - os << "outputPath: " << config.outputPath << endl; - os << "extension: " << config.extension << endl; - os << "contactFilename: " << config.contactFilename << endl; - os << endl; - - os << "filters:\n "; - copy(config.filters.begin(), config.filters.end(), ostream_iterator<string>(os,"\n ")); - os << endl; - - os << "filenames:\n "; - copy(config.filenames.begin(), config.filenames.end(), ostream_iterator<string>(os,"\n ")); - os << endl; - - return os; -} - - -Config parseCommandLine(int argc, const char* argv[]) -{ - namespace po = boost::program_options; - - ostringstream usage; - usage << "Usage: msconvert [options] [filemasks]\n" - << "Convert mass spec data file formats.\n" -#ifndef _MSC_VER - << "\n" - << "Note: the use of mass spec vendor DLLs is not enabled in this \n" - << "(non-MSVC) build, this means no Thermo, Bruker, Waters etc input.\n" -#endif - << "\n" - << "Return value: # of failed files.\n" - << "\n"; - - Config config; - string filelistFilename; - string configFilename; - - bool format_text = false; - bool format_mzML = false; - bool format_mzXML = false; - bool format_MGF = false; - bool format_MS2 = false; - bool format_CMS2 = false; - bool precision_32 = false; - bool precision_64 = false; - bool mz_precision_32 = false; - bool mz_precision_64 = false; - bool intensity_precision_32 = false; - bool intensity_precision_64 = false; - bool noindex = false; - bool zlib = false; - bool gzip = false; - - po::options_description od_config("Options"); - od_config.add_options() - ("filelist,f", - po::value<string>(&filelistFilename), - ": specify text file containing filenames") - ("outdir,o", - po::value<string>(&config.outputPath)->default_value(config.outputPath), - ": set output directory [.]") - ("config,c", - po::value<string>(&configFilename), - ": configuration file (optionName=value)") - ("ext,e", - po::value<string>(&config.extension)->default_value(config.extension), - ": set extension for output files [mzML|mzXML|mgf|txt]") - ("mzML", - po::value<bool>(&format_mzML)->zero_tokens(), - ": write mzML format [default]") - ("mzXML", - po::value<bool>(&format_mzXML)->zero_tokens(), - ": write mzXML format") - ("mgf", - po::value<bool>(&format_MGF)->zero_tokens(), - ": write Mascot generic format") - ("text", - po::value<bool>(&format_text)->zero_tokens(), - ": write ProteoWizard internal text format") - ("ms2", - po::value<bool>(&format_MS2)->zero_tokens(), - ": write MS2 format") - ("cms2", - po::value<bool>(&format_CMS2)->zero_tokens(), - ": write CMS2 format") - ("verbose,v", - po::value<bool>(&config.verbose)->zero_tokens(), - ": display detailed progress information") - ("64", - po::value<bool>(&precision_64)->zero_tokens(), - ": set default binary encoding to 64-bit precision [default]") - ("32", - po::value<bool>(&precision_32)->zero_tokens(), - ": set default binary encoding to 32-bit precision") - ("mz64", - po::value<bool>(&mz_precision_64)->zero_tokens(), - ": encode m/z values in 64-bit precision [default]") - ("mz32", - po::value<bool>(&mz_precision_32)->zero_tokens(), - ": encode m/z values in 32-bit precision") - ("inten64", - po::value<bool>(&intensity_precision_64)->zero_tokens(), - ": encode intensity values in 64-bit precision") - ("inten32", - po::value<bool>(&intensity_precision_32)->zero_tokens(), - ": encode intensity values in 32-bit precision [default]") - ("noindex", - po::value<bool>(&noindex)->zero_tokens(), - ": do not write index") - ("contactInfo,i", - po::value<string>(&config.contactFilename), - ": filename for contact info") - ("zlib,z", - po::value<bool>(&zlib)->zero_tokens(), - ": use zlib compression for binary data") - ("gzip,g", - po::value<bool>(&gzip)->zero_tokens(), - ": gzip entire output file (adds .gz to filename)") - ("filter", - po::value< vector<string> >(&config.filters), - ": add a spectrum list filter") - ("merge", - po::value<bool>(&config.merge)->zero_tokens(), - ": create a single output file from multiple input files by merging file-level metadata and concatenating spectrum lists") - ; - - // append options description to usage string - - usage << od_config; - - // extra usage - - usage << SpectrumListFactory::usage() << endl; - - usage << "Examples:\n" - << endl - << "# convert data.RAW to data.mzML\n" - << "msconvert data.RAW\n" - << endl - << "# convert data.RAW to data.mzXML\n" - << "msconvert data.RAW --mzXML\n" - << endl - << "# put output file in my_output_dir\n" - << "msconvert data.RAW -o my_output_dir\n" - << endl - << "# extract scan indices 5...10 and 20...25\n" - << "msconvert data.RAW --filter \"index [5,10] [20,25]\"\n" - << endl - << "# extract MS1 scans only\n" - << "msconvert data.RAW --filter \"msLevel 1\"\n" - << endl - << "# extract MS2 and MS3 scans only\n" - << "msconvert data.RAW --filter \"msLevel 2-3\"\n" - << endl - << "# extract MSn scans for n>1\n" - << "msconvert data.RAW --filter \"msLevel 2-\"\n" - << endl - << "# apply ETD precursor mass filter\n" - << "msconvert data.RAW --filter ETDFilter\n" - << endl - << "# keep only HCD spectra from a decision tree data file\n" - << "msconvert data.RAW --filter \"activation HCD\"\n" - << endl - << "# keep the top 42 peaks or samples (depending on whether spectra are centroid or profile):\n" - << "msconvert data.RAW --filter \"threshold count 42 most-intense\"\n" - << endl - << "# multiple filters: select scan numbers and recalculate precursors\n" - << "msconvert data.RAW --filter \"scanNumber [500,1000]\" --filter \"precursorRecalculation\"\n" - << endl - << "# multiple filters: apply peak picking and then keep the bottom 100 peaks:\n" - << "msconvert data.RAW --filter \"peakPicking true 1-\" --filter \"threshold count 100 least-intense\"\n" - << endl - << "# multiple filters: apply peak picking and then keep all peaks that are at least 50% of the intensity of the base peak:\n" - << "msconvert data.RAW --filter \"peakPicking true 1-\" --filter \"threshold bpi-relative .5 most-intense\"\n" - << endl - << "# use a configuration file\n" - << "msconvert data.RAW -c config.txt\n" - << endl - << "# example configuration file\n" - << "mzXML=true\n" - << "zlib=true\n" - << "filter=\"index [3,7]\"\n" - << "filter=\"precursorRecalculation\"\n" - << endl - << endl - - << "Questions, comments, and bug reports:\n" - << "http://proteowizard.sourceforge.net\n" - << "su...@pr...\n" - << "\n" - << "ProteoWizard release: " << pwiz::Version::str() << " (" << pwiz::Version::LastModified() << ")" << endl - << "ProteoWizard MSData: " << pwiz::msdata::Version::str() << " (" << pwiz::msdata::Version::LastModified() << ")" << endl - << "ProteoWizard Analysis: " << pwiz::analysis::Version::str() << " (" << pwiz::analysis::Version::LastModified() << ")" << endl - << "Build date: " << __DATE__ << " " << __TIME__ << endl; - - if (argc <= 1) - throw runtime_error(usage.str().c_str()); - - // handle positional arguments - - const char* label_args = "args"; - - po::options_description od_args; - od_args.add_options()(label_args, po::value< vector<string> >(), ""); - - po::positional_options_description pod_args; - pod_args.add(label_args, -1); - - po::options_description od_parse; - od_parse.add(od_config).add(od_args); - - // parse command line - - po::variables_map vm; - po::store(po::command_line_parser(argc, (char**)argv). - options(od_parse).positional(pod_args).run(), vm); - po::notify(vm); - - // parse config file if required - - if (!configFilename.empty()) - { - ifstream is(configFilename.c_str()); - - if (is) - { - cout << "Reading configuration file " << configFilename << "\n\n"; - po::store(parse_config_file(is, od_config), vm); - po::notify(vm); - } - else - { - cout << "Unable to read configuration file " << configFilename << "\n\n"; - } - } - - // remember filenames from command line - - if (vm.count(label_args)) - { - config.filenames = vm[label_args].as< vector<string> >(); - - // expand the filenames by globbing to handle wildcards - vector<bfs::path> globbedFilenames; - BOOST_FOREACH(const string& filename, config.filenames) - { - expand_pathmask(bfs::path(filename), globbedFilenames); - if (!globbedFilenames.size()) - { - cout << "[msconvert] no files found matching \"" << filename << "\""; - } - } - - config.filenames.clear(); - BOOST_FOREACH(const bfs::path& filename, globbedFilenames) - config.filenames.push_back(filename.string()); - } - - // parse filelist if required - - if (!filelistFilename.empty()) - { - ifstream is(filelistFilename.c_str()); - while (is) - { - string filename; - getline(is, filename); - if (is) config.filenames.push_back(filename); - } - } - - // check stuff - - if (config.filenames.empty()) - throw runtime_error("[msconvert] No files specified."); - - int count = format_text + format_mzML + format_mzXML + format_MGF + format_MS2 + format_CMS2; - if (count > 1) throw runtime_error("[msconvert] Multiple format flags specified."); - if (format_text) config.writeConfig.format = MSDataFile::Format_Text; - if (format_mzML) config.writeConfig.format = MSDataFile::Format_mzML; - if (format_mzXML) config.writeConfig.format = MSDataFile::Format_mzXML; - if (format_MGF) config.writeConfig.format = MSDataFile::Format_MGF; - if (format_MS2) config.writeConfig.format = MSDataFile::Format_MS2; - if (format_CMS2) config.writeConfig.format = MSDataFile::Format_CMS2; - - config.writeConfig.gzipped = gzip; // if true, file is written as .gz - - if (config.extension.empty()) - { - switch (config.writeConfig.format) - { - case MSDataFile::Format_Text: - config.extension = ".txt"; - break; - case MSDataFile::Format_mzML: - config.extension = ".mzML"; - break; - case MSDataFile::Format_mzXML: - config.extension = ".mzXML"; - break; - case MSDataFile::Format_MGF: - config.extension = ".mgf"; - break; - case MSDataFile::Format_MS2: - config.extension = ".ms2"; - break; - case MSDataFile::Format_CMS2: - config.extension = ".cms2"; - break; - default: - throw runtime_error("[msconvert] Unsupported format."); - } - if (config.writeConfig.gzipped) - { - config.extension += ".gz"; - } - } - - // precision defaults - - config.writeConfig.binaryDataEncoderConfig.precision = BinaryDataEncoder::Precision_64; - config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_m_z_array] = BinaryDataEncoder::Precision_64; - config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_intensity_array] = BinaryDataEncoder::Precision_32; - - // handle precision flags - - if (precision_32 && precision_64 || - mz_precision_32 && mz_precision_64 || - intensity_precision_32 && intensity_precision_64) - throw runtime_error("[msconvert] Incompatible precision flags."); - - if (precision_32) - { - config.writeConfig.binaryDataEncoderConfig.precision - = config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_m_z_array] - = config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_intensity_array] - = BinaryDataEncoder::Precision_32; - } - else if (precision_64) - { - config.writeConfig.binaryDataEncoderConfig.precision - = config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_m_z_array] - = config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_intensity_array] - = BinaryDataEncoder::Precision_64; - } - - if (mz_precision_32) - config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_m_z_array] = BinaryDataEncoder::Precision_32; - if (mz_precision_64) - config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_m_z_array] = BinaryDataEncoder::Precision_64; - if (intensity_precision_32) - config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_intensity_array] = BinaryDataEncoder::Precision_32; - if (intensity_precision_64) - config.writeConfig.binaryDataEncoderConfig.precisionOverrides[MS_intensity_array] = BinaryDataEncoder::Precision_64; - - // other flags - - if (noindex) - config.writeConfig.indexed = false; - - if (zlib) - config.writeConfig.binaryDataEncoderConfig.compression = BinaryDataEncoder::Compression_Zlib; - - return config; -} - - -void addContactInfo(MSData& msd, const string& contactFilename) -{ - ifstream is(contactFilename.c_str()); - if (!is) - { - cerr << "unable to read contact info: " << contactFilename << endl; - return; - } - - Contact contact; - IO::read(is, contact); - msd.fileDescription.contacts.push_back(contact); -} - - -class UserFeedbackIterationListener : public IterationListener -{ - public: - - virtual Status update(const UpdateMessage& updateMessage) - { - // add tabs to erase all of the previous line - cout << updateMessage.iterationIndex+1 << "/" << updateMessage.iterationCount << "\t\t\t\r" << flush; - - // spectrum and chromatogram lists both iterate; put them on different lines - if (updateMessage.iterationIndex+1 == updateMessage.iterationCount) - cout << endl; - return Status_Ok; - } -}; - - -void calculateSourceFilePtrSHA1(const SourceFilePtr& sourceFilePtr) -{ - calculateSourceFileSHA1(*sourceFilePtr); -} - - -int mergeFiles(const vector<string>& filenames, const Config& config, const ReaderList& readers) -{ - vector<MSDataPtr> msdList; - int failedFileCount = 0; - - BOOST_FOREACH(const string& filename, filenames) - { - try - { - cout << "processing file: " << filename << endl; - readers.read(filename, msdList); - } - catch (exception& e) - { - ++failedFileCount; - cerr << "Error reading file " << filename << ":\n" << e.what() << endl; - } - } - - // handle progress updates if requested - - IterationListenerRegistry iterationListenerRegistry; - UserFeedbackIterationListener feedback; - // update on the first spectrum, the last spectrum, the 100th spectrum, the 200th spectrum, etc. - const size_t iterationPeriod = 100; - iterationListenerRegistry.addListener(feedback, iterationPeriod); - IterationListenerRegistry* pILR = config.verbose ? &iterationListenerRegistry : 0; - - try - { - MSDataMerger msd(msdList); - - cout << "calculating source file checksums" << endl; - // calculate SHA1 checksums - for_each(msd.fileDescription.sourceFilePtrs.begin(), - msd.fileDescription.sourceFilePtrs.end(), - &calculateSourceFilePtrSHA1); - - if (!config.contactFilename.empty()) - addContactInfo(msd, config.contactFilename); - - SpectrumListFactory::wrap(msd, config.filters); - - string outputFilename = config.outputFilename("merged-spectra", msd); - cout << "writing output file: " << outputFilename << endl; - - MSDataFile::write(msd, outputFilename, config.writeConfig, pILR); - } - catch (exception& e) - { - failedFileCount = (int)filenames.size(); - cerr << "Error merging files: " << e.what() << endl; - } - - return failedFileCount; -} - - -void processFile(const string& filename, const Config& config, const ReaderList& readers) -{ - // read in data file - - cout << "processing file: " << filename << endl; - - vector<MSDataPtr> msdList; - readers.read(filename, msdList); - - for (size_t i=0; i < msdList.size(); ++i) - { - MSData& msd = *msdList[i]; - try - { - // calculate SHA1 checksums - for_each(msd.fileDescription.sourceFilePtrs.begin(), - msd.fileDescription.sourceFilePtrs.end(), - &calculateSourceFilePtrSHA1); - - // process the data - - if (!config.contactFilename.empty()) - addContactInfo(msd, config.contactFilename); - - SpectrumListFactory::wrap(msd, config.filters); - - // handle progress updates if requested - - IterationListenerRegistry iterationListenerRegistry; - UserFeedbackIterationListener feedback; - // update on the first spectrum, the last spectrum, the 100th spectrum, the 200th spectrum, etc. - const size_t iterationPeriod = 100; - iterationListenerRegistry.addListener(feedback, iterationPeriod); - IterationListenerRegistry* pILR = config.verbose ? &iterationListenerRegistry : 0; - - // write out the new data file - string outputFilename = config.outputFilename(filename, msd); - cout << "writing output file: " << outputFilename << endl; - MSDataFile::write(msd, outputFilename, config.writeConfig, pILR); - } - catch (exception& e) - { - cerr << "Error writing run " << (i+1) << " in " << bfs::path(filename).leaf() << ":\n" << e.what() << endl; - } - } - cout << endl; -} - - -int go(const Config& config) -{ - cout << config; - - boost::filesystem::create_directories(config.outputPath); - - FullReaderList readers; - - int failedFileCount = 0; - - if (config.merge) - failedFileCount = mergeFiles(config.filenames, config, readers); - else - { - - for (vector<string>::const_iterator it=config.filenames.begin(); - it!=config.filenames.end(); ++it) - { - try - { - processFile(*it, config, readers); - } - catch (exception& e) - { - failedFileCount++; - cout << e.what() << endl; - cout << "Error processing file " << *it << "\n\n"; - } - } - } - - return failedFileCount; -} - - -int main(int argc, const char* argv[]) -{ - try - { - Config config = parseCommandLine(argc, argv); - return go(config); - } - catch (exception& e) - { - cerr << e.what() << endl; - } - catch (...) - { - cerr << "[" << argv[0] << "] Caught unknown exception.\n"; - } - - return 1; -} - +// +// $Id: msconvert.cpp 2051 2010-06-15 18:39:13Z chambm $ +// +// +// Original author: Darren Kessner <da...@pr...> +// +// Copyright 2008 Spielberg Family Center for Applied Proteomics +// Cedars-Sinai Medical Center, Los Angeles, California 90048 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + + +#include "pwiz_tools/common/FullReaderList.hpp" +#include "pwiz/data/msdata/MSDataFile.hpp" +#include "pwiz/data/msdata/MSDataMerger.hpp" +#include "pwiz/data/msdata/IO.hpp" +#include "pwiz/data/msdata/SpectrumInfo.hpp" +#include "pwiz/utility/misc/IterationListener.hpp" +#include "pwiz/analysis/spectrum_processing/SpectrumListFactory.hpp" +#include "pwiz/Version.hpp" +#include "pwiz/data/msdata/Version.hpp" +#include "pwiz/analysis/Version.hpp" +#include "boost/program_options.hpp" +#include "pwiz/utility/misc/Filesystem.hpp" +#include "pwiz/utility/misc/Std.hpp" + +using namespace pwiz::cv; +using namespace pwiz::data; +using namespace pwiz::msdata; +using namespace pwiz::analysis; +using namespace pwiz::util; + + +struct Config +{ + vector<string> filenames; + vector<string> filters; + string outputPath; + string extension; + bool verbose; + MSDataFile::WriteConfig writeConfig; + string contactFilename; + bool merge; + + Config() + : outputPath("."), verbose(false), merge(false) + {} + + string outputFilename(const string& inputFilename, const MSData& inputMSData) const; +}; + + +string Config::outputFilename(const string& filename, const MSData& msd) const +{ + string runId = msd.run.id; + + // if necessary, adjust runId so it makes a suitable filename + if (runId.empty()) + runId = bfs::basename(filename); + else + { + string extension = bal::to_lower_copy(bfs::extension(runId)); + if (extension == ".mzml" || + extension == ".mzxml" || + extension == ".xml" || + extension... [truncated message content] |