Skip to content

Commit

Permalink
Merge branch 'master' into fix_boolean_to_select_transition
Browse files Browse the repository at this point in the history
  • Loading branch information
bgruening authored Apr 27, 2024
2 parents e06e673 + 00029e8 commit e980a63
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [run-all-tool-tests-command]
env:
GALAXY_FORK: galaxyproject
GALAXY_BRANCH: release_23.2
GALAXY_BRANCH: release_24.0
MAX_CHUNKS: 40
jobs:
setup:
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
mode: lint
repository-list: ${{ needs.setup.outputs.repository-list }}
tool-list: ${{ needs.setup.outputs.tool-list }}
additional-planemo-options: --biocontainers -s tests,output,inputs,help,general,command,citations,tool_xsd,xml_order,tool_urls,shed_metadata
additional-planemo-options: --biocontainers -s stdio,tests,output,inputs,help,general,command,citations,tool_xsd,xml_order,tool_urls,shed_metadata,urls,readme,shed_yaml,repository_dependencies,tool_dependencies_actions,tool_dependencies_sha256sum,tool_dependencies_xsd,expansion
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
Expand Down Expand Up @@ -204,6 +204,7 @@ jobs:
with:
name: 'All tool test results'
path: upload
- run: cat upload/tool_test_output.md >> $GITHUB_STEP_SUMMARY
- name: Create URL to the run output
if: ${{ github.event.client_payload.slash_command.command == 'run-all-tool-tests' }}
id: vars
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Galaxy Tool Linting and Tests for push and PR
on:
pull_request:
paths-ignore:
- '.github/**'
- 'deprecated/**'
- 'docs/**'
- '*'
Expand All @@ -11,13 +10,12 @@ on:
- main
- master
paths-ignore:
- '.github/**'
- 'deprecated/**'
- 'docs/**'
- '*'
env:
GALAXY_FORK: galaxyproject
GALAXY_BRANCH: release_23.2
GALAXY_BRANCH: release_24.0
MAX_CHUNKS: 4
MAX_FILE_SIZE: 1M
concurrency:
Expand Down Expand Up @@ -401,7 +399,7 @@ jobs:
deploy-report:
name: Report deploy status
needs: [deploy]
if: ${{ always() && needs.deploy.result != 'success' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' ) && github.repository_owner == 'galaxyproject' }}
if: ${{ always() && needs.deploy.result != 'success' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' ) && github.repository_owner == 'galaxyproteomics' }}
runs-on: ubuntu-latest
steps:
# report to the PR if deployment failed
Expand Down
15 changes: 11 additions & 4 deletions tools/qupath_roi_splitter/qupath_roi_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@ def draw_roi(input_roi, input_img, fill):
# Polygon with holes
if not isinstance(sub_roi[0][0], list):
if first_roi:
input_img = draw_poly(sub_roi, input_img, fill=fill)
first_roi = False
col = (0, 0, 0)
else:
# holes in ROI
input_img = draw_poly(sub_roi, input_img, col=(255, 255, 255), fill=fill)
col = (255, 255, 255) if not fill else (0, 0, 0)
input_img = draw_poly(sub_roi, input_img, col=col, fill=fill)
else:
# MultiPolygon with holes
for sub_coord in sub_roi:
if first_roi:
input_img = draw_poly(sub_coord, input_img, fill=fill)
first_roi = False
col = (0, 0, 0)
else:
# holes in ROI
input_img = draw_poly(sub_coord, input_img, col=(255, 255, 255), fill=fill)
col = (255, 255, 255) if not fill else (0, 0, 0)
input_img = draw_poly(sub_coord, input_img, col=col, fill=fill)

return input_img

Expand Down Expand Up @@ -89,13 +91,18 @@ def split_qupath_roi(in_roi):

coords_df.to_csv("{}_{}.txt".format(tma_name, cell_type), sep='\t', index=False)

# img save
if args.img:
cv2.imwrite("{}_{}.png".format(tma_name, cell_type), img)


if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Split ROI coordinates of QuPath TMA annotation by cell type (classfication)")
parser.add_argument("--qupath_roi", default=False, help="Input QuPath annotation (GeoJSON file)")
parser.add_argument("--fill", action="store_true", required=False, help="Fill pixels in ROIs")
parser.add_argument('--version', action='version', version='%(prog)s 0.1.0')
parser.add_argument("--all", action="store_true", required=False, help="Extracts all ROIs")
parser.add_argument("--img", action="store_true", required=False, help="Generates image of ROIs")
args = parser.parse_args()

if args.qupath_roi:
Expand Down
22 changes: 18 additions & 4 deletions tools/qupath_roi_splitter/qupath_roi_splitter.xml
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
<tool id="qupath_roi_splitter" name="QuPath ROI Splitter" version="@VERSION@+galaxy@VERSION_SUFFIX@">
<description>Split ROI coordinates of QuPath TMA annotation by cell type (classification)</description>
<macros>
<token name="@VERSION@">0.2.0</token>
<token name="@VERSION@">0.2.1</token>
<token name="@VERSION_SUFFIX@">0</token>
</macros>
<requirements>
<requirement type="package" version="3.0.1">geojson</requirement>
<requirement type="package" version="1.24.2">numpy</requirement>
<requirement type="package" version="4.7.0">opencv</requirement>
<requirement type="package" version="2.0.0">pandas</requirement>
<requirement type="package" version="2.0.0">pandas</requirement>
</requirements>
<command detect_errors="exit_code"><![CDATA[
#for $input in $input_collection
python3 '$__tool_directory__/qupath_roi_splitter.py'
--qupath_roi '$input'
$optional.fill
$optional.all
$optional.img
&&
#end for
mkdir out
&& mv *.txt out/
&& mv *.png out/
]]></command>
<inputs>
<param name="input_collection" type="data_collection" format="geojson" label="Input QuPath annotation" help="Collection containing GeoJSON files"/>
<section name="optional" title="Optional">
<param name="fill" type="boolean" truevalue="--fill" falsevalue="" checked="false" label="Fill ROIs" help="Fill pixels in ROIs"/>
<param name="all" type="boolean" truevalue="--all" falsevalue="" checked="false" label="Extract all" help="Extracts all ROIs"/>
<param name="img" type="boolean" truevalue="--img" falsevalue="" checked="false" label="Generate image" help="Generates image from ROIs"/>
</section>
</inputs>
<outputs>
<collection name="output_txts" type="list" label="${tool.name} on ${on_string}: ROI data">
<discover_datasets pattern="__name_and_ext__" directory="out" visible="false" format="txt"/>
<discover_datasets pattern="(?P&lt;name&gt;.*\.txt)" directory="out" visible="false" ext="txt"/>
</collection>
<collection name="output_imgs" type="list" label="${tool.name} on ${on_string}: Images of ROIs">
<discover_datasets pattern="(?P&lt;name&gt;.*\.png)" directory="out" visible="false" ext="png"/>
</collection>
</outputs>
<tests>
Expand All @@ -43,9 +49,10 @@
</param>
<section name="optional">
<param name="fill" value="true"/>
<param name="img" value="true"/>
</section>
<output_collection name="output_txts" type="list" count="4">
<element name="F-5_Stroma">
<element name="F-5_Stroma.txt">
<assert_contents>
<has_text text="x"/>
<has_text text="y"/>
Expand All @@ -54,6 +61,13 @@
</assert_contents>
</element>
</output_collection>
<output_collection name="output_imgs" type="list" count="4">
<element name="E-5_Tumor.png">
<assert_contents>
<has_size value="1309478"/>
</assert_contents>
</element>
</output_collection>
</test>
</tests>
<help><![CDATA[
Expand Down

0 comments on commit e980a63

Please sign in to comment.