コード例 #1
0
        private async System.Threading.Tasks.Task ExecuteTidySetAsync(ExecuteShellCommand executeShell,
                                                                      string clangPath, Dictionary <string, List <string> > projectToFiles, string clangOptions, CancellationToken cancel)
        {
            IInvokeTidyService service = await package.GetServiceAsync(typeof(SInvokeTidyService))
                                         as IInvokeTidyService;

            if (service == null)
            {
                return;
            }
            try
            {
                List <Task> tasks = new List <Task>();
                foreach (var compileDatabase in projectToFiles.Keys)
                {
                    tasks.Add(service.ExecuteTidyAsync(executeShell, clangPath, compileDatabase, clangOptions, projectToFiles[compileDatabase]
                                                       , cancel));
                }
                await Task.WhenAll(tasks.ToArray()).ContinueWith(_ =>
                {
                    executeShell.Done();
                    m_errorService.SetMessages(executeShell.Failures);
                    TidyControl.RunningTidy.Dispose();
                    TidyControl.RunningTidy = null;
                }, TaskScheduler.Default);
            }
            catch (Exception)
            {
                TidyControl.RunningTidy.Dispose();
                TidyControl.RunningTidy = null;
            }
        }
コード例 #2
0
        private static void CreateGisExtensions(IDatabaseConnection dbConnection)
        {
            Console.WriteLine("Enabling GIS extensions...");
            var alterTableScript = String.Format(AlterNewTableTemplate, dbConnection.DatabaseName);
            var alterCommand     = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""",
                                                 dbConnection.HostName,
                                                 dbConnection.UserName, dbConnection.DatabaseName, alterTableScript);

            ExecuteShellCommand.ExecuteProcess(alterCommand);

            var postGisCommand = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""",
                                               dbConnection.HostName,
                                               dbConnection.UserName, dbConnection.DatabaseName, AddPostGisExtension);

            ExecuteShellCommand.ExecuteProcess(postGisCommand);

            var topologyCommand = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""",
                                                dbConnection.HostName,
                                                dbConnection.UserName, dbConnection.DatabaseName, AddPostGisTopologyExtension);

            ExecuteShellCommand.ExecuteProcess(topologyCommand);

            var fuzzyCommand = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""",
                                             dbConnection.HostName,
                                             dbConnection.UserName, dbConnection.DatabaseName, AddPostGisFuzzyStrMatchExtension);

            ExecuteShellCommand.ExecuteProcess(fuzzyCommand);

            var tigerCommand = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""",
                                             dbConnection.HostName,
                                             dbConnection.UserName, dbConnection.DatabaseName, AddPostGisTigerGeocoderExtension);

            ExecuteShellCommand.ExecuteProcess(tigerCommand);
        }
コード例 #3
0
        protected virtual void AddSpatialColumn(string geometryColumnName, int desiredSrid, string geometryType, string _tableName, string _hostName, string _userName, string _databaseName)
        {
            Console.WriteLine("Adding spatial column for " + _tableName + " with SRID " + desiredSrid);
            const string AddNewSpatialColumn = @"ALTER TABLE {0} ADD geom_{1} geometry({2}, {1})";
            //            const string ConvertColumnToSRID = @"SELECT UpdateGeometrySRID('{0}','geom_{1}', {1})";
            const string CreateSpatialIndex    = @"CREATE INDEX {0}_geom_{1}_gist ON public.{0} USING gist(geom_{1})";
            const string UpdateMultilineColumn = @"UPDATE {0} SET geom_{1} = ST_Transform({2}, {3})";

            var alterTableScript = String.Format(AddNewSpatialColumn, _tableName, desiredSrid, geometryType);
            var alterCommand     = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""", _hostName,
                                                 _userName, _databaseName, alterTableScript);

            ExecuteShellCommand.ExecuteProcess(alterCommand);

            Console.WriteLine("Reprojecting... ");
            var force        = String.Format(UpdateMultilineColumn, _tableName, desiredSrid, geometryColumnName, desiredSrid);
            var forceCommand = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""", _hostName,
                                             _userName, _databaseName, force);

            ExecuteShellCommand.ExecuteProcess(forceCommand);

            var spatialIndex        = String.Format(CreateSpatialIndex, _tableName, desiredSrid);
            var spatialIndexCommand = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""",
                                                    _hostName, _userName, _databaseName, spatialIndex);

            ExecuteShellCommand.ExecuteProcess(spatialIndexCommand);
        }
