Skip to content

Commit

Permalink
Get Data: mz low/high cutoffs to Double. Add List mz low/high cutoffs
Browse files Browse the repository at this point in the history
For the existing mz low/high cutoffs, change from Float to Double.
Add List of mz low/high cutoffs to Get_ScanDataFromScanNumbers_Request
  • Loading branch information
danjasuw committed Jul 23, 2023
1 parent f1e5439 commit 1aaf696
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.enums.Get_ScanData_ExcludeReturnScanPeakData;
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.enums.Get_ScanData_IncludeReturnIonInjectionTimeData;
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.enums.Get_ScanData_IncludeReturnScanLevelTotalIonCurrentData;
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.sub_parts.Get_ScanDataFromScanNumbers_M_Over_Z_Range_SubRequest;

/**
* Request object for POST to Webservice GetScanDataFromScanNumbers_Servlet
Expand Down Expand Up @@ -64,42 +65,54 @@ public class Get_ScanDataFromScanNumbers_Request extends BaseGetDataWebserviceRe

/**
* If populated, do not return any peaks with mz below this cutoff.
*
* This cutoff is applied in Addition To the filters in property 'm_Over_Z_Range_Filters'
*/
@XmlAttribute // attribute name is property name
private Float mzLowCutoff;
private Double mzLowCutoff;

/**
* If populated, do not return any peaks with mz above this cutoff.
*
* This cutoff is applied in Addition To the filters in property 'm_Over_Z_Range_Filters'
*/
@XmlAttribute // attribute name is property name
private Float mzHighCutoff;
private Double mzHighCutoff;


/**
* Main Query element, list of m/z filter cutoffs. Each m/z range is OR with each other
*/
@XmlElementWrapper(name="m_Over_Z_Range_Filters")
@XmlElement(name="m_Over_Z_Range_Filter")
private List<Get_ScanDataFromScanNumbers_M_Over_Z_Range_SubRequest> m_Over_Z_Range_Filters;


