Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge To Orig #186

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ obj/
*.sln.DotSettings.user
.vs/
*.csproj.user
.vscode/
44 changes: 21 additions & 23 deletions MainClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class MainClass
private static readonly ILog Log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

public const string Version = "1.4.5";
public const string Version = "1.4.2";
public static void Main(string[] args)
{
// Set Invariant culture as default for all further processing
Expand Down Expand Up @@ -63,15 +63,15 @@ private static void XicParametersParsing(string[] args)
"h|help", "Prints out the options.",
h => parameters.help = h != null
},
{
"i=|input=", "The raw file input (Required). Specify this or an input directory -d",
v => singleFile = v
},
{
"d=|input_directory=",
"The directory containing the raw files (Required). Specify this or an input file -i.",
v => fileDirectory = v
},
{
"i=|input=", "The raw file input (Required). Specify this or an input directory -d",
v => singleFile = v
},
{
"j=|json=",
"The json input file (Required).",
Expand All @@ -82,16 +82,16 @@ private static void XicParametersParsing(string[] args)
"Show a json input file example.",
v => parameters.printJsonExample = v != null
},
{
"b=|output=",
"The output file. Specify this or an output directory. Specifying neither writes to the input directory.",
v => outputFile = v
},
{
"o=|output_directory=",
"The output directory. Specify this or an output file. Specifying neither writes to the input directory.",
v => outputDirectory = v
},
{
"b=|output=",
"The output file. Specify this or an output directory. Specifying neither writes to the input directory.",
v => outputFile = v
},
{
"6|base64",
"Encodes the content of the xic vectors as base 64 encoded string.",
Expand All @@ -103,7 +103,7 @@ private static void XicParametersParsing(string[] args)
v => parameters.stdout = v != null
},
{
"w|warningsAreErrors", "Return non-zero exit code for warnings; default only for errors",
"w|warningsAreErrors", "Return non-zero exit code for warnings; default only for errors",
v => parameters.Vigilant = v != null
},
{
Expand Down Expand Up @@ -338,7 +338,7 @@ private static void SpectrumQueryParametersParsing(string[] args)
v => parameters.scans = v
},
{
"b=|output=",
"b=|output_file",
"The output file. Specifying none writes the output file to the input file parent directory.",
v => parameters.outputFile = v
},
Expand Down Expand Up @@ -510,27 +510,27 @@ private static void RegularParametersParsing(string[] args)
v => parseInput.RawDirectoryPath = v
},
{
"b=|output=",
"The output file. Specify this or an output directory -o. Specifying neither writes to the input directory.",
v => parseInput.OutputFile = v
},
{
"o=|output_directory=",
"o=|output=",
"The output directory. Specify this or an output file -b. Specifying neither writes to the input directory.",
v => parseInput.OutputDirectory = v
},
{
"b=|output_file",
"The output file. Specify this or an output directory -o. Specifying neither writes to the input directory.",
v => parseInput.OutputFile = v
},
{
"s|stdout",
"Write to standard output. Cannot be combined with file or directory output. Implies silent logging, i.e. logging level 0",
v => parseInput.StdOut = v != null
},
{
"f=|format=",
"The spectra output format: 0 for MGF, 1 for mzML, 2 for indexed mzML, 3 for Parquet, 4 for None (no output); both numeric and text (case insensitive) value recognized. Defaults to indexed mzML if no format is specified.",
"The spectra output format: 0 for MGF, 1 for mzML, 2 for indexed mzML, 3 for Parquet; both numeric and text (case insensitive) value recognized. Defaults to indexed mzML if no format is specified.",
v => outputFormatString = v
},
{
"m=|metadata=", "The metadata output format: 0 for JSON, 1 for TXT, 2 for None (no output); both numeric and text (case insensitive) value recognized. Defaults to None",
"m=|metadata=", "The metadata output format: 0 for JSON, 1 for TXT; both numeric and text (case insensitive) value recognized",
v => metadataFormatString = v
},
{
Expand Down Expand Up @@ -740,7 +740,7 @@ private static void RegularParametersParsing(string[] args)
"-c, --metadata_output_file");
}

if (parseInput.MetadataOutputFile != null && parseInput.MetadataFormat == MetadataFormat.None)
if (parseInput.MetadataOutputFile != null && parseInput.MetadataFormat == MetadataFormat.NONE)
{
throw new OptionException("specify a metadata format (0 for JSON, 1 for TXT)",
"-m, --metadata");
Expand All @@ -766,8 +766,6 @@ private static void RegularParametersParsing(string[] args)
if (parseInput.OutputFormat == OutputFormat.IndexMzML) parseInput.OutputFormat = OutputFormat.MzML;
}

parseInput.MaxLevel = parseInput.MsLevel.Max();

if (parseInput.S3Url != null && parseInput.S3AccessKeyId != null &&
parseInput.S3SecretAccessKey != null && parseInput.BucketName != null)
if (Uri.IsWellFormedUriString(parseInput.S3Url, UriKind.Absolute))
Expand Down
4 changes: 2 additions & 2 deletions OutputFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ public enum OutputFormat
MzML,
IndexMzML,
Parquet,
None
NONE
}