コード例 #4
0
        public void ExecuteTest()
        {
            ExecuteShellCommand esc = new ExecuteShellCommand();

            esc.Command = "echo Testing ExecuteTest";

            esc.Execute();
        }
コード例 #5
0
        protected void ApplyNonUniqueIndexToColumn(string columnName, string _tableName, string _hostName, string _userName, string _databaseName)
        {
            var alterTableScript = String.Format(NonUniqueColumnBstarIndex, _tableName, columnName);
            var alterCommand     = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""", _hostName,
                                                 _userName, _databaseName, alterTableScript);

            ExecuteShellCommand.ExecuteProcess(alterCommand);
        }
コード例 #6
0
        public static void DropDatabase(IDatabaseConnection dbConnection)
        {
            Console.WriteLine("Dropping database...");
            var dropCommand = String.Format(DropDatabaseTemplate, dbConnection.DatabaseName);
            var dropScript  = String.Format(@"psql -q  --host={1} --username={2} -d postgres --command ""{0}""",
                                            dropCommand, dbConnection.HostName, dbConnection.UserName);

            ExecuteShellCommand.ExecuteProcess(dropScript);
        }
コード例 #7
0
        public static void CreateZeDatabase(IDatabaseConnection dbConnection)
        {
            Console.WriteLine("Creating database...");
            var createScript  = String.Format(CreateDatabaseTemplate, dbConnection.DatabaseName, dbConnection.UserName);
            var createCommand = String.Format(@"psql -q  --host={0} --username={1} -d postgres --command ""{2}""",
                                              dbConnection.HostName, dbConnection.UserName, createScript);

            ExecuteShellCommand.ExecuteProcess(createCommand);
        }
コード例 #8
0
        private void CreateTopoJsonPackage(DirectoryInfo currentDirectory, RegionDetails regionProperties)
        {
            var topoJsonStreamsScript =
                @"topojson  ./streamProperties.json ./restriction_route.geojson ./trout_stream_section.geojson  -p -o ./streams.topo.json ";

            ExecuteShellCommand.ExecuteProcess(topoJsonStreamsScript, currentDirectory);

            var regionScript = String.Format(@"topojson ./publicly_accessible_land.geojson ./streams.topo.json -p -o {0}.topo.json", regionProperties.RegionName);

            ExecuteShellCommand.ExecuteProcess(regionScript, currentDirectory);
        }
コード例 #9
0
        private void CreateGeoJsonScript(DirectoryInfo target, string name, string sql)
        {
            var file = String.Format("{0}.geojson", name);

            File.Delete(target.FullName + "\\" + file);
            const string command2 = @"ogr2ogr -f ""GeoJSON"" {0} -preserve_fid PG:""host={1} user={2} dbname={3}"" -sql ""{4}""";
//            var command = "ogr2ogr -f GeoJSON -preserve_fid {1} {0}.shp";
            var completeCommand = string.Format(command2, file, _dataseConnection.HostName, _dataseConnection.UserName, _dataseConnection.DatabaseName, sql);

            ExecuteShellCommand.ExecuteProcess(completeCommand, target);
        }