/**
* If populated, do not return any peaks with mz below this cutoff.
*/
public Float getMzLowCutoff() {
public Double getMzLowCutoff() {
return mzLowCutoff;
}

/**
* If populated, do not return any peaks with mz below this cutoff.
*/
public void setMzLowCutoff(Float mzLowCutoff) {
public void setMzLowCutoff(Double mzLowCutoff) {
this.mzLowCutoff = mzLowCutoff;
}

/**
* If populated, do not return any peaks with mz above this cutoff.
*/
public Float getMzHighCutoff() {
public Double getMzHighCutoff() {
return mzHighCutoff;
}

/**
* If populated, do not return any peaks with mz above this cutoff.
*/
public void setMzHighCutoff(Float mzHighCutoff) {
public void setMzHighCutoff(Double mzHighCutoff) {
this.mzHighCutoff = mzHighCutoff;
}

Expand Down Expand Up @@ -154,5 +167,14 @@ public void setIncludeReturnScanLevelTotalIonCurrentData(
this.includeReturnScanLevelTotalIonCurrentData = includeReturnScanLevelTotalIonCurrentData;
}

public List<Get_ScanDataFromScanNumbers_M_Over_Z_Range_SubRequest> getM_Over_Z_Range_Filters() {
return m_Over_Z_Range_Filters;
}

public void setM_Over_Z_Range_Filters(
List<Get_ScanDataFromScanNumbers_M_Over_Z_Range_SubRequest> m_Over_Z_Range_Filters) {
this.m_Over_Z_Range_Filters = m_Over_Z_Range_Filters;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public class Get_ScansDataFromRetentionTimeRange_Request extends BaseGetDataWebs
* If populated, do not return any peaks with mz below this cutoff.
*/
@XmlAttribute // attribute name is property name
private Float mzLowCutoff;
private Double mzLowCutoff;

/**
* If populated, do not return any peaks with mz above this cutoff.
*/
@XmlAttribute // attribute name is property name
private Float mzHighCutoff;
private Double mzHighCutoff;

/**
* Only return scans for this scan level
Expand Down Expand Up @@ -71,28 +71,28 @@ public void setExcludeScansWithoutPeaks(Get_ScanData_ExcludeScansWithoutPeaks ex
/**
* If populated, do not return any peaks with mz below this cutoff.
*/
public Float getMzLowCutoff() {
public Double getMzLowCutoff() {
return mzLowCutoff;
}

/**
* If populated, do not return any peaks with mz below this cutoff.
*/
public void setMzLowCutoff(Float mzLowCutoff) {
public void setMzLowCutoff(Double mzLowCutoff) {
this.mzLowCutoff = mzLowCutoff;
}

/**
* If populated, do not return any peaks with mz above this cutoff.
*/
public Float getMzHighCutoff() {
public Double getMzHighCutoff() {
return mzHighCutoff;
}

/**
* If populated, do not return any peaks with mz above this cutoff.
*/
public void setMzHighCutoff(Float mzHighCutoff) {
public void setMzHighCutoff(Double mzHighCutoff) {
this.mzHighCutoff = mzHighCutoff;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.sub_parts;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

/**
* Sub Part for class Get_ScanDataFromScanNumbers_Request
*
* A Single m/z range to filter the returned scan peaks
*
* Each m/z range is OR with each other
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
public class Get_ScanDataFromScanNumbers_M_Over_Z_Range_SubRequest {


/**
* A Single m/z range to filter the returned scan peaks
*
* Each m/z range is OR with each other
*/
@XmlAttribute // attribute name is property name
private Double mzLowCutoff;

/**
* A Single m/z range to filter the returned scan peaks
*
* Each m/z range is OR with each other
*/
@XmlAttribute // attribute name is property name
private Double mzHighCutoff;



public Double getMzLowCutoff() {
return mzLowCutoff;
}

public void setMzLowCutoff(Double mzLowCutoff) {
this.mzLowCutoff = mzLowCutoff;
}

public Double getMzHighCutoff() {
return mzHighCutoff;
}

public void setMzHighCutoff(Double mzHighCutoff) {
this.mzHighCutoff = mzHighCutoff;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;

import org.slf4j.LoggerFactory; import org.slf4j.Logger;
import org.yeastrc.spectral_storage.get_data_webapp.servlet_response_factories.SingleScan_SubResponse_Factory_Parameters.SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range;
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.sub_parts.SingleScanPeak_SubResponse;
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.sub_parts.SingleScan_SubResponse;
import org.yeastrc.spectral_storage.spectral_file_common.spectral_file.storage_files_on_disk.common_dto.data_file.SpectralFile_SingleScanPeak_Common;
Expand Down Expand Up @@ -61,6 +62,9 @@ public SingleScan_SubResponse buildSingleScan_SubResponse(
singleScan_SubResponse.setPeaks( peaks );

for ( SpectralFile_SingleScanPeak_Common peakCommon : spectralFile_SingleScan_Common.getScanPeaksAsObjectArray() ) {

// Filter on top level request m/z filter cutoffs

if ( singleScan_SubResponse_Factory_Parameters.getMzLowCutoff() != null
&& singleScan_SubResponse_Factory_Parameters.getMzLowCutoff() > peakCommon.getM_over_Z() ) {
continue; // Skip Peak since MZ below low cutoff
Expand All @@ -69,6 +73,39 @@ public SingleScan_SubResponse buildSingleScan_SubResponse(
&& singleScan_SubResponse_Factory_Parameters.getMzHighCutoff() < peakCommon.getM_over_Z() ) {
continue; // Skip Peak since MZ above high cutoff
}

// Filter on m/z filter cutoffs in list


if ( singleScan_SubResponse_Factory_Parameters.getM_Over_Z_Range_Filters() != null ) {

boolean keepPeak = false;

for ( SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range m_Over_Z_Range : singleScan_SubResponse_Factory_Parameters.getM_Over_Z_Range_Filters() ) {

boolean keepPeak_SingleRange = true;

if ( m_Over_Z_Range.getMzLowCutoff() != null
&& m_Over_Z_Range.getMzLowCutoff() > peakCommon.getM_over_Z() ) {
keepPeak_SingleRange = false; // Peak MZ below low cutoff
}
if ( m_Over_Z_Range.getMzHighCutoff() != null
&& m_Over_Z_Range.getMzHighCutoff() < peakCommon.getM_over_Z() ) {
keepPeak_SingleRange = false; // Peak MZ above high cutoff
}

if ( keepPeak_SingleRange ) {
// Peak m/z found in a range so keep peak
keepPeak = true;
break;
}
}

if ( ! keepPeak ) {
continue; // Skip Peak since MZ Not meet MZ Filters
}
}

SingleScanPeak_SubResponse peak = new SingleScanPeak_SubResponse();
peak.setMz( peakCommon.getM_over_Z() );
peak.setIntensity( peakCommon.getIntensity() );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,102 @@
package org.yeastrc.spectral_storage.get_data_webapp.servlet_response_factories;

import java.util.List;

/**
* Parameters to SingleScan_SubResponse_Factory
*
*/
public class SingleScan_SubResponse_Factory_Parameters {

/**
* If populated, do not return any peaks with mz below this cutoff.
* If populated, do not return any peaks with mz below this cutoff.
*
* This cutoff is applied in Addition To the filters in property 'm_Over_Z_Range_Filters'
*/
private Float mzLowCutoff;
private Double mzLowCutoff;

/**
* If populated, do not return any peaks with mz above this cutoff.
*
* This cutoff is applied in Addition To the filters in property 'm_Over_Z_Range_Filters'
*/
private Double mzHighCutoff;

/**
* Each m/z range is OR with each other
*/
private Float mzHighCutoff;
private List<SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range> m_Over_Z_Range_Filters;


///


/**
* Sub Part for class SingleScan_SubResponse_Factory_Parameters
*
* A Single m/z range to filter the returned scan peaks
*
* Each m/z range is OR with each other and with the m/z range in the main request
*
*/
public static class SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range {

/**
* A Single m/z range to filter the returned scan peaks
*
* Each m/z range is OR with each other and with the m/z range in the main request
*/
private Double mzLowCutoff;

/**
* A Single m/z range to filter the returned scan peaks
*
* Each m/z range is OR with each other and with the m/z range in the main request
*/
private Double mzHighCutoff;



public Double getMzLowCutoff() {
return mzLowCutoff;
}

public Float getMzLowCutoff() {
public void setMzLowCutoff(Double mzLowCutoff) {
this.mzLowCutoff = mzLowCutoff;
}

public Double getMzHighCutoff() {
return mzHighCutoff;
}

public void setMzHighCutoff(Double mzHighCutoff) {
this.mzHighCutoff = mzHighCutoff;
}
}

public Double getMzLowCutoff() {
return mzLowCutoff;
}

public void setMzLowCutoff(Float mzLowCutoff) {
public void setMzLowCutoff(Double mzLowCutoff) {
this.mzLowCutoff = mzLowCutoff;
}

public Float getMzHighCutoff() {
public Double getMzHighCutoff() {
return mzHighCutoff;
}

public void setMzHighCutoff(Float mzHighCutoff) {
public void setMzHighCutoff(Double mzHighCutoff) {
this.mzHighCutoff = mzHighCutoff;
}


public List<SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range> getM_Over_Z_Range_Filters() {
return m_Over_Z_Range_Filters;
}

public void setM_Over_Z_Range_Filters(
List<SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range> m_Over_Z_Range_Filters) {
this.m_Over_Z_Range_Filters = m_Over_Z_Range_Filters;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.yeastrc.spectral_storage.get_data_webapp.exceptions.SpectralFileWebappInternalRuntimeException;
import org.yeastrc.spectral_storage.get_data_webapp.servlet_response_factories.SingleScan_SubResponse_Factory;
import org.yeastrc.spectral_storage.get_data_webapp.servlet_response_factories.SingleScan_SubResponse_Factory_Parameters;
import org.yeastrc.spectral_storage.get_data_webapp.servlet_response_factories.SingleScan_SubResponse_Factory_Parameters.SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range;
import org.yeastrc.spectral_storage.get_data_webapp.servlets_common.GetRequestObjectFromInputStream;
import org.yeastrc.spectral_storage.get_data_webapp.servlets_common.Get_ServletResultDataFormat_FromServletInitParam;
import org.yeastrc.spectral_storage.get_data_webapp.servlets_common.WriteResponseObjectToOutputStream;
Expand All @@ -35,6 +36,7 @@
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.enums.Get_ScanData_ScanFileAPI_Key_NotFound;
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.main.Get_ScanDataFromScanNumbers_Request;
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.main.Get_ScanDataFromScanNumbers_Response;
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.sub_parts.Get_ScanDataFromScanNumbers_M_Over_Z_Range_SubRequest;
import org.yeastrc.spectral_storage.get_data_webapp.shared_server_client.webservice_request_response.sub_parts.SingleScan_SubResponse;
import org.yeastrc.spectral_storage.spectral_file_common.spectral_file.constants_enums.CommonCore_Get_ScanData_IncludeReturnIonInjectionTimeData_Enum;
import org.yeastrc.spectral_storage.spectral_file_common.spectral_file.constants_enums.CommonCore_Get_ScanData_IncludeReturnTotalIonCurrentData_Enum;
Expand Down Expand Up @@ -317,6 +319,21 @@ private void processRequest(
singleScan_SubResponse_Factory_Parameters.setMzHighCutoff( get_ScanDataFromScanNumbers_Request.getMzHighCutoff() );
singleScan_SubResponse_Factory_Parameters.setMzLowCutoff( get_ScanDataFromScanNumbers_Request.getMzLowCutoff() );

if ( get_ScanDataFromScanNumbers_Request.getM_Over_Z_Range_Filters() != null ) {

List<SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range> m_Over_Z_Range_Filters = new ArrayList<>( get_ScanDataFromScanNumbers_Request.getM_Over_Z_Range_Filters().size() );
singleScan_SubResponse_Factory_Parameters.setM_Over_Z_Range_Filters(m_Over_Z_Range_Filters);

for ( Get_ScanDataFromScanNumbers_M_Over_Z_Range_SubRequest inputItem : get_ScanDataFromScanNumbers_Request.getM_Over_Z_Range_Filters() ) {

SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range outputItem = new SingleScan_SubResponse_Factory_Parameters__M_Over_Z_Range();
outputItem.setMzHighCutoff( inputItem.getMzHighCutoff() );
outputItem.setMzLowCutoff( inputItem.getMzLowCutoff() );

m_Over_Z_Range_Filters.add(outputItem);
}
}

// Updated in method processScanNumber(...): (Not synchronized here since always read and updated in a synchronized block on 'insertedScansScanNumbers'

List<SingleScan_SubResponse> scans = new ArrayList<>( returnedScanListInitialSize );
Expand Down

0 comments on commit 1aaf696

Please sign in to comment.