public enum MetadataFormat
{
JSON,
TXT,
None
NONE
}
}
7 changes: 2 additions & 5 deletions ParseInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ public int Warnings

public HashSet<int> MsLevel { get; set; }

public int MaxLevel { get; set; }

public bool MgfPrecursor { get; set; }

public bool NoiseData { get; set; }
Expand All @@ -123,8 +121,8 @@ public int Warnings

public ParseInput()
{
MetadataFormat = MetadataFormat.None;
OutputFormat = OutputFormat.None;
MetadataFormat = MetadataFormat.NONE;
OutputFormat = OutputFormat.NONE;
Gzip = false;
NoPeakPicking = new HashSet<int>();
NoZlibCompression = false;
Expand All @@ -138,7 +136,6 @@ public ParseInput()
Vigilant = false;
_errors = 0;
_warnings = 0;
MaxLevel = 10;
}

public ParseInput(string rawFilePath, string rawDirectoryPath, string outputDirectory, OutputFormat outputFormat
Expand Down
16 changes: 8 additions & 8 deletions Query/ProxiSpectrumReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ public List<ProxiSpectrum> Retrieve()
reaction = SpectrumWriter.GetReaction(scanEvent, scanNumber);
}

proxiSpectrum.AddAttribute(accession: "MS:1003057", name: "scan number",
proxiSpectrum.AddAttribute(accession: "MS:10003057", name: "scan number",
value: scanNumber.ToString(CultureInfo.InvariantCulture));
proxiSpectrum.AddAttribute(accession: "MS:1000016", name: "scan start time",
proxiSpectrum.AddAttribute(accession: "MS:10000016", name: "scan start time",
value: (time * 60).ToString(CultureInfo.InvariantCulture));
proxiSpectrum.AddAttribute(accession: "MS:1000511", name: "ms level",
value: ((int) scanFilter.MSOrder).ToString(CultureInfo.InvariantCulture));
Expand All @@ -128,7 +128,7 @@ public List<ProxiSpectrum> Retrieve()
//injection time
if (ionInjectionTime != null)
{
proxiSpectrum.AddAttribute(accession: "MS:1000927", name: "ion injection time",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xjasg Can you update your branch? Some of the terms on your side are outdated; we fixed them in our previous release.

proxiSpectrum.AddAttribute(accession: "MS:10000927", name: "ion injection time",
value: ionInjectionTime.ToString(), cvGroup: cvGroup.ToString());
proxiSpectrum.AddAttribute(accession: "UO:0000028", name: "millisecond",
cvGroup: cvGroup.ToString());
Expand All @@ -140,7 +140,7 @@ public List<ProxiSpectrum> Retrieve()
// Store the precursor information
var selectedIonMz =
SpectrumWriter.CalculateSelectedIonMz(reaction, monoisotopicMz, isolationWidth);
proxiSpectrum.AddAttribute(accession: "MS:1000744", name: "selected ion m/z",
proxiSpectrum.AddAttribute(accession: "MS:10000744", name: "selected ion m/z",
value: selectedIonMz.ToString(CultureInfo.InvariantCulture));
proxiSpectrum.AddAttribute(accession: "MS:1000827",
name: "isolation window target m/z",
Expand All @@ -159,24 +159,24 @@ public List<ProxiSpectrum> Retrieve()
// scan polarity
if (scanFilter.Polarity == PolarityType.Positive)
{
proxiSpectrum.AddAttribute(accession: "MS:1000465", name: "scan polarity",
proxiSpectrum.AddAttribute(accession: "MS:10000465", name: "scan polarity",
value: "positive scan", valueAccession: "MS:1000130");
}
else
{
proxiSpectrum.AddAttribute(accession: "MS:1000465", name: "scan polarity",
proxiSpectrum.AddAttribute(accession: "MS:10000465", name: "scan polarity",
value: "negative scan", valueAccession: "MS:1000129");
}

// charge state
if (charge != null)
{
proxiSpectrum.AddAttribute(accession: "MS:1000041", name: "charge state",
proxiSpectrum.AddAttribute(accession: "MS:10000041", name: "charge state",
value: charge.ToString());
}

// write the filter string
proxiSpectrum.AddAttribute(accession: "MS:1000512", name: "filter string",
proxiSpectrum.AddAttribute(accession: "MS:10000512", name: "filter string",
value: scanEvent.ToString());

double[] masses = null;
Expand Down
53 changes: 20 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ or
mono ThermoRawFileParser.exe -d=/home/user/data_input/
```

For running on Windows, omit `mono`. The optional parameters only work in the -option=value format. The tool can output some RAW file metadata `-m=0|1` (0 for JSON, 1 for TXT) and the spectra file `-f=0|1|2|3|4` (0 for MGF, 1 for mzML, 2 for indexed mzML, 3 for Parquet, 4 for no output) or both. Use the `-p` flag to disable the thermo native peak picking.
For running on Windows, omit `mono`. The optional parameters only work in the -option=value format. The tool can output some RAW file metadata `-m=0|1` (0 for JSON, 1 for TXT) and the spectra file `-f=0|1|2|3` (0 for MGF, 1 for mzML, 2 for indexed mzML, 3 for Parquet) or both. Use the `-p` flag to disable the thermo native peak picking.

```
ThermoRawFileParser.exe --help
Usage is ThermoRawFileParser.exe [subcommand] [options]
optional subcommands are xic|query (use [subcommand] -h for more info]):
-h, --help Prints out the options.
Expand All @@ -59,25 +60,23 @@ optional subcommands are xic|query (use [subcommand] -h for more info]):
-d, --input_directory=VALUE
The directory containing the raw files (Required).
Specify this or an input raw file -i.
-b, --output=VALUE The output file. Specify this or an output
directory -o. Specifying neither writes to the
input directory.
-o, --output_directory=VALUE
The output directory. Specify this or an output
-o, --output=VALUE The output directory. Specify this or an output
file -b. Specifying neither writes to the input
directory.
-b, --output_file=VALUE The output file. Specify this or an output
directory -o. Specifying neither writes to the
input directory.
-s, --stdout Write to standard output. Cannot be combined with
file or directory output. Implies silent logging,
i.e. logging level 0
-f, --format=VALUE The spectra output format: 0 for MGF, 1 for mzML,
2 for indexed mzML, 3 for Parquet, 4 for None (
no output); both numeric and text (case
insensitive) value recognized. Defaults to
indexed mzML if no format is specified.
-m, --metadata=VALUE The metadata output format: 0 for JSON, 1 for TXT,
2 for None (no output); both numeric and text (
case insensitive) value recognized. Defaults to
None
2 for indexed mzML, 3 for Parquet; both numeric
and text (case insensitive) value recognized.
Defaults to indexed mzML if no format is
specified.
-m, --metadata=VALUE The metadata output format: 0 for JSON, 1 for TXT;
both numeric and text (case insensitive) value
recognized
-c, --metadata_output_file=VALUE
The metadata output file. By default the metadata
file is written to the output directory.
Expand Down Expand Up @@ -121,7 +120,7 @@ optional subcommands are xic|query (use [subcommand] -h for more info]):
S3 bucket name
```

Output file extension is determined by the used output format and (optional) gzip compression, for example, if format is MGF without gzip compression, the output file will receive `.mgf` extension, if format is mzML with gzip compression the output file will have `.mzML.gz` extension. All user input will be standardized to fulfill abovementioned requirements.
Output file extension is determined by the used output format and (optional) gzip compression, for example, if format is MGF without gzip compression, the output file will receive `.mgf` extension, if format is mzML with gzip compression the output file will have `.mzML.gz` extension. All user input will be standardized to fulfill abovementioned requrements.

A (java) graphical user interface is also available [here](https://github.com/compomics/ThermoRawFileParserGUI) that enables the selection of an input RAW directory or one ore more RAW files.

Expand All @@ -138,7 +137,7 @@ usage is:
-h, --help Prints out the options.
-i, --input=VALUE The raw file input (Required).
-n, --scans=VALUE The scan numbers. e.g. "1-5, 20, 25-30"
-b, --output=VALUE The output file. Specifying none writes the output
-b, --output_file=VALUE The output file. Specifying none writes the output
file to the input file parent directory.
-p, --noPeakPicking Don't use the peak picking provided by the native
Thermo library. By default peak picking is
Expand Down Expand Up @@ -170,13 +169,12 @@ ThermoRawFileParser.exe xic --help
Specify this or an input file -i.
-j, --json=VALUE The json input file (Required).
-p, --print_example Show a json input file example.
-b, --output=VALUE The output file. Specify this or an output
directory. Specifying neither writes to the
input directory.
-o, --output_directory=VALUE
The output directory. Specify this or an output
-o, --output=VALUE The output directory. Specify this or an output
file. Specifying neither writes to the input
directory.
-b, --output_file=VALUE The output file. Specify this or an output
directory. Specifying neither writes to the
input directory.
-6, --base64 Encodes the content of the xic vectors as base 64
encoded string.
-s, --stdout Pipes the output into standard output. Logging is
Expand All @@ -194,8 +192,7 @@ Provide one of the following filters:
* M/Z start and end
* sequence and tolerance (tolerance unit optional, defaults to `ppm`)

optionally one can define starting and ending retention times, provide filter string (defaults to `ms`, i.e. only MS1 scans), and a comment (free text) field; any valid filter string is supported,
however only basic validation is performed, see [issue #158](https://github.com/compomics/ThermoRawFileParser/issues/158) for details. Comment can contain any text and will be preserved in the output.
optionally one can define starting and ending retention times and thermo filter string (defaults to `ms`)

An example input JSON file:

Expand All @@ -222,17 +219,7 @@ An example input JSON file:
{
"sequence":"TRANNEL",
"tolerance":10
},
{
"mz":1014.5099732499732,
"rt_start":14.0600881872,
"rt_end":14.4167198290667,
"tolerance":5,
"tolerance_unit":"ppm",
"comment":"Only ion trap scans"
"scan_filter":"ITMS"
}
}
]

```
Expand Down
Loading