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

Display Globus button for items with Globus integration #96

Merged
merged 1 commit into from
Nov 23, 2021
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
5 changes: 5 additions & 0 deletions app/assets/stylesheets/components/globus.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#globus {
a {
color: #ffffff;
}
}
16 changes: 16 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,20 @@ def render_field_row_link(title, url)
html.html_safe
end
# rubocop:enable Rails/OutputSafety

# rubocop:disable Rails/OutputSafety
def render_globus_download(uri)
return if uri.blank?
html = <<-HTML
<div id="globus">
<button data-v-b7851b04="" type="button" class="document-downloads__button lux-button solid medium">#{link_to('Download from Globus', uri, target: '_blank', title: 'opens in a new tab', rel: 'noopener noreferrer')}
<svg data-v-b7851b04="" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16" class="bi bi-cloud-arrow-down-fill">
<path data-v-b7851b04="" d="M8 2a5.53 5.53 0 0 0-3.594 1.342c-.766.66-1.321 1.52-1.464 2.383C1.266 6.095 0 7.555 0 9.318 0 11.366 1.708 13 3.781 13h8.906C14.502 13 16 11.57 16 9.773c0-1.636-1.242-2.969-2.834-3.194C12.923 3.999 10.69 2 8 2zm2.354 6.854-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 1 1 .708-.708L7.5 9.293V5.5a.5.5 0 0 1 1 0v3.793l1.146-1.147a.5.5 0 0 1 .708.708z"></path>
</svg>
</button>
</div>
HTML
html.html_safe
end
# rubocop:enable Rails/OutputSafety
end
4 changes: 4 additions & 0 deletions app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,8 @@ def files
def referenced_by
fetch("referenced_by_ssim", [])
end

def uri
fetch("uri_tesim", [])
end
end
8 changes: 3 additions & 5 deletions app/views/catalog/_show_documents.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@
</tbody>
<tfoot></tfoot>
</table>
<button data-v-b7851b04="" type="button" class="document-downloads__button lux-button solid medium"><!----> Download from Globus
<svg data-v-b7851b04="" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16" class="bi bi-cloud-arrow-down-fill">
<path data-v-b7851b04="" d="M8 2a5.53 5.53 0 0 0-3.594 1.342c-.766.66-1.321 1.52-1.464 2.383C1.266 6.095 0 7.555 0 9.318 0 11.366 1.708 13 3.781 13h8.906C14.502 13 16 11.57 16 9.773c0-1.636-1.242-2.969-2.834-3.194C12.923 3.999 10.69 2 8 2zm2.354 6.854-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 1 1 .708-.708L7.5 9.293V5.5a.5.5 0 0 1 1 0v3.793l1.146-1.147a.5.5 0 0 1 .708.708z"></path>
</svg>
</button>
<% @document.uri.each do |uri| %>
<%= render_globus_download(uri) if uri.include?("app.globus.org") %>
<% end %>
</div>
</div>
</div>
Expand Down
321 changes: 321 additions & 0 deletions spec/fixtures/globus_items.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,321 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<items>
<item>
<handle>88435/dsp01dn39x4181</handle>
<id>88163</id>
<name>Noise correlations in the human brain and their impact on pattern classification</name>
<type>item</type>
<archived>true</archived>
<bitstreams>
<expand>parent</expand>
<expand>policies</expand>
<expand>all</expand>
<id>114309</id>
<name>license.txt</name>
<type>bitstream</type>
<bundleName>LICENSE</bundleName>
<checkSum checkSumAlgorithm="MD5">1e204dad3e9e1e2e6660eef9c33467e9</checkSum>
<format>License</format>
<mimeType>text/plain</mimeType>
<retrieveLink>/bitstreams/114309/retrieve</retrieveLink>
<sequenceId>3</sequenceId>
<sizeBytes>3223</sizeBytes>
</bitstreams>
<bitstreams>
<expand>parent</expand>
<expand>policies</expand>
<expand>all</expand>
<id>114347</id>
<name>README.txt</name>
<type>bitstream</type>
<bundleName>ORIGINAL</bundleName>
<checkSum checkSumAlgorithm="MD5">0adebe81c7a6bde191a16e0aac7c62f8</checkSum>
<format>Text</format>
<mimeType>text/plain</mimeType>
<retrieveLink>/bitstreams/114347/retrieve</retrieveLink>
<sequenceId>4</sequenceId>
<sizeBytes>2887</sizeBytes>
</bitstreams>
<bitstreams>
<expand>parent</expand>
<expand>policies</expand>
<expand>all</expand>
<id>114308</id>
<name>Corr_MVPA_archive.tar.gz</name>
<type>bitstream</type>
<bundleName>ORIGINAL</bundleName>
<checkSum checkSumAlgorithm="MD5">58d40d8ffe48f1e5ac402e135ce04993</checkSum>
<format>Unknown</format>
<mimeType>application/octet-stream</mimeType>
<retrieveLink>/bitstreams/114308/retrieve</retrieveLink>
<sequenceId>2</sequenceId>
<sizeBytes>2750449822</sizeBytes>
</bitstreams>
<bitstreams>
<expand>parent</expand>
<expand>policies</expand>
<expand>all</expand>
<id>114348</id>
<name>README.txt.txt</name>
<type>bitstream</type>
<bundleName>TEXT</bundleName>
<checkSum checkSumAlgorithm="MD5">638def192538ce3a9ec7e2886efb4721</checkSum>
<description>Extracted text</description>
<format>Text</format>
<mimeType>text/plain</mimeType>
<retrieveLink>/bitstreams/114348/retrieve</retrieveLink>
<sequenceId>5</sequenceId>
<sizeBytes>2878</sizeBytes>
</bitstreams>
<lastModified>2020-12-09 21:39:02.118</lastModified>
<metadata>
<key>dc.contributor.author</key>
<value>Bejjanki, Vikranth R.</value>
</metadata>
<metadata>
<key>dc.contributor.author</key>
<value>da Silveira, Rava Azeredo</value>
</metadata>
<metadata>
<key>dc.contributor.author</key>
<value>Cohen, Jonathan D.</value>
</metadata>
<metadata>
<key>dc.contributor.author</key>
<value>Turk-Browne, Nicholas B.</value>
</metadata>
<metadata>
<key>dc.date.accessioned</key>
<value>2017-08-10T18:42:18Z</value>
</metadata>
<metadata>
<key>dc.date.available</key>
<value>2017-08-10T18:42:18Z</value>
</metadata>
<metadata>
<key>dc.date.issued</key>
<value>2017-08</value>
</metadata>
<metadata>
<key>dc.identifier.uri</key>
<value>http://arks.princeton.edu/ark:/88435/dsp01dn39x4181</value>
</metadata>
<metadata>
<key>dc.identifier.uri</key>
<value>https://app.globus.org/file-manager?origin_id=dc43f461-0ca7-4203-848c-33a9fc00a464&origin_path=%2F9a07-f696%2F</value>
</metadata>
<metadata>
<key>dc.description</key>
<language>en_US</language>
<value>fMRI data used to carry out the analyses described in: Vikranth R. Bejjanki, Rava Azeredo da Silveira, Jonathan D. Cohen, & Nicholas B. Turk-Browne, "Noise correlations in the human brain and their impact on pattern classification". Includes data from 17 human participants, acquired with a 3T scanner (Siemens Skyra) using a 16-channel head coil. For each participant, data from two face/scene "localizer" runs, where participants were presented with blocks of face or scene stimuli interleaved with blank periods, and two "rest" runs, where participants passively viewed a central fixation point, is included. Further information is available in the dataset README file. This dataset is too large to download directly from this item page. You can access and download the data via Globus at this link: https://app.globus.org/file-manager?origin_id=dc43f461-0ca7-4203-848c-33a9fc00a464&origin_path=%2F9a07-f696%2F (See https://docs.globus.org/how-to/get-started/ for instructions on how to use Globus, sign-in is required).</value>
</metadata>
<metadata>
<key>dc.description.abstract</key>
<language>en_US</language>
<value>Multivariate decoding methods, such as multivoxel pattern analysis (MVPA), are highly effective at extracting information from brain imaging data. Yet, the precise nature of the information that MVPA draws upon remains controversial. Most current theories emphasize the enhanced sensitivity imparted by aggregating across voxels that have mixed and weak selectivity. However, beyond the selectivity of individual voxels, neural variability is correlated across voxels, and such noise correlations may contribute importantly to accurate decoding. Indeed, a recent computational theory proposed that noise correlations enhance multivariate decoding from heterogeneous neural populations. Here we extend this theory from the scale of neurons to functional magnetic resonance imaging (fMRI) and show that noise correlations between heterogeneous populations of voxels (i.e., voxels selective for different stimulus variables) contribute to the success of MVPA. Specifically, decoding performance is enhanced when voxels with high vs. low noise correlations (measured during rest or in the background of the task) are selected during classifier training. Conversely, voxels that are strongly selective for one class in a GLM or that receive high classification weights in MVPA tend to exhibit high noise correlations with voxels selective for the other class being discriminated against. Furthermore, we use simulations to show that this is a general property of fMRI data and that selectivity and noise correlations can have distinguishable influences on decoding. Taken together, our findings demonstrate that if there is signal in the data, the resulting above-chance classification accuracy is modulated by the magnitude of noise correlations.</value>
</metadata>
<metadata>
<key>dc.title</key>
<language>en_US</language>
<value>Noise correlations in the human brain and their impact on pattern classification</value>
</metadata>
<metadata>
<key>dc.type</key>
<language>en_US</language>
<value>Dataset</value>
</metadata>
<metadata>
<key>pu.projectgrantnumber</key>
<value>PRINU-24400-G0002-10005089-101</value>
</metadata>
<parentCollection>
<expand>parentCommunityList</expand>
<expand>parentCommunity</expand>
<expand>items</expand>
<expand>license</expand>
<expand>logo</expand>
<expand>all</expand>
<handle>88435/dsp010g354h44r</handle>
<id>1061</id>
<name>Research Data Sets</name>
<type>collection</type>
<copyrightText/>
<introductoryText/>
<numberItems>28</numberItems>
<shortDescription/>
<sidebarText/>
</parentCollection>
<parentCollectionList>
<expand>parentCommunityList</expand>
<expand>parentCommunity</expand>
<expand>items</expand>
<expand>license</expand>
<expand>logo</expand>
<expand>all</expand>
<handle>88435/dsp010g354h44r</handle>
<id>1061</id>
<name>Research Data Sets</name>
<type>collection</type>
<copyrightText/>
<introductoryText/>
<numberItems>28</numberItems>
<shortDescription/>
<sidebarText/>
</parentCollectionList>
<parentCommunityList>
<expand>parentCommunity</expand>
<expand>collections</expand>
<expand>subCommunities</expand>
<expand>logo</expand>
<expand>all</expand>
<handle>88435/dsp0147429c369</handle>
<id>326</id>
<name>Princeton Neuroscience Institute</name>
<type>community</type>
<copyrightText/>
<countItems>28</countItems>
<introductoryText/>
<shortDescription/>
<sidebarText/>
</parentCommunityList>
<withdrawn>false</withdrawn>
</item>
<item>
<handle>88435/dsp016395w7223</handle>
<id>6517</id>
<name>Antialigned Rapidly Spinning Dipoles</name>
<type>item</type>
<archived>true</archived>
<bitstreams>
<expand>parent</expand>
<expand>policies</expand>
<expand>all</expand>
<id>12273</id>
<name>t180s40.mpeg</name>
<type>bitstream</type>
<bundleName>ORIGINAL</bundleName>
<checkSum checkSumAlgorithm="MD5">4fafcf073dc7c18d7b794a6dba55f65c</checkSum>
<format>MPEG</format>
<mimeType>video/mpeg</mimeType>
<retrieveLink>/bitstreams/12273/retrieve</retrieveLink>
<sequenceId>1</sequenceId>
<sizeBytes>14170112</sizeBytes>
</bitstreams>
<bitstreams>
<expand>parent</expand>
<expand>policies</expand>
<expand>all</expand>
<id>12274</id>
<name>license.txt</name>
<type>bitstream</type>
<bundleName>LICENSE</bundleName>
<checkSum checkSumAlgorithm="MD5">ae283e337459cd3987abe61b476da4f2</checkSum>
<format>License</format>
<mimeType>text/plain</mimeType>
<retrieveLink>/bitstreams/12274/retrieve</retrieveLink>
<sequenceId>2</sequenceId>
<sizeBytes>3223</sizeBytes>
</bitstreams>
<lastModified>2013-11-21 15:09:46.279</lastModified>
<metadata>
<key>dc.contributor</key>
<value>Li, Jason</value>
</metadata>
<metadata>
<key>dc.creator</key>
<value>Li, Jason</value>
</metadata>
<metadata>
<key>dc.date.accessioned</key>
<value>2013-11-21T20:09:46Z</value>
</metadata>
<metadata>
<key>dc.date.available</key>
<value>2013-11-21T20:09:46Z</value>
</metadata>
<metadata>
<key>dc.date.issued</key>
<value>2013-11-21</value>
</metadata>
<metadata>
<key>dc.identifier.uri</key>
<value>http://arks.princeton.edu/ark:/88435/dsp016395w7223</value>
</metadata>
<metadata>
<key>dc.description.abstract</key>
<language>en_US</language>
<value>Magnetic field lines and current sheets for an orbiting neutron star binary with the magnetic moment of one star aligned with the rotation axis, and the magnetic moment of the other star tilted and antialigned with the rotation axis. The stars are spinning rapidly at ∼ ms periods, with R_{LC,∗} /R_∗ = 2.7. Stellar spin winds fields backwards toroidally. This movie shows the corotating field pattern as the orbit progresses.</value>
</metadata>
<metadata>
<key>dc.language.iso</key>
<language>en_US</language>
<value>en_US</value>
</metadata>
<metadata>
<key>dc.title</key>
<language>en_US</language>
<value>Antialigned Rapidly Spinning Dipoles</value>
</metadata>
<metadata>
<key>dc.type</key>
<language>en_US</language>
<value>moving image</value>
</metadata>
<metadata>
<key>pu.projectgrantnumber</key>
<language>en_US</language>
<value>120-6425</value>
</metadata>
<parentCollection>
<expand>parentCommunityList</expand>
<expand>parentCommunity</expand>
<expand>items</expand>
<expand>license</expand>
<expand>logo</expand>
<expand>all</expand>
<handle>88435/dsp01ff365529x</handle>
<id>261</id>
<name>Research Data Sets</name>
<type>collection</type>
<copyrightText/>
<introductoryText/>
<numberItems>15</numberItems>
<shortDescription/>
<sidebarText/>
</parentCollection>
<parentCollectionList>
<expand>parentCommunityList</expand>
<expand>parentCommunity</expand>
<expand>items</expand>
<expand>license</expand>
<expand>logo</expand>
<expand>all</expand>
<handle>88435/dsp01ff365529x</handle>
<id>261</id>
<name>Research Data Sets</name>
<type>collection</type>
<copyrightText/>
<introductoryText/>
<numberItems>15</numberItems>
<shortDescription/>
<sidebarText/>
</parentCollectionList>
<parentCommunityList>
<expand>parentCommunity</expand>
<expand>collections</expand>
<expand>subCommunities</expand>
<expand>logo</expand>
<expand>all</expand>
<handle>88435/dsp01k643b120w</handle>
<id>186</id>
<name>Astrophysical Sciences</name>
<type>community</type>
<copyrightText/>
<countItems>15</countItems>
<introductoryText/>
<shortDescription/>
<sidebarText/>
</parentCommunityList>
<withdrawn>false</withdrawn>
</item>
</items>
24 changes: 24 additions & 0 deletions spec/system/globus_item_metadata_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

describe 'Item page with Globus download integration', type: :system, js: true do
let(:globus_fixtures) { File.read(File.join(fixture_path, 'globus_items.xml')) }
let(:indexer) do
Indexer.new(globus_fixtures)
end

before do
Blacklight.default_index.connection.delete_by_query("*:*")
Blacklight.default_index.connection.commit
indexer.index
end

it "displays the Globus download button when the integration is present" do
visit '/catalog/88163'
expect(page).to have_content "Download from Globus"
end

it "does not display the Globus download button when the integration is not present" do
visit '/catalog/6517'
expect(page).not_to have_content "Download from Globus"
end
end