コード例 #10
0
        protected virtual void TrimGeometry(string tableName)
        {
            const string sql =
                @"delete from public.{0} where gid not in ( SELECT p.gid FROM public.{0} p, streams_with_measured_kittle_routes sk, trout_streams_minnesota t where t.trout_flag = 1 and sk.kittle_nbr = t.kittle_nbr and sk.kittle_nbr is not null and ST_Intersects(ST_Envelope(sk.geom), p.geom))";

            var alterTableScript = String.Format(sql, tableName);
            var alterCommand     = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""", HostName,
                                                 UserName, DatabaseName, alterTableScript);

            ExecuteShellCommand.ExecuteProcess(alterCommand);
        }
コード例 #11
0
        public async System.Threading.Tasks.Task ExecuteTidyAsync(
            ExecuteShellCommand executor,
            string tidyPath,
            string compileDatabasePath,
            string tidyOptions,
            List <string> files, CancellationToken cancel)
        {
            int            parallelTasks = TidyInstances;
            List <Process> runningChecks = new List <Process>();
            var            fileArray     = files.ToArray();
            int            offset        = 0;

            while (offset < fileArray.Length)
            {
                int limit = Math.Min(parallelTasks, fileArray.Length - offset);
                for (int i = 0; i < limit; ++i, ++offset)
                {
                    var process = executor.ExecuteCommand(Quote(tidyPath), "-p " + Quote(compileDatabasePath) + " " + tidyOptions + " " + Quote(fileArray[offset]));
                    if (process == null)
                    {
                        continue;
                    }
                    runningChecks.Add(process);
                }
                if (runningChecks.Count == 0)
                {
                    continue;
                }
                try
                {
                    await Task.WhenAny(runningChecks.Select(x => x.WaitForExitAsync(cancel)));

                    if (cancel.IsCancellationRequested)
                    {
                        throw new TaskCanceledException();
                    }
                    var running = runningChecks.Where(p => !p.HasExited);
                    runningChecks = new List <Process>(running);
                    parallelTasks = TidyInstances - runningChecks.Count;
                }
                catch (TaskCanceledException)
                {
                    executor.Cancel();
                    foreach (var task in runningChecks)
                    {
                        task.Kill();
                    }
                    return;
                }
            }
            await Task.WhenAll(runningChecks.Select(x => x.WaitForExitAsync(cancel)));
        }
コード例 #12
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            if (TidyControl.RunningTidy != null)
            {
                TidyControl.RunningTidy.Cancel();
                m_output.Write(Resources.Cancelled + "\n");
                return;
            }
            m_output = new ExtensionOutput(package, "CLang Output", ExtensionOutput.DefaultOutputWindowGuid);
            var mySettings     = new Settings <PropertyPage.PropertyPage>(package);
            var clangPath      = mySettings.GetPage().CLangTidy;
            var compileCommand = mySettings.GetPage().CompileCommand;

            if (clangPath == null || clangPath.Length == 0 ||
                compileCommand == null || compileCommand.Length == 0)
            {
                TidyControl.CancelAndShowHelp(package);
                return;
            }
            var clangOptions = mySettings.GetPage().AnalysisOptions;

            if (clangOptions == null)
            {
                clangOptions = "";
            }
            var selection = m_cppProject.GetVCFilesFromSelected();
            Dictionary <string, List <string> > projectsToFiles = new Dictionary <string, List <string> >();

            foreach (var(vcFile, project) in selection)
            {
                var compileDatabaseDirectory = new FileInfo(project.FileName).DirectoryName;
                var file = vcFile.FullPath;
                if (!projectsToFiles.ContainsKey(compileDatabaseDirectory))
                {
                    projectsToFiles.Add(compileDatabaseDirectory, new List <string>());
                }
                if (!new FileInfo(CLangHelpers.GetCompileDatabasePath(compileDatabaseDirectory)).Exists)
                {
                    CLangHelpers.CreateCompilationDatabase(package, compileCommand);
                }

                projectsToFiles[compileDatabaseDirectory].Add(file);
            }
            TidyControl.RunningTidy = new CancellationTokenSource();
            var cancel        = TidyControl.RunningTidy.Token;
            var errorProvider = new AnalysisOutputParser(selection.Count);
            var executeShell  = new ExecuteShellCommand(m_output, errorProvider);

            _ = ExecuteTidySetAsync(executeShell, clangPath, projectsToFiles, clangOptions, cancel);
        }
コード例 #13
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            if (TidyControl.RunningTidy != null)
            {
                TidyControl.RunningTidy.Cancel();
                m_output.Write(Resources.Cancelled + "\n");
                return;
            }

            var project       = m_cppSupport.GetProjectFromSelected();
            var vcProject     = project.Object as VCProject;
            var configuration = m_cppSupport.GetActiveConfiguration(project);

            m_cppSupport.Save(project); // ensure that project is saved before we do anything
            var hierarchy = m_cppSupport.ToHierarchy(project as EnvDTE.Project);
            var compileDatabaseDirectory = new FileInfo(project.FileName).DirectoryName;

            var mySettings     = new Settings <PropertyPage.PropertyPage>(package);
            var clangPath      = mySettings.GetPage().CLangTidy;
            var compileCommand = mySettings.GetPage().CompileCommand;

            if (clangPath == null || clangPath.Length == 0 ||
                compileCommand == null || compileCommand.Length == 0)
            {
                TidyControl.CancelAndShowHelp(package);
                return;
            }

            var clangOptions = mySettings.GetPage().AnalysisOptions;

            if (clangOptions == null)
            {
                clangOptions = "";
            }
            var visitor = new CollectProjectFilesVisitor(m_output, m_cppSupport);

            m_cppSupport.VisitHierarchy(hierarchy, visitor);
            if (!new FileInfo(CLangHelpers.GetCompileDatabasePath(compileDatabaseDirectory)).Exists)
            {
                CLangHelpers.CreateCompilationDatabase(package, compileCommand);
            }
            TidyControl.RunningTidy = new CancellationTokenSource();
            var cancel = TidyControl.RunningTidy.Token;

            var errorProvider = new AnalysisOutputParser(visitor.ProjectFiles.Count);
            var executeShell  = new ExecuteShellCommand(m_output, errorProvider);

            _ = ExecuteTidyAsync(executeShell, clangPath, compileDatabaseDirectory, clangOptions, visitor.ProjectFiles, cancel);
        }
コード例 #14
0
        private void AddSpacialReferenceSystem()
        {
            if (_sridDirectory == null)
            {
                return;
            }

            var sridFiles = _sridDirectory.EnumerateFiles("*.sql");

            foreach (var file in sridFiles)
            {
                ExecuteShellCommand.ExecuteSql(file, _connection.DatabaseName, _connection.HostName, _connection.UserName);
            }
        }
コード例 #15
0
        public static String CometStandardSearch(String ms2FilePath, String outputFolder, Boolean keepResults)
        {
            String database   = InputFileOrganizer.DecoyFasta;
            String paramsFile = InputFileOrganizer.CometParamsFile;
            String cometExe   = InputFileOrganizer.CometExe;
            String command    = cometExe + " -P" + paramsFile + " -D" + database + " " + ms2FilePath;

            ExecuteShellCommand.executeCommand(command);
            String output = Path.Combine(IOUtils.getDirectory(ms2FilePath), IOUtils.getBaseName(ms2FilePath) + InputFileOrganizer.PepXMLSuffix);

            ExecuteShellCommand.MoveFile(output, outputFolder);

            String outputFilePath = Path.Combine(outputFolder, IOUtils.getBaseName(IOUtils.getBaseName(output)) + InputFileOrganizer.PepXMLSuffix);

            return(outputFilePath);
        }
コード例 #16
0
        private FileInfo DumpSqlFromShapefile(FileInfo shapeFile, string srid, string toSrid = null)
        {
            var shortName = Path.GetFileNameWithoutExtension(shapeFile.Name);

            Console.WriteLine("Starting import for file named " + Path.GetFileNameWithoutExtension(shapeFile.Name));
            Console.WriteLine("Creating sql file for " + shapeFile);
            var          sridConversion  = String.IsNullOrEmpty(toSrid) ? srid : srid + ":" + toSrid;
            const string commandTemplate = "shp2pgsql -d -s {2} -I -W LATIN1 {0} {1} > {1}.sql";
            var          command         = String.Format(commandTemplate, shapeFile.FullName, shortName, sridConversion);

            ExecuteShellCommand.ExecuteProcess(command);

            var sqlFileName = Path.GetFileNameWithoutExtension(shapeFile.FullName) + ".sql";

            return(new FileInfo(sqlFileName));
        }
コード例 #17
0
        private void CopyGeoJsonProperties(DirectoryInfo directory, IEnumerable <StreamDetails> streams, string fileToUpdate)
        {
            const string StreamDetailsFile = @"streamDetails.json";
            var          fullFilePath      = directory.FullName + "\\" + StreamDetailsFile;

            var detailsJson = JsonConvert.SerializeObject(streams, Formatting.None);

            if (File.Exists(fullFilePath))
            {
                File.Delete(fullFilePath);
            }
            File.WriteAllText(fullFilePath, detailsJson);
            File.Copy("GeoJSONPropertyExporter.js", directory.FullName + "\\" + "GeoJSONPropertyExporter.js", true);
            var nodeCommand = "node GeoJSONPropertyExporter.js " + fileToUpdate + " " + StreamDetailsFile;

            ExecuteShellCommand.ExecuteProcess(nodeCommand, directory);
        }
コード例 #18
0
 private static void FullPepXMLAndProteinProphetSetup()
 {
     if (GlobalVar.IsSimulation)
     {
         if (!GlobalVar.usePepXMLComputedFile)
         {
             //comet
             log.Info("Performing Comet search on full ms2 data");
             String fullCometFile = PostProcessingScripts.CometStandardSearch(InputFileOrganizer.MS2SimulationTestFile, InputFileOrganizer.preExperimentFilesFolder, true);
             InputFileOrganizer.OriginalCometOutput = fullCometFile;
         }
         //protein prophet
         log.Info("Perform a protein prophet search on full pepxml");
         String fullProteinProphetFile = PostProcessingScripts.ProteinProphetSearch(InputFileOrganizer.OriginalCometOutput, InputFileOrganizer.OutputFolderOfTheRun, true);
         ExecuteShellCommand.MoveFile(fullProteinProphetFile, InputFileOrganizer.preExperimentFilesFolder);
         InputFileOrganizer.OriginalProtXMLFile = Path.Combine(InputFileOrganizer.preExperimentFilesFolder, IOUtils.getBaseName(IOUtils.getBaseName(fullProteinProphetFile)) + ".prot.xml");
     }
 }
コード例 #19
0
        private void CreateRegion()
        {
            var streamDetails       = _jsonExporter.GetStreamDetails().ToList();
            var regionDirectoryName = "Regions";
            var regionFolder        = _rootDirectory.FullName + "\\" + regionDirectoryName;

            if (Directory.Exists(regionFolder) == false)
            {
                Directory.CreateDirectory(regionFolder);
            }
            var regionSql = CreateRegionShapefiles();
            var c         = CreateCommand(regionSql, regionDirectoryName, "region");

            ExecuteShellCommand.ExecuteProcess(c, _rootDirectory);

            var stateSql =
                @"select distinct state.* from public.state state, public.region region where ST_Contains(state.geom, region.geom)";
            var stateCommand = CreateCommand(stateSql, regionDirectoryName, "state");

            ExecuteShellCommand.ExecuteProcess(stateCommand, _rootDirectory);

            var countySql     = @"select county.* from public.county county where region_id is not null;";
            var countyCommand = CreateCommand(countySql, regionDirectoryName, "county");

            ExecuteShellCommand.ExecuteProcess(countyCommand, _rootDirectory);
            var targetDirectory = new DirectoryInfo(regionFolder);

            var pointsScriptPath = "createStreamPoints.sql";
            var pointsScript     = File.ReadAllText(pointsScriptPath).Replace("\n", " ").Replace("\t", " ").Replace("\r", " ");
            var pointsCommand    = CreateCommand(pointsScript, regionDirectoryName, "streamData");

            ExecuteShellCommand.ExecuteProcess(pointsCommand, _rootDirectory);

            CreateGeoJsonScript(targetDirectory, "streamData.geo.json", pointsScript);
            CopyGeoJsonProperties(targetDirectory, streamDetails, "streamData.geo.json.geojson");


            CreateGeoJsonScript(targetDirectory, "region", regionSql);
            CreateGeoJsonScript(targetDirectory, "state", stateSql);
            CreateGeoJsonScript(targetDirectory, "county", countySql);

            CreateRegionTopoJsonPackage(targetDirectory);
        }
コード例 #20
0
        public void ImportShape(FileInfo shapefile, IDatabaseConnection connection, string srid, string desiredSrid = null)
        {
            var sqlFile = DumpSqlFromShapefile(shapefile, srid, desiredSrid);

            try
            {
                ExecuteShellCommand.ExecuteSql(sqlFile, connection.DatabaseName, connection.HostName, connection.UserName);
            }

            finally
            {
                // granted, we have a dispose, but this was ported over from
                // older code, so I just kind of, you know, want to keep
                // moving forward.

                // TODO: Remove this finally and make this code to the Dispose() method.
                sqlFile.Delete();
            }
        }
コード例 #21
0
        protected virtual void DoStuff(string _tableName, string _shapefileSrid, string _hostName, string _userName, string _databaseName, string OriginalSpatialColumn)
        {
            var alterScript = String.Format(AlterTableToMultiLineString, _tableName, CleanedSpatialColumn, _shapefileSrid);

            var alterCommand = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""", _hostName,
                                             _userName, _databaseName, alterScript);

            ExecuteShellCommand.ExecuteProcess(alterCommand);

            var updateTableScript = String.Format(UpdateMultilineColumn, _tableName, CleanedSpatialColumn, OriginalSpatialColumn);
            var updateCommand     = String.Format(@"psql -q  --host={0} --username={1} -d {2} --command ""{3}""", _hostName,
                                                  _userName, _databaseName, updateTableScript);

            ExecuteShellCommand.ExecuteProcess(updateCommand);
            ApplyNonUniqueIndexToColumn("kittle_nbr", _tableName, _hostName, _userName, _databaseName);
            var preferredSRID = 4326;

            AddSpatialColumn(CleanedSpatialColumn, 4326, MultilineString, _tableName, _hostName, _userName, _databaseName);
            AddSpatialColumn(CleanedSpatialColumn, preferredSRID, MultilineString, _tableName, _hostName, _userName, _databaseName);
        }
