-
Notifications
You must be signed in to change notification settings - Fork 50
/
ParseInput.cs
179 lines (140 loc) · 4.48 KB
/
ParseInput.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
using System.Collections.Generic;
using System.IO;
using ThermoRawFileParser.Writer;
namespace ThermoRawFileParser
{
public class ParseInput
{
// All MS levels
public static HashSet<int> AllLevels { get => new HashSet<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; }
/// <summary>
/// The RAW file path.
/// </summary>
private string _rawFilePath;
private string _userProvidedFilePath;
private int _errors;
private int _warnings;
/// <summary>
/// The RAW folder path.
/// </summary>
public string RawDirectoryPath { get; set; }
public string RawFilePath
{
get => _rawFilePath;
set
{
_rawFilePath = value;
_userProvidedFilePath = value;
if (value != null)
{
RawFileNameWithoutExtension = Path.GetFileNameWithoutExtension(value);
}
}
}
public string UserProvidedPath
{
get => _userProvidedFilePath;
}
public int Errors
{
get => _errors;
}
public int Warnings
{
get => _warnings;
}
/// <summary>
/// The output directory.
/// </summary>
public string OutputDirectory { get; set; }
/// <summary>
/// The output file.
/// </summary>>
public string OutputFile { get; set; }
/// <summary>
/// The output format.
/// </summary>
public OutputFormat OutputFormat { get; set; }
/// <summary>
/// The metadata output format.
/// </summary>
public MetadataFormat MetadataFormat { get; set; }
/// <summary>
/// The metadata output file.
/// </summary>>
public string MetadataOutputFile { get; set; }
/// <summary>
/// Gzip the output file.
/// </summary>
public bool Gzip { get; set; }
public HashSet<int> NoPeakPicking { get; set; }
public bool NoZlibCompression { get; set; }
public bool AllDetectors { get; set; }
public LogFormat LogFormat { get; set; }
public bool IgnoreInstrumentErrors { get; set; }
public bool ExData { get; set; }
public HashSet<int> MsLevel { get; set; }
public int MaxLevel { get; set; }
public bool MgfPrecursor { get; set; }
public bool NoiseData { get; set; }
public bool StdOut { get; set; }
public bool Vigilant { get; set; }
private S3Loader S3Loader { get; set; }
public string S3AccessKeyId { get; set; }
public string S3SecretAccessKey { get; set; }
public string S3Url { get; set; }
public string BucketName { get; set; }
/// <summary>
/// The RAW file name without extension.
/// </summary>
public string RawFileNameWithoutExtension { get; private set; }
public ParseInput()
{
MetadataFormat = MetadataFormat.None;
OutputFormat = OutputFormat.None;
Gzip = false;
NoPeakPicking = new HashSet<int>();
NoZlibCompression = false;
LogFormat = LogFormat.DEFAULT;
IgnoreInstrumentErrors = false;
AllDetectors = false;
MsLevel = AllLevels;
MgfPrecursor = false;
StdOut = false;
NoiseData = false;
Vigilant = false;
_errors = 0;
_warnings = 0;
MaxLevel = 10;
}
public ParseInput(string rawFilePath, string rawDirectoryPath, string outputDirectory, OutputFormat outputFormat
) : this()
{
RawFilePath = rawFilePath;
RawDirectoryPath = rawDirectoryPath;
OutputDirectory = outputDirectory;
OutputFormat = outputFormat;
MgfPrecursor = true;
}
public void InitializeS3Bucket()
{
S3Loader = new S3Loader(S3Url, S3AccessKeyId, S3SecretAccessKey, BucketName);
}
public void NewError()
{
_errors++;
}
public void NewWarn()
{
_warnings++;
}
public void UpdateRealPath(string path)
{
if (path != null)
{
_userProvidedFilePath = _rawFilePath;
_rawFilePath = path;
}
}
}
}