use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class EntityNameDaoImpl method findAlternativeChainNames.
@Override
public List<EntityName> findAlternativeChainNames(String uniqueName) {
SqlParameterSource namedParameters = new MapSqlParameterSource("uniqueName", uniqueName);
List<EntityName> entityNames = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("alternative-chain-names"), namedParameters, new EntryNameRowMapper());
return entityNames;
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class FamilyDaoImpl method findParentOfFamilyId.
@Override
public Family findParentOfFamilyId(Long familyId) {
String sql = sqlDictionary.getSQLQuery("parent-family-by-term-id");
SqlParameterSource namedParameters = new MapSqlParameterSource("familyId", familyId);
List<Family> parents = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sql, namedParameters, new FamilyRowMapper());
if (parents == null || parents.size() == 0)
return null;
return parents.get(0);
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class FamilyDaoImpl method findFamilies.
@Override
public List<Family> findFamilies(String uniqueName) {
String sql = sqlDictionary.getSQLQuery("families-by-entry");
SqlParameterSource namedParameters = new MapSqlParameterSource("uniqueName", uniqueName);
return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sql, namedParameters, new FamilyRowMapper());
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class GeneDAOImpl method getIsoformMappingsByIsoformName.
@Override
public Map<String, List<IsoformGeneMapping>> getIsoformMappingsByIsoformName(Collection<String> isoformNames) {
SqlParameterSource namedParameters = new MapSqlParameterSource("isoform_names", isoformNames);
List<Map<String, Object>> result = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).queryForList(sqlDictionary.getSQLQuery("isoform-mappings"), namedParameters);
Map<String, IsoformGeneMapping> isoformMappings = new HashMap<>();
for (Map<String, Object> m : result) {
String isoName = ((String) m.get("isoform"));
long geneId = ((Long) m.get("reference_identifier_id"));
String isoformMappingKey = isoName + "." + geneId;
if (!isoformMappings.containsKey(isoformMappingKey)) {
isoformMappings.put(isoformMappingKey, new IsoformGeneMapping());
}
IsoformGeneMapping isoformGeneMapping = isoformMappings.get(isoformMappingKey);
isoformGeneMapping.setReferenceGeneId(geneId);
isoformGeneMapping.setIsoformName(isoName);
isoformGeneMapping.setReferenceGeneName((String) m.get("reference_gene"));
GeneRegion geneRegion = new GeneRegion(isoformGeneMapping.getReferenceGeneName(), ((Integer) m.get("first_position")), ((Integer) m.get("last_position")));
isoformGeneMapping.getIsoformGeneRegionMappings().add(geneRegion);
}
return isoformMappings.values().stream().collect(Collectors.groupingBy(IsoformGeneMapping::getIsoformName, Collectors.toList()));
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class GeneDAOImpl method findExonsPartiallyAlignedToTranscriptOfGene.
@Override
public List<UncategorizedExon> findExonsPartiallyAlignedToTranscriptOfGene(String isoName, String transcriptName, String geneName) {
MapSqlParameterSource namedParameters = new MapSqlParameterSource("transcriptName", transcriptName);
namedParameters.addValue("geneName", geneName);
namedParameters.addValue("isoformName", isoName);
return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("exons-partially-aligned-to-transcript"), namedParameters, new ExonMapper());
}
Aggregations