コード例 #22
0
        public void Export()
        {
            var regions = _context.regions.ToList();
            List <RegionDetails> regionalStreamProperties = _jsonExporter.GetRegionDetails().ToList();

            CreateRegion();


            foreach (var region in regions)
            {
                // create a region directory
                RegionDetails regionProperties = regionalStreamProperties.Single(r => r.RegionId == region.gid);
                var           currentDirectory = GetDirectoryInfo(region);

                foreach (var shapeName in _shapes)
                {
                    string lake;
                    if (shapeName == "county")
                    {
                        lake = CreateCountyShapeFromRegionId(region.gid);
                    }

                    else if (shapeName == "lake")
                    {
                        lake = CreateLakeShapefileFromRegionId(region.gid);
                    }
                    else
                    {
                        lake = CreateShapeQueryForRegion(region.gid, shapeName);
                    }

                    var command = CreateCommand(lake, region.name, shapeName);
                    ExecuteShellCommand.ExecuteProcess(command, _rootDirectory);
                    CreateGeoJsonScript(currentDirectory, shapeName, lake);
                }
                var streams =
                    regionProperties.Counties.SelectMany(i => i.Streams).GroupBy(i => i.Id).Select(g => g.First()).ToArray();
                CopyGeoJsonProperties(currentDirectory, streams, "stream.geojson");
                CreateTopoJsonPackage(currentDirectory, regionProperties);
            }
        }
