Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8630971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:09:05+00:00 2026-06-12T09:09:05+00:00

I’m using swig to wrap around this C++ project and after having imported all

  • 0

I’m using swig to wrap around this C++ project and after having imported all the header files into my python code, I’m now working on re-creating the main class in python, but I’m having trouble looking for the corresponding data structures and data types.
Following is the main method under main.cpp

int main( int argc, char *argv[] )
{
string exe_name = argv[ 0 ];

string usage = "Usage: " + exe_name + " unigene.fasta [options]\n\
Options:\n\
-g <GC content> \tminimum GC content in percentage (Default 45).\n\
-G <GC content> \tmaximum GC content in percentage (Default 55).\n\
-m <temperature> \tlowest melting temperature in degrees of celsius (Default 0).\n\
-M <temperature> \thighest melting temperature in degrees of celsius (Default 100).\n\
-r <repeat.fasta> \tfasta file containing repeat DNA sequences.\n\
-t <top number> \tnumber of top oligos selected for each unigene (Default 1).\n\n";

string unigene_file;
// options only, each must have an associated value
int min_gc = 45;
int max_gc = 55;
int min_tm = 0;
int max_tm = 100; 
int top_num = 1;
string repeat_file;
vector< string > m_argument;
for ( int i = 0; i < argc; i ++ ) {
    string new_arg = argv[ i ];
    m_argument.push_back( new_arg );
}

parse_argument( m_argument, usage, unigene_file, 
                min_gc, max_gc, min_tm, max_tm, top_num, repeat_file );

// initialize filtration parameters
float norm_min_gc = (float)min_gc / 100.0;
float norm_max_gc = (float)max_gc / 100.0;
string splice_file; // empty splice file
filt_param m_filtparam( norm_min_gc, norm_max_gc, min_tm, max_tm, 
                        repeat_file, splice_file );

// screen unigenes for unique oligos
seqs m_unigene;
m_unigene.init( unigene_file );

// map from unigene names to oligo sequences
map< string, vector< string > > uniq_oligo;
get_unique_oligo( m_unigene, m_filtparam, top_num, uniq_oligo );

// output oligos
if ( uniq_oligo.empty() ) {
  cout << "No valid oligo has been found. " << endl <<
    "It could be due to one of the following reasons: " << endl <<
    "1. input sequences are not unique, or " << endl << 
    "2. they are repetitive DNAs, or " << endl << 
    "3. GC% range is too restricted, etc. " << endl;
}
map< string, vector< string > > :: const_iterator m_itr;
for ( m_itr = uniq_oligo.begin(); m_itr != uniq_oligo.end(); m_itr ++ ) {
    for ( int o_idx = 0; o_idx < (int)m_itr->second.size(); o_idx ++ ) {
        cout << ">unique-oligo-" << o_idx+1 << "-of-unigene-" << 
                m_itr->first << endl;
        cout << m_itr->second[ o_idx ] << endl;
    }
}

//system("PAUSE");
return 1;
}

For instance when I try passing an empty string (repeat_file) into filtparam() as done above, in python, I get the error

in method ‘new_filt_param’, argument 5 of type ‘string const &’

How does one declare a ‘string const &’ type in python?

Also is there a structure like ‘map’ in python?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:09:06+00:00Added an answer on June 12, 2026 at 9:09 am

    What you’re looking for is the dict, which essentially works similar to C++’s map. More information can be found in the documentation.

    Different question: Is there any reason you’re recreating main() in Python rather than simply wrapping that one with SWIG? While SWIG is able to handle things like std::string in a limited way, I’d try to use a more simple interface using pointers/arrays only, rather than trying to pass any C++ objects or constructs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.