-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from pymzml/dev
Update to v2.4.6
- Loading branch information
Showing
23 changed files
with
433 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
addReviewers: true | ||
addAssignees: true | ||
reviewers: | ||
- MKoesters | ||
|
||
skipKeywords: | ||
- wip | ||
- WIP | ||
|
||
numberOfReviewers: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ dist | |
.tox | ||
pymzml.egg-info | ||
docs/source/code_inc/ | ||
/.github/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ Please refer to: | |
| Germany | ||
| eMail: [email protected] | ||
| | ||
| http:// <in transition > | ||
| https://fufezan.net | ||
|
||
******* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
sphinx >= 1.3.0 | ||
sphinx_rtd_theme >= 0.1.9 | ||
sphinx==2.3.1 | ||
sphinx_rtd_theme==0.4.3 | ||
regex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env python3 | ||
import bisect | ||
import pprint | ||
import click | ||
import os | ||
import hashlib | ||
|
||
import random | ||
import pickle | ||
import pymzml | ||
|
||
from xml.etree.ElementTree import ParseError | ||
|
||
|
||
@click.command() | ||
@click.argument('input_files', nargs=-1) | ||
@click.option('--shuffle', '-s', is_flag=True) | ||
@click.option('--suffix') | ||
def main(input_files, shuffle, suffix=''): | ||
print(suffix) | ||
output_name = f'failing_spectra{suffix}.txt' | ||
with open(output_name, 'wt') as fout: | ||
for file in input_files: | ||
print(file) | ||
fails = 0 | ||
fail_info = [] | ||
reader = pymzml.run.Reader(file) | ||
indices = list(range(1, reader.get_spectrum_count())) | ||
if shuffle: | ||
random.seed(a=1570010244.2805517) | ||
random.shuffle(indices) | ||
m = hashlib.md5() | ||
m.update(pickle.dumps(indices)) | ||
md5_digest = m.hexdigest() | ||
print(f"Shuffled indices md5: {md5_digest}") | ||
# exit(1) | ||
number_of_specs = len(indices) | ||
basic_off_set_dict = reader.info["file_object"].file_handler.offset_dict.copy() | ||
basic_seek_list = reader.info["file_object"].file_handler.seek_list.copy() | ||
for pos, i in enumerate(indices): | ||
# reader.info["file_object"].file_handler.offset_dict = basic_off_set_dict.copy() | ||
# reader.info["file_object"].file_handler.seek_list = basic_seek_list.copy() | ||
current_precentage = 100 * float(pos) / float(number_of_specs) | ||
print(f"[{current_precentage:0>3.1f}%] Access spectrum {i:<10}".format(), end='\r') | ||
#spec = reader[i] | ||
try: | ||
spec = reader[i] | ||
# 100 / 0 | ||
except Exception as e: | ||
fails += 1 | ||
fout.write(f'{os.path.basename(file)}\t{i}\n') | ||
print(f"failed on spec {i}") | ||
|
||
# pprint.pprint(reader.info["file_object"].file_handler.offset_dict) | ||
# pprint.pprint(reader.info["file_object"].file_handler.seek_list) | ||
spec = reader[i] | ||
exit(1) | ||
# break | ||
print() | ||
perc = fails / len(indices) * 100 | ||
print(f'{fails} of {len(indices)} spectra could not be accessed ({perc}%)') | ||
print('\n\n') | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Oops, something went wrong.