コード例 #23
0
        private static String executeProteinProphet(String directory, String peptideProphetFile)
        {
            String programName = InputFileOrganizer.ProteinProphet;
            String proteinProphetOutputDirectory = IOUtils.getAbsolutePath(directory) + "\\protein_prophet_output\\";

            if (!Directory.Exists(proteinProphetOutputDirectory))
            {
                Directory.CreateDirectory(proteinProphetOutputDirectory);
            }
            String outputName = proteinProphetOutputDirectory + IOUtils.getBaseName(IOUtils.getBaseName(peptideProphetFile)) + ".prot.xml";

            String command = programName + " " + peptideProphetFile + " " + outputName;

            // System.out.println(command);
            // String result = ExecuteShellCommand.executeCommand(command);
            // System.out.println(result);

            ExecuteShellCommand.executeCommand(command);

            return(outputName);
        }
コード例 #24
0
        //I think this tool looks into the file specified in the pepxml for the original mzML file, so make sure it's there
        private static String executePeptideProphet(String directory, String cometFile)
        {
            String programName = InputFileOrganizer.XInteract;
            String database    = InputFileOrganizer.FASTA_FILE;
            String peptideProphetOutputDirectory = IOUtils.getAbsolutePath(directory) + "\\peptide_prophet_output\\";

            if (!Directory.Exists(peptideProphetOutputDirectory))
            {
                Directory.CreateDirectory(peptideProphetOutputDirectory);
            }
            String outputName    = peptideProphetOutputDirectory + IOUtils.getBaseName(IOUtils.getBaseName(cometFile)) + "_interact.pep.xml";
            String cometFilePath = IOUtils.getAbsolutePath(cometFile);
            String command       = programName + " -N" + outputName + " -D" + database + " " + cometFilePath;

            // System.out.println(command);
            // String result = ExecuteShellCommand.executeCommand(command);
            // System.out.println(result);

            String XinteractOutput = ExecuteShellCommand.executeCommand(command);

            //Console.WriteLine(XinteractOutput);
            return(outputName);
        }
