Skip to content

Commit

Permalink
Change "/" to "*" to increase speed.
Browse files Browse the repository at this point in the history
  • Loading branch information
fcyu committed Feb 2, 2018
1 parent b0c7fa3 commit fd9494a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/proteomics/ECL2.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private ECL2(String parameter_path, String spectra_path, String dbName) throws I
thread_num = 1;
}
ExecutorService thread_pool = Executors.newFixedThreadPool(thread_num);
Search search_obj = new Search(build_index_obj, parameter_map);
Search search_obj = new Search(build_index_obj, parameter_map, ms1Tolerance, leftInverseMs1Tolerance, rightInverseMs1Tolerance, ms1ToleranceUnit);
List<Future<Boolean>> taskList = new LinkedList<>();
Connection sqlConnection = DriverManager.getConnection(sqlPath);
Statement sqlStatement = sqlConnection.createStatement();
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/proteomics/Search/Search.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
public class Search {

public final double ms1_tolerance;
public final double leftInverseMs1Tolerance;
public final double rightInverseMs1Tolerance;
public final int ms1_tolerance_unit;
private final Map<String, ChainEntry> chain_entry_map;
private final MassTool mass_tool_obj;
Expand All @@ -23,12 +25,14 @@ public class Search {
private final boolean cal_evalue;

/////////////////////////////////////////public methods////////////////////////////////////////////////////////////
public Search(BuildIndex build_index_obj, Map<String, String> parameter_map) {
public Search(BuildIndex build_index_obj, Map<String, String> parameter_map, double ms1_tolerance, double leftInverseMs1Tolerance, double rightInverseMs1Tolerance, int ms1ToleranceUnit) {
this.build_index_obj = build_index_obj;
chain_entry_map = build_index_obj.getSeqEntryMap();
mass_tool_obj = build_index_obj.returnMassTool();
ms1_tolerance_unit = Integer.valueOf(parameter_map.get("ms1_tolerance_unit"));
ms1_tolerance = Double.valueOf(parameter_map.get("ms1_tolerance"));
this.ms1_tolerance = ms1_tolerance;
this.leftInverseMs1Tolerance = leftInverseMs1Tolerance;
this.rightInverseMs1Tolerance = rightInverseMs1Tolerance;
this.ms1_tolerance_unit = ms1ToleranceUnit;
bin_seq_map = build_index_obj.getMassBinSeqMap();
single_chain_t = Double.valueOf(parameter_map.get("single_chain_t"));
if (parameter_map.get("cal_evalue").contentEquals("0")) {
Expand Down Expand Up @@ -57,8 +61,8 @@ ResultEntry doSearch(SparseVector xcorrPL, TreeMap<Integer, List<Double>> binSco
double leftMs1Tol = ms1_tolerance;
double rightMs1Tol = ms1_tolerance;
if (ms1_tolerance_unit == 1) {
leftMs1Tol = precursorMass - (precursorMass / (1 + ms1_tolerance * 1e-6));
rightMs1Tol = (precursorMass / (1 - ms1_tolerance * 1e-6)) - precursorMass;
leftMs1Tol = precursorMass - (precursorMass * leftInverseMs1Tolerance);
rightMs1Tol = (precursorMass * rightInverseMs1Tolerance) - precursorMass;
}

// for debug
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/proteomics/Spectrum/PreSpectra.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class PreSpectra {
private static final Pattern scanNumPattern2 = Pattern.compile("scan=([0-9]+)", Pattern.CASE_INSENSITIVE);
private static final Pattern scanNumPattern3 = Pattern.compile("^[^.]+\\.([0-9]+)\\.[0-9]+\\.[0-9]");

public PreSpectra(JMzReader spectra_parser, BuildIndex build_index_obj, Map<String, String> parameter_map, String ext, String sqlPath) throws MzXMLParsingException, IOException, SQLException {
public PreSpectra(JMzReader spectra_parser, double ms1Tolerance, double leftInverseMs1Tolerance, double rightInverseMs1Tolerance, int ms1ToleranceUnit, BuildIndex build_index_obj, Map<String, String> parameter_map, String ext, String sqlPath) throws MzXMLParsingException, IOException, SQLException, JMzReaderException {
Set<Integer> debug_scan_num_set = new HashSet<>();
// In DEBUG mode, filter out unlisted scan num
if (ECL2.debug) {
Expand Down

0 comments on commit fd9494a

Please sign in to comment.