forked from compomics/ThermoRawFileParser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParseInput.cs
152 lines (127 loc) · 4.66 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
using System.IO;
using ThermoRawFileParser.Writer;
namespace ThermoRawFileParser
{
public class ParseInput
{
/// <summary>
/// The RAW folder path.
/// </summary>
public string RawFolderPath { get; }
/// <summary>
/// The RAW file path.
/// </summary>
private string rawFilePath;
public string RawFilePath {
get { return rawFilePath; }
set
{
rawFilePath = value;
if (value != null)
{
rawFileNameWithoutExtension = Path.GetFileNameWithoutExtension(value);
string[] splittedPath = value.Split('/');
rawFileName = splittedPath[splittedPath.Length - 1];
}
}
}
/// <summary>
/// The output directory.
/// </summary>
public string OutputDirectory { get; }
/// <summary>
/// The output format.
/// </summary>
public OutputFormat OutputFormat { get; }
/// <summary>
/// The output file.
/// </summary>>
public string OutputFile { get; }
/// <summary>
/// Gzip the output file.
/// </summary>
public bool Gzip { get; }
/// <summary>
/// Output the metadata.
/// </summary>
public MetadataFormat OutputMetadata { get; }
/// <summary>
/// The raw file name.
/// </summary>
private string rawFileName;
public string RawFileName
{
get { return rawFileName; }
set
{
rawFileName = value;
}
}
/// <summary>
/// The RAW file name without extension.
/// </summary>
private string rawFileNameWithoutExtension;
public string RawFileNameWithoutExtension {
get { return rawFileNameWithoutExtension; }
}
private S3Loader S3Loader { get; set; }
private string S3AccessKeyId { get; }
private string S3SecretAccessKey { get; }
private string S3url { get; }
public bool IgnoreInstrumentErrors { get; }
public bool NoPeakPicking { get; }
public bool NoZlibCompression { get; }
public bool Verbose { get; }
private readonly string bucketName;
public ParseInput(string rawFolderPath, string rawFilePath, string outputDirectory, string outputFile, OutputFormat outputFormat
)
{
RawFolderPath = rawFolderPath;
RawFilePath = rawFilePath;
OutputDirectory = outputDirectory;
OutputFile = outputFile;
OutputFormat = outputFormat;
Gzip = false;
OutputMetadata = MetadataFormat.NONE;
IgnoreInstrumentErrors = false;
NoPeakPicking = false;
NoZlibCompression = false;
Verbose = false;
if (S3url != null && S3AccessKeyId != null && S3SecretAccessKey != null && bucketName != null)
InitializeS3Bucket();
if (OutputDirectory == null && OutputFile != null)
OutputDirectory = Path.GetDirectoryName(OutputFile);
}
public ParseInput(string rawFolderPath, string rawFilePath, string outputDirectory, string outputFile, OutputFormat outputFormat,
bool gzip,
MetadataFormat outputMetadata, string s3url, string s3AccessKeyId,
string s3SecretAccessKey, string bucketName,
bool ignoreInstrumentErrors, bool noPeakPicking, bool noZlibCompression, bool verbose
)
{
RawFolderPath = rawFolderPath;
RawFilePath = rawFilePath;
OutputDirectory = outputDirectory;
OutputFile = outputFile;
OutputFormat = outputFormat;
Gzip = gzip;
OutputMetadata = outputMetadata;
S3url = s3url;
S3AccessKeyId = s3AccessKeyId;
S3SecretAccessKey = s3SecretAccessKey;
this.bucketName = bucketName;
IgnoreInstrumentErrors = ignoreInstrumentErrors;
NoPeakPicking = noPeakPicking;
NoZlibCompression = noZlibCompression;
Verbose = verbose;
if (S3url != null && S3AccessKeyId != null && S3SecretAccessKey != null && bucketName != null)
InitializeS3Bucket();
if (OutputDirectory == null && OutputFile != null)
OutputDirectory = Path.GetDirectoryName(OutputFile);
}
private void InitializeS3Bucket()
{
S3Loader = new S3Loader(S3url, S3AccessKeyId, S3SecretAccessKey, bucketName);
}
}
}