コード例 #25
0
        private void CreateRegionTopoJsonPackage(DirectoryInfo currentDirectory)
        {
            // merge our polygons into one.
            var topoJsonRegionScript =
                @"topojson  ./region.geojson ./state.geojson ./county.geojson  -p -o ./regions.topo.json ";

            ExecuteShellCommand.ExecuteProcess(topoJsonRegionScript, currentDirectory);

            // TODO: simplify them
            var minimizedTopojsonFile = currentDirectory.FullName + "\\" + "regions.min.topo.json";

            if (File.Exists(minimizedTopojsonFile))
            {
                File.Delete(minimizedTopojsonFile);
            }
            var simplify = @"mapshaper ./regions.topo.json -simplify visvalingam 5% -o regions.min.topo.json";

            ExecuteShellCommand.ExecuteProcess(simplify, currentDirectory);
            // streamData.geo.json
            // Add our points.
            var regionScript = String.Format(@"topojson ./streamProperties.json ./regions.min.topo.json -p -o tableOfContents.topo.json");

            ExecuteShellCommand.ExecuteProcess(regionScript, currentDirectory);
        }
コード例 #26
0
        private async System.Threading.Tasks.Task ExecuteTidyAsync(
            ExecuteShellCommand executor,
            string tidyPath,
            string compileDatabasePath,
            string tidyOptions,
            List <string> files,
            CancellationToken cancel)
        {
            IInvokeTidyService service = await package.GetServiceAsync(typeof(SInvokeTidyService))
                                         as IInvokeTidyService;

            if (service == null)
            {
                return;
            }
            await service.ExecuteTidyAsync(executor, tidyPath, compileDatabasePath, tidyOptions, files, cancel)
            .ContinueWith(_ =>
            {
                executor.Done();
                m_errorService.SetMessages(executor.Failures);
                TidyControl.RunningTidy.Dispose();
                TidyControl.RunningTidy = null;
            }, TaskScheduler.Default);
        }
コード例 #27
0
        public static void deleteFile(String fileName)
        {
            String command = "rm " + fileName;

            ExecuteShellCommand.executeCommand(command);
        }