Commit 0a3161a6 authored by Dr. Carsten Kemena's avatar Dr. Carsten Kemena
Browse files

[PfamMeta] improved documentation, added read function

parent e0094b6a
Pipeline #106430 passed with stages
in 1 minute and 18 seconds
/*
* PfamMeta.cpp
*
* Created on: 12 Nov 2021
* Author: Carsten Kemena
* Email: c.kemena[@]uni-muenster.de
* Copyright: 2021
*
* This file is part of BioSeqDataLib.
*
* BioSeqDataLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BioSeqDataLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BioSeqDataLib. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PfamMeta.hpp"
#include "../utility/Input.hpp"
namespace BioSeqDataLib
{
void
PfamMetaCollection::read(const boost::filesystem::path &fileName)
{
Input in(fileName);
std::string line;
while (getline(in, line))
{
}
}
}
\ No newline at end of file
......@@ -22,18 +22,34 @@
* along with BioSeqDataLib. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file PfamMeta.hpp
* @author Carsten Kemena (c.kemena@uni-muenster.de)
* @brief Class to handle Pfam Meta data
* @version 0.1
* @date 2021-11-17
*
* @copyright Copyright (c) 2021
*
*/
#include <map>
#include <set>
#include <string>
#include <vector>
#include <boost/filesystem.hpp>
#ifndef SRC_DOMAIN_PFAMMETA_HPP_
#define SRC_DOMAIN_PFAMMETA_HPP_
namespace BioSeqDataLib
{
/**
* @brief Class to store
*
*/
struct PfamMeta
{
std::string id;
......@@ -63,6 +79,10 @@ bool operator< (const PfamMeta& c1, const PfamMeta& c2)
return (c1.id < c2.id);
}
/**
* @brief Class to store the Meta information of domains.
*
*/
class PfamMetaCollection
{
private:
......@@ -70,36 +90,131 @@ private:
public:
/**
* @brief Begin iterator
*
* @return auto The iterator
*/
auto
begin()
{
return collection_.begin();
}
auto
begin() const
{
return collection_.begin();
}
auto
cbegin() const
{
return collection_.begin();
}
/**
* @brief End iterator
*
* @return auto The iterator
*/
auto
end()
{
return collection_.end();
}
auto
end() const
{
return collection_.end();
}
auto
cend() const
{
return collection_.end();
}
/**
* @brief Add an entry to the object
*
* @param data The entry to add
*/
void
addData(PfamMeta &&data)
{
collection_.emplace(data.id, std::move(data));
collection_.emplace(std::pair<std::string, PfamMeta>{data.id, std::move(data)});
}
/**
* @brief Add an entry to the object
*
* @param data The entry to add
*/
void
addData(PfamMeta &data)
{
collection_.emplace(data.id, data);
}
/**
* @brief Get the Model Length object
*
* @param id The domain accession.
* @return unsigned short the lengths of the domain model.
*/
unsigned short
getModelLength(const std::string &id) const
{
return collection_.at(id).modelLength;
}
/**
* @brief Get the Clan object
*
* @param id The domain accession.
* @return std::string The clan the domain belongs to.
*/
std::string
getClan(const std::string &id) const
{
return collection_.at(id).clan;
}
/**
* @brief Get the Type object
*
* @param id The domain accession.
* @return std::string The type of the domain.
*/
std::string
getType(const std::string &id) const
{
return collection_.at(id).type;
}
/**
* @brief Get the GO-Terms related to a domain
*
* @param id The domain accession.
* @return const std::vector<std::string>&
*/
const std::vector<std::string>&
goTerms(const std::string &id) const
{
return collection_.at(id).goTerms;
}
/**
* @brief Reads the PFAM Meta file
*
* @param fileName The file to read from.
*/
void
read(const boost::filesystem::path &fileName);
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment