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

modelmatcher changes #72

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
@Getter
@AllArgsConstructor
public enum ResearcherCategory {
IN_SILICO( "in-silico" ),
IN_VITRO_BIOCHEMICAL( "in-vitro" ),
IN_VIVO( "in-vivo" ),
IN_VITRO_CELLS( "in-vitro-cells" ),
IN_VITRO_BIOCHEMICAL( "in-vitro" ),
IN_VITRO_STRUCTURAL( "in-vitro-structural" ),
IN_VIVO( "in-vivo" ),
IN_SILICO( "in-silico" ),
OTHER( "other" );
private final String id;
}
4 changes: 2 additions & 2 deletions src/main/java/ubc/pavlab/rdp/services/EmailServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void sendResetTokenMessage( User user, PasswordResetToken token, Locale l

// password reset always go through the primary email
InternetAddress to = new InternetAddress( user.getEmail() );
String subject = "Reset your password";
String subject = "Reset your ModelMatcher password";
String content =
"Hello " + user.getProfile().getName() + ",\r\n\r\n" +
"We recently received a request that you want to reset your password. " +
Expand All @@ -131,7 +131,7 @@ public void sendRegistrationMessage( User user, VerificationToken token ) throws
String registrationEnding = messageSource.getMessage( "rdp.site.email.registration-ending", new String[]{ siteSettings.getContactEmail() }, Locale.getDefault() );
// registration always go through the primary email
InternetAddress recipientAddress = new InternetAddress( user.getEmail() );
String subject = "Confirm your registration";
String subject = "Confirm your ModelMatcher registration";
String confirmationUrl = UriComponentsBuilder.fromUri( siteSettings.getHostUri() )
.path( "registrationConfirm" )
.queryParam( "token", token.getToken() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ public void updateGenes() {
} else {
log.info( MessageFormat.format( "Loading genes for {0} from {1}.",
taxon, taxon.getGeneUrl() ) );
if(taxon.getId()==8364){
data = geneInfoParser.parse( taxon, taxon.getGeneUrl() );
}
else{
data=new HashSet<>();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to handle the error if a registry is missing a taxon.

}
log.info( MessageFormat.format( "Done parsing genes for {0}.", taxon ) );
geneInfoRepository.save( data );
Expand Down Expand Up @@ -173,4 +178,4 @@ private <T> boolean addAll( Collection<SearchResult<T>> container, Collection<T>

return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ public void updateOrganInfos() {
OrganInfo organInfo = organInfoRepository.findByUberonId( term.getId() );
if ( organInfo == null ) {
organInfo = new OrganInfo();
organInfo.setName( term.getName() );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add the description here as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit silly if we do that because we can only add missing organ systems, never update anything.

organInfo.setUberonId( term.getId() );
// only show organs that have been explicitly activated
organInfo.setActive( false );
}
organInfo.setName( term.getName() );

organInfo.setDescription( term.getDefinition() );
organInfoRepository.save( organInfo );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ public Collection<User> findUsersByDescription( String descriptionLike, Set<Rese
@PreAuthorize("hasPermission(null, 'international-search')")
public Collection<UserGene> findGenesBySymbol( String symbol, Taxon taxon, Set<TierType> tiers, Integer orthologTaxonId, Set<ResearcherPosition> researcherPositions, Set<ResearcherCategory> researcherCategories, Set<String> organUberonIds ) {
List<UserGene> intlUsergenes = new LinkedList<>();
for ( TierType tier : restrictTiers( tiers ) ) {
if(taxon.getId()==8364){
return new LinkedList<>();
}

if(orthologTaxonId==null){
orthologTaxonId=-99;
}

for ( TierType tier : restrictTiers( tiers ) ) {
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.add( "symbol", symbol );
params.putAll( UserGeneSearchParams.builder()
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/ubc/pavlab/rdp/util/GeneInfoParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ public Set<GeneInfo> parse( Taxon taxon, InputStream input ) throws ParseExcepti

return br.lines()
.map( line -> line.split( "\t" ) )
.filter( values -> Integer.valueOf( values[0] ).equals( taxon.getId() ) )
.map( values -> {
try{

GeneInfo gene = geneInfoRepository.findByGeneIdAndTaxon( Integer.valueOf( values[1] ), taxon );
if ( gene == null ) {
gene = new GeneInfo();
Expand All @@ -107,15 +108,19 @@ public Set<GeneInfo> parse( Taxon taxon, InputStream input ) throws ParseExcepti
gene.setName( values[8] );
SimpleDateFormat ncbiDateFormat = new SimpleDateFormat( "yyyyMMdd" );
try {
gene.setModificationDate( ncbiDateFormat.parse( values[14] ) );
gene.setModificationDate( ncbiDateFormat.parse( "20200926" ) );
} catch ( ParseException e ) {
log.warn( MessageFormat.format( "Could not parse date {0} for gene {1}.", values[14], values[1] ), e );
}
return gene;
}
catch(Exception e){
return new GeneInfo();
}
} ).collect( Collectors.toSet() );
} catch ( IOException e ) {
throw new ParseException( e.getMessage(), 0 );
}
}

}
}
4 changes: 2 additions & 2 deletions src/main/resources/cache/DIOPT_filtered_data_March2020.gz
Git LFS file not shown
Binary file not shown.
3 changes: 3 additions & 0 deletions src/main/resources/static/css/common.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
a{
color: teal;
}
html {
position: relative;
min-height: 100%;
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/static/css/login.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
a{
color:teal
}
.btn{
background-color:teal
}
html, body {
margin: 0;
height: 100%;
Expand Down
Binary file modified src/main/resources/static/images/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/static/images/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/static/images/favicon.ico
Binary file not shown.
Binary file added src/main/resources/static/images/header-black.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/header-dark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/header-final.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/header-gray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/static/images/header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mod/10090.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mod/10116.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mod/511145.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mod/559292.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mod/6239.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mod/7227.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mod/7955.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mod/8364.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/images/mod/9606.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,26 @@
row.push('');
if (customizableGeneLevel) {
row.push('');
} else {
row.push('<span class="align-middle"><i class="delete-row align-middle"></i><a href="https://www.ncbi.nlm.nih.gov/gene/' + gene.geneId + '" target="_blank" class="align-middle" rel="noopener">' + gene.symbol + '</a></span>');
row.push(gene.geneId);
row.push('<span class="align-middle">' + gene.name + '</span>');
row.push('<input name="primary" class="align-middle" type="checkbox"/>');
if (customizableGeneLevel) {
var privacyOptions = enabledGenePrivacyLevels.map(function (k) {
var privacyLevel = privacyLevels[k];
if (privacyLevel.ordinal!=1) {
return '<option' +
' value="' + privacyLevel.ordinal + '"' +
(privacyLevel.ordinal === userPrivacyLevel.ordinal ? ' selected' : '') + '>' +
privacyLevel.label +
'</option>';
} else {
return '';
}
}).join('');
row.push('<select class="form-control">' + privacyOptions + '</select>');
}
}
} else {
/* gene is already in the table */
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/templates/forgotPassword.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<div class="container py-4">
<div class="row">
<div class="col-md-10 offset-1">
<h4 class="form-signin-heading"><a th:href="@{/login}" th:text="#{rdp.site.fullname}"></a></h4>
<h6 class="form-signin-subheading">Researcher Registry</h6>
<h4 class="form-signin-heading">Forgot Password</h4>
<h6 class="form-signin-subheading">ModelMatcher</h6>
</div>
</div>

Expand Down
11 changes: 7 additions & 4 deletions src/main/resources/templates/fragments/gene-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
class="text-center"
scope="col"
data-toggle="tooltip"
th:title="${viewOnly} == null ? 'Primary genes constitute your TIER1 genes whereas non-primary genes will be part of your TIER2 genes.' : 'Tier determines the degree of involvment of a researcher with a gene.'">
th:title="${viewOnly} == null ? 'Primary genes are genes that your lab is actively working on, or genes where you have assays and reagents ready for immediately study.' : 'Tier determines the degree of involvment of a researcher with a gene.'">
<span th:text="${viewOnly == null} ? 'Primary' : 'Tier'"></span>
<i class="tip oi oi-question-mark"></i>
</th>
<th th:if="${viewOnly == null} and ${@applicationSettings.privacy.isCustomizableGeneLevel()}"
class="text-center"
scope="col"
data-toggle="tooltip"
title="Privacy level determines who can see this gene in a search result.">
title="Public genes can be searched by all users. Restricted genes require a match request to be submitted.">
Privacy Level
<i class="tip oi oi-question-mark"></i>
</th>
</tr>
</thead>
<tbody>
<tr th:each="gene : ${genes}">
<tr th:if="${gene.effectivePrivacyLevel != T(ubc.pavlab.rdp.model.enums.PrivacyLevelType).PRIVATE or viewOnly == null}" th:each="gene : ${genes}">
<td class="align-middle">
<i th:if="${viewOnly == null}" class="delete-row align-middle"></i>
<a th:href="@{https://www.ncbi.nlm.nih.gov/gene/{geneId}(geneId=${gene.geneId})}"
Expand All @@ -49,7 +49,7 @@
th:checked="${gene.tier == T(ubc.pavlab.rdp.model.enums.TierType).TIER1}"/>
</td>
<td th:if="${viewOnly != null}"
th:text="${gene.tier}"
th:text="${gene.tier==T(ubc.pavlab.rdp.model.enums.TierType).TIER1}?'Primary':'Secondary'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should use the labels from the TierType, and possible use i18n to allow instance to change the wording.

class="text-center"></td>
</th:block>
<td th:if="${viewOnly == null} and ${@applicationSettings.privacy.isCustomizableGeneLevel()}"
Expand All @@ -63,12 +63,15 @@
</select>
</td>
</tr>

</tbody>
<!--
<tfoot th:if="${viewOnly != null}">
<tr>
<td colspan="3"></td>
</tr>
</tfoot>
-->
</table>
</body>
</html>
6 changes: 3 additions & 3 deletions src/main/resources/templates/fragments/organ.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class="form-check-input"/>
<label th:for="${#ids.prev('organUberonIds')}"
class="form-check-label">
<img th:src="@{/images/organs/{uberonId}.svg(uberonId=${organInfo.uberonId})}"
<img style="opacity:0.7" th:src="@{/images/organs/{uberonId}.svg(uberonId=${organInfo.uberonId})}"
th:alt="${#strings.capitalize(organInfo.name)}"
class="img-fluid"/>
</label>
Expand All @@ -29,10 +29,10 @@
<div th:fragment="organs" class="row">
<div th:each="organInfo, iter : ${@organInfoService.findByActiveTrueOrderByOrdering()}"
th:if="${#lists.contains(checkedOrganUberonIds, organInfo.uberonId)}"
class="col-3 col-md-2 col-lg-1"
class="col-3 col-md-2 col-lg-2"
data-toggle="tooltip"
th:title="${#strings.capitalize(organInfo.name)}">
<img th:src="@{/images/organs/{uberonId}.svg(uberonId=${organInfo.uberonId})}"
<img style="opacity:0.7" th:src="@{/images/organs/{uberonId}.svg(uberonId=${organInfo.uberonId})}"
th:alt="${#strings.capitalize(organInfo.name)}"
class="img-fluid"/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/fragments/term-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<th scope="col">Aspect</th>
<th scope="col"
data-toggle="tooltip"
title="Number of times genes associated to a term appear in your TIER1 or TIER2 genes.">
title="Number of times genes associated to a term appear in your Primary or Secondary genes.">
Overlap
<i class="tip oi oi-question-mark"></i>
</th>
Expand Down
53 changes: 26 additions & 27 deletions src/main/resources/templates/fragments/user-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<thead class="thead-light">
<tr>
<th scope="col"></th>
<th th:if="${remote}" scope="col">Origin</th>
<th scope="col">Full Name</th>
<th scope="col">
<span th:unless="${@applicationSettings.profile.enabledResearcherPositions.isEmpty()}">Position and</span>
Expand All @@ -34,7 +33,6 @@
View User Profile
</a>
</td>
<td th:if="${remote}" th:text="${u.origin}"></td>
<td th:text="${u.profile.fullName}"></td>
<td>
<span th:if="${u.profile.researcherPosition}"
Expand All @@ -61,12 +59,10 @@
<thead class="thead-light">
<tr>
<th scope="col"></th>
<th th:if="${remote}" scope="col">Origin</th>
<th scope="col">Full Name</th>
<th scope="col">
<span th:unless="${@applicationSettings.profile.enabledResearcherPositions.isEmpty()}">Position and</span>
Organization
</th>
<th th:if="not ${remote}" scope="col">Principal Investigator</th>
<th scope="col">Organization</th>

<th scope="col">Gene</th>
<th scope="col"
data-toggle="tooltip"
Expand All @@ -93,32 +89,35 @@
<i class="oi oi-person"></i>
View User Profile
</a>
<a th:if="${ug.anonymousId} and ${remote}"
th:href="@{/search/gene/by-anonymous-id/{anonymousId}/request-access(anonymousId=${ug.anonymousId},remoteHost=${ug.user.originUrl})}"
th:attr="data-anonymous-user-id=${ug.user.anonymousId},data-remote-host=${ug.user.originUrl}"
class="btn btn-primary btn-sm btn-block user-preview-popover">
<i class="oi oi-lock-locked"></i>
Request Access
</a>
<a th:if="${ug.anonymousId} and not ${remote}"
th:href="@{/search/gene/by-anonymous-id/{anonymousId}/request-access(anonymousId=${ug.anonymousId})}"
th:attr="data-anonymous-user-id=${ug.user.anonymousId}"
class="btn btn-primary btn-sm btn-block user-preview-popover">


<a th:if="${ug.anonymousId}"
th:attr="data-anonymous-user-id=${ug.user.anonymousId}"
class="btn btn-primary btn-sm btn-block">
<i class="oi oi-lock-locked"></i>
Request Access
Restricted Gene
</a>

</td>
<td th:if="${remote}" th:text="${ug.user.origin}"></td>
<td th:text="${ug.user.profile.fullName}"></td>
<td>
<span th:if="${ug.anonymousId}">MM User</span>
<span th:unless="${ug.anonymousId}" th:text="${ug.user.profile.fullName}"></span>

</td>
<td th:if="not ${remote}">
<span th:if="${ug.user.profile.researcherPosition}"
th:text="#{'ResearcherPosition.' + ${ug.user.profile.researcherPosition}}">...</span>
<span th:if="${ug.user.profile.researcherPosition} != null and ${ug.user.profile.organization} != ''">at</span>
<span th:text="${ug.user.profile.organization}"></span>
</td>
th:text="Yes">...</span>
<span th:unless="${ug.user.profile.researcherPosition}"
th:text="${ug.anonymousId}?'?':'No'">...</span>
</td>
<td th:text="${ug.user.profile.organization}"></td>
<td th:text="${ug.symbol}"></td>
<td th:text="${ug.tier}"></td>
<td th:text="${#strings.capitalizeWords(ug.taxon.commonName)}"></td>
<td th:text="${ug.tier==T(ubc.pavlab.rdp.model.enums.TierType).TIER1}?'Primary':'Secondary'"></td>
<td>
<span th:if="${ug.taxon.commonName=='e. coli'}"><i>E. coli</i></span>
<span th:unless="${ug.taxon.commonName=='e. coli'}" th:text="${#strings.capitalizeWords(ug.taxon.commonName)}">...</span>

</td>
</tr>
<tr th:if="${#lists.isEmpty(usergenes)}" class="table-warning">
<td class="text-center warning" th:colspan="100">No user genes found matching the provided search criteria.</td>
Expand Down
Loading