Skip to content
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

Added chromosome query parameter for copy number segments endpoint #5321

Merged
merged 1 commit into from
Nov 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

public interface CopyNumberSegmentRepository {

List<CopyNumberSeg> getCopyNumberSegmentsInSampleInStudy(String studyId, String sampleId, String projection,
List<CopyNumberSeg> getCopyNumberSegmentsInSampleInStudy(String studyId, String sampleId, String chromosome, String projection,
Integer pageSize, Integer pageNumber, String sortBy,
String direction);

BaseMeta getMetaCopyNumberSegmentsInSampleInStudy(String studyId, String sampleId);
BaseMeta getMetaCopyNumberSegmentsInSampleInStudy(String studyId, String sampleId, String chromosome);

List<Integer> fetchSamplesWithCopyNumberSegments(List<String> studyIds, List<String> sampleIds);
List<Integer> fetchSamplesWithCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String chromosome);

List<CopyNumberSeg> fetchCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String projection);
List<CopyNumberSeg> fetchCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String chromosome, String projection);

BaseMeta fetchMetaCopyNumberSegments(List<String> studyIds, List<String> sampleIds);
BaseMeta fetchMetaCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String chromosome);

List<CopyNumberSeg> getCopyNumberSegmentsBySampleListId(String studyId, String sampleListId, String projection);
List<CopyNumberSeg> getCopyNumberSegmentsBySampleListId(String studyId, String sampleListId, String chromosome, String projection);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

public interface CopyNumberSegmentMapper {

List<CopyNumberSeg> getCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String projection,
List<CopyNumberSeg> getCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String chromosome, String projection,
Integer limit, Integer offset, String sortBy, String direction);

List<Integer> getSamplesWithCopyNumberSegments(List<String> studyIds, List<String> sampleIds);
List<Integer> getSamplesWithCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String chromosome);

BaseMeta getMetaCopyNumberSegments(List<String> studyIds, List<String> sampleIds);
BaseMeta getMetaCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String chromosome);

List<CopyNumberSeg> getCopyNumberSegmentsBySampleListId(String studyId, String sampleListId, String projection);
List<CopyNumberSeg> getCopyNumberSegmentsBySampleListId(String studyId, String sampleListId, String chromosome, String projection);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,47 @@ public class CopyNumberSegmentMyBatisRepository implements CopyNumberSegmentRepo


@Override
public List<CopyNumberSeg> getCopyNumberSegmentsInSampleInStudy(String studyId, String sampleId,
public List<CopyNumberSeg> getCopyNumberSegmentsInSampleInStudy(String studyId, String sampleId, String chromosome,
String projection, Integer pageSize,
Integer pageNumber, String sortBy,
String direction) {

return copyNumberSegmentMapper.getCopyNumberSegments(Arrays.asList(studyId), Arrays.asList(sampleId),
return copyNumberSegmentMapper.getCopyNumberSegments(Arrays.asList(studyId), Arrays.asList(sampleId), chromosome,
projection, pageSize, offsetCalculator.calculate(pageSize, pageNumber), sortBy, direction);
}

@Override
public BaseMeta getMetaCopyNumberSegmentsInSampleInStudy(String studyId, String sampleId) {
public BaseMeta getMetaCopyNumberSegmentsInSampleInStudy(String studyId, String sampleId, String chromosome) {

return copyNumberSegmentMapper.getMetaCopyNumberSegments(Arrays.asList(studyId), Arrays.asList(sampleId));
return copyNumberSegmentMapper.getMetaCopyNumberSegments(Arrays.asList(studyId), Arrays.asList(sampleId), chromosome);
}

@Override
public List<Integer> fetchSamplesWithCopyNumberSegments(List<String> studyIds, List<String> sampleIds) {
return copyNumberSegmentMapper.getSamplesWithCopyNumberSegments(studyIds, sampleIds);
public List<Integer> fetchSamplesWithCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String chromosome) {
return copyNumberSegmentMapper.getSamplesWithCopyNumberSegments(studyIds, sampleIds, chromosome);
}

@Override
public List<CopyNumberSeg> fetchCopyNumberSegments(List<String> studyIds, List<String> sampleIds,
public List<CopyNumberSeg> fetchCopyNumberSegments(List<String> studyIds,
List<String> sampleIds,
String chromosome,
String projection) {

return copyNumberSegmentMapper.getCopyNumberSegments(studyIds, sampleIds, projection, 0, 0, null, null);
return copyNumberSegmentMapper.getCopyNumberSegments(studyIds, sampleIds, chromosome, projection, 0, 0, null, null);
}

@Override
public BaseMeta fetchMetaCopyNumberSegments(List<String> studyIds, List<String> sampleIds) {
public BaseMeta fetchMetaCopyNumberSegments(List<String> studyIds, List<String> sampleIds, String chromosome) {

return copyNumberSegmentMapper.getMetaCopyNumberSegments(studyIds, sampleIds);
return copyNumberSegmentMapper.getMetaCopyNumberSegments(studyIds, sampleIds, chromosome);
}

@Override
public List<CopyNumberSeg> getCopyNumberSegmentsBySampleListId(String studyId, String sampleListId,
public List<CopyNumberSeg> getCopyNumberSegmentsBySampleListId(String studyId,
String sampleListId,
String chromosome,
String projection) {

return copyNumberSegmentMapper.getCopyNumberSegmentsBySampleListId(studyId, sampleListId, projection);
return copyNumberSegmentMapper.getCopyNumberSegmentsBySampleListId(studyId, sampleListId, chromosome, projection);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@
INNER JOIN patient ON sample.PATIENT_ID=patient.INTERNAL_ID
INNER JOIN cancer_study ON patient.CANCER_STUDY_ID=cancer_study.CANCER_STUDY_ID
<include refid="where"/>
AND EXISTS (SELECT * from copy_number_seg where sample.INTERNAL_ID=copy_number_seg.SAMPLE_ID)
AND EXISTS (
SELECT * from copy_number_seg where sample.INTERNAL_ID=copy_number_seg.SAMPLE_ID
<if test="chromosome != null and !chromosome.isEmpty()">
AND copy_number_seg.CHR=#{chromosome}
</if>
)
</select>


Expand All @@ -51,6 +56,9 @@
<include refid="select"/>
<include refid="from"/>
<include refid="where"/>
<if test="chromosome != null and !chromosome.isEmpty()">
AND copy_number_seg.CHR=#{chromosome}
</if>
<if test="sortBy != null and projection != 'ID'">
ORDER BY ${sortBy} ${direction}
</if>
Expand All @@ -67,13 +75,19 @@
COUNT(*) AS totalCount
<include refid="from"/>
<include refid="where"/>
<if test="chromosome != null and !chromosome.isEmpty()">
AND copy_number_seg.CHR=#{chromosome}
</if>
</select>

<select id="getCopyNumberSegmentsBySampleListId" resultType="org.cbioportal.model.CopyNumberSeg">
SELECT
<include refid="select"/>
<include refid="from"/>
WHERE cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId}
<if test="chromosome != null and !chromosome.isEmpty()">
AND copy_number_seg.CHR=#{chromosome}
</if>
AND copy_number_seg.SAMPLE_ID IN
(
SELECT sample_list_list.SAMPLE_ID FROM sample_list_list
Expand Down
Loading