Skip to content

Commit

Permalink
Apply Black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jan 25, 2024
1 parent a38eb30 commit 88faa2b
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 118 deletions.
5 changes: 3 additions & 2 deletions alphadia/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,10 +864,11 @@ def fragment_features(
is_y = fragments.type == 121

if np.sum(is_b) > 0 and np.sum(is_y) > 0:

min_y = fragments.position[is_y].min()
max_b = fragments.position[is_b].max()
overlapping = (is_y & (fragments.position < max_b)) | (is_b & (fragments.position > min_y))
overlapping = (is_y & (fragments.position < max_b)) | (
is_b & (fragments.position > min_y)
)

# n_overlapping
feature_array[43] = overlapping.sum()
Expand Down
3 changes: 1 addition & 2 deletions alphadia/plexscoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1678,9 +1678,8 @@ def collect_candidates(
"mean_ms2_mass_error",
"n_overlapping",
"mean_overlapping_intensity",
"mean_overlapping_mass_error"
"mean_overlapping_mass_error",
]


precursor_idx, rank, features = psm_proto_df.to_precursor_df()

Expand Down
35 changes: 21 additions & 14 deletions alphadia/plotting/reporting/demo/reporting_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"metadata": {},
"outputs": [],
"source": [
"default_file = 'default.yaml'\n",
"experiment_file_1 = 'config.yaml'\n",
"experiment_file_2 = 'config2.yaml'"
"default_file = \"default.yaml\"\n",
"experiment_file_1 = \"config.yaml\"\n",
"experiment_file_2 = \"config2.yaml\""
]
},
{
Expand All @@ -40,14 +40,15 @@
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"default = Config(\"default\")\n",
"default.from_yaml(default_file)\n",
"\n",
"experiment_1 = Config(\"experiment 1\")\n",
"experiment_1.from_yaml(experiment_file_1)\n",
"\n",
"experiment_2 = Config(\"experiment 2\")\n",
"experiment_2.from_yaml(experiment_file_2)\n"
"experiment_2.from_yaml(experiment_file_2)"
]
},
{
Expand Down Expand Up @@ -215,7 +216,7 @@
}
],
"source": [
"#Lets visualize the default config using the implemented print_recursively method to print it in visually appealing way\n",
"# Lets visualize the default config using the implemented print_recursively method to print it in visually appealing way\n",
"print_recursively(default.config)"
]
},
Expand Down Expand Up @@ -286,8 +287,10 @@
}
],
"source": [
"#Lets visualize the experiment 1 config using the implemented print_recursively method to print it in visually appealing way\n",
"print_recursively(experiment_1.config, style='new') #style='new' to visually differentiate between the two configs"
"# Lets visualize the experiment 1 config using the implemented print_recursively method to print it in visually appealing way\n",
"print_recursively(\n",
" experiment_1.config, style=\"new\"\n",
") # style='new' to visually differentiate between the two configs"
]
},
{
Expand Down Expand Up @@ -358,7 +361,9 @@
}
],
"source": [
"print_recursively(experiment_2.config, style='new') #style='new' to visually differentiate between the two configs"
"print_recursively(\n",
" experiment_2.config, style=\"new\"\n",
") # style='new' to visually differentiate between the two configs"
]
},
{
Expand Down Expand Up @@ -569,10 +574,10 @@
}
],
"source": [
"#Get the table of modifications\n",
"# Get the table of modifications\n",
"table = get_update_table(default, [experiment_1, experiment_2])\n",
"\n",
"#Write the table to a tsv file\n",
"# Write the table to a tsv file\n",
"table.to_csv(\"config_modifications2.csv\", sep=\"\\t\")\n",
"\n",
"table.head(20)"
Expand Down Expand Up @@ -764,7 +769,7 @@
}
],
"source": [
"#Update the default config with a list of experiments\n",
"# Update the default config with a list of experiments\n",
"default.update([experiment_1, experiment_2], print_modifications=True)"
]
},
Expand Down Expand Up @@ -934,7 +939,7 @@
}
],
"source": [
"#Overloaded print function to print the config in a visually appealing way\n",
"# Overloaded print function to print the config in a visually appealing way\n",
"print(default)"
]
},
Expand All @@ -945,11 +950,13 @@
"outputs": [],
"source": [
"# Validate the updated config with target.yaml\n",
"target_file = 'target.yaml'\n",
"target_file = \"target.yaml\"\n",
"target = Config(\"target\")\n",
"target.from_yaml(target_file)\n",
"\n",
"assert default.config == target.config, \"The updated config is not equal to the target config\""
"assert (\n",
" default.config == target.config\n",
"), \"The updated config is not equal to the target config\""
]
}
],
Expand Down
Loading

0 comments on commit 88faa2b

Please sign in to comment.