-
Notifications
You must be signed in to change notification settings - Fork 9
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
Linting iii #235
Open
mschwoer
wants to merge
17
commits into
linting_II
Choose a base branch
from
linting_III
base: linting_II
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+217
−221
Open
Linting iii #235
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5fbff4c
remove unused LibraryReaderFromRawData
mschwoer 570335a
simplify typing imports
mschwoer 092294e
avoid overwriting loop variable
mschwoer 2440768
renaming
mschwoer 372b0fc
renaming
mschwoer 32a24c5
add some noqa's
mschwoer 40a945a
refactor convert_one_pFind_mod
mschwoer 6332059
some smaller changes
mschwoer 78e03df
isnull, notnull -> isna, notna
mschwoer aadb08f
some more renamings
mschwoer 31c3f77
make most imports in notebooks explicit
mschwoer 955dbc1
make imports in modification.ipynb explicit
mschwoer daae1d9
make imports in fasta.ipynb explicit
mschwoer 8c75c85
fix fasta & modifications notebooks
mschwoer a9aae6f
Revert "fix fasta & modifications notebooks"
mschwoer 07a0649
fix fasta & modifications notebooks II
mschwoer f7e00db
fix fasta & modifications notebooks II
mschwoer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 |
---|---|---|
|
@@ -18,8 +18,8 @@ | |
warnings.filterwarnings("always") | ||
|
||
mod_to_unimod_dict = {} | ||
for mod_name, unimod_id in MOD_DF[["mod_name", "unimod_id"]].values: | ||
unimod_id = int(unimod_id) | ||
for mod_name, unimod_id_ in MOD_DF[["mod_name", "unimod_id"]].to_numpy(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this suffix thing a known pattern? I only now it as private prefix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I use it to avoid name clashes, e.g. with built-ins or other variables |
||
unimod_id = int(unimod_id_) | ||
if unimod_id in (-1, "-1"): | ||
continue | ||
if mod_name[-2] == "@": | ||
|
@@ -81,14 +81,14 @@ def parse_mod_seq( | |
0 for N-term; -1 for C-term; 1 to N for normal modifications. | ||
|
||
""" | ||
PeptideModSeq = modseq | ||
peptide_mod_seq = modseq | ||
underscore_for_ncterm = modseq[0] == "_" | ||
mod_list = [] | ||
site_list = [] | ||
site = PeptideModSeq.find(mod_sep[0]) | ||
site = peptide_mod_seq.find(mod_sep[0]) | ||
while site != -1: | ||
site_end = PeptideModSeq.find(mod_sep[1], site + 1) + 1 | ||
if site_end < len(PeptideModSeq) and PeptideModSeq[site_end] == mod_sep[1]: | ||
site_end = peptide_mod_seq.find(mod_sep[1], site + 1) + 1 | ||
if site_end < len(peptide_mod_seq) and peptide_mod_seq[site_end] == mod_sep[1]: | ||
site_end += 1 | ||
if underscore_for_ncterm: | ||
site_list.append(site - 1) | ||
|
@@ -97,42 +97,42 @@ def parse_mod_seq( | |
start_mod = site | ||
if start_mod > 0: | ||
start_mod -= 1 | ||
mod_list.append(PeptideModSeq[start_mod:site_end]) | ||
PeptideModSeq = PeptideModSeq[:site] + PeptideModSeq[site_end:] | ||
site = PeptideModSeq.find(mod_sep[0], site) | ||
mod_list.append(peptide_mod_seq[start_mod:site_end]) | ||
peptide_mod_seq = peptide_mod_seq[:site] + peptide_mod_seq[site_end:] | ||
site = peptide_mod_seq.find(mod_sep[0], site) | ||
|
||
# patch for phos. How many other modification formats does MQ have? | ||
site = PeptideModSeq.find("p") | ||
site = peptide_mod_seq.find("p") | ||
while site != -1: | ||
mod_list.append(PeptideModSeq[site : site + 2]) | ||
mod_list.append(peptide_mod_seq[site : site + 2]) | ||
site_list = [i - 1 if i > site else i for i in site_list] | ||
if underscore_for_ncterm: | ||
site_list.append(site) | ||
else: | ||
site_list.append(site + 1) | ||
PeptideModSeq = PeptideModSeq[:site] + PeptideModSeq[site + 1 :] | ||
site = PeptideModSeq.find("p", site) | ||
peptide_mod_seq = peptide_mod_seq[:site] + peptide_mod_seq[site + 1 :] | ||
site = peptide_mod_seq.find("p", site) | ||
|
||
if fixed_C57: | ||
site = PeptideModSeq.find("C") | ||
site = peptide_mod_seq.find("C") | ||
while site != -1: | ||
if underscore_for_ncterm: | ||
site_list.append(site) | ||
else: | ||
site_list.append(site + 1) | ||
mod_list.append("C" + "Carbamidomethyl (C)".join(mod_sep)) | ||
site = PeptideModSeq.find("C", site + 1) | ||
sequence = PeptideModSeq.strip("_") | ||
nAA = len(sequence) | ||
site = peptide_mod_seq.find("C", site + 1) | ||
sequence = peptide_mod_seq.strip("_") | ||
n_aa = len(sequence) | ||
return ( | ||
sequence, | ||
";".join(mod_list), | ||
";".join([str(i) if i <= nAA else "-1" for i in site_list]), | ||
";".join([str(i) if i <= n_aa else "-1" for i in site_list]), | ||
) | ||
|
||
|
||
class MaxQuantReader(PSMReaderBase): | ||
def __init__( | ||
def __init__( # noqa: PLR0913 many arguments in function definition | ||
self, | ||
*, | ||
column_mapping: Optional[dict] = None, | ||
|
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a thing? that
Path
is prefered over os?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.. imho it makes path operations much more readable,
I especially like the overloading of the
/
operator when it comes to using it (e.g.Path("/home/") / "user"
).I especially dislike the overloading of the
/
operator when it comes to mocking it :-)