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

pmfe-findmfe not returning results #16

Open
spoznan opened this issue Oct 19, 2020 · 3 comments
Open

pmfe-findmfe not returning results #16

spoznan opened this issue Oct 19, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@spoznan
Copy link

spoznan commented Oct 19, 2020

When I try now

./RunPMFECommand.sh pmfe-findmfe --sequence /projects/rna/rnatope/Data/tRNA_50/fasta/Aquifex.aeolicus.VF5_AE000657.fasta -a 3.4 -b 0 -c 0.4 -d 1

The only output I get is

[PMFE-WRAPPER-SCRIPT] Changing current working directory to "/projects/rna/PMFEUpdated-2020.09.10-MDS-mschmidt34/GTDMMBSoftware2020/pmfe" ...

and the code seems to take a very long time to return a result.

@maxieds
Copy link

maxieds commented Oct 20, 2020

@spoznan
There appears to have been another problem with my changes to the function to handle trailing zeros. Is this the correct output:

./RunPMFECommand.sh pmfe-findmfe --sequence /projects/rna/rnatope/Data/tRNA_50/fasta/Aquifex.aeolicus.VF5_AE000657.fasta -a 3.4 -b 0 -c 0.4 -d 1
   >> [PMFE-WRAPPER-SCRIPT] Changing current working directory to "/projects/rna/PMFEUpdated-2020.09.10-MDS-mschmidt34/GTDMMBSoftware2020/pmfe" ...
(((((((...((.((.(((..((.(.(((((.......))))).)))..))).))))........)))))))>	0	0	0	-311/10	-311/10

If so, let me know so I can file the new code as a part of the existing pull request I started last week:

Rational get_rational_from_word(std::string word) {
        Rational result;
        std::size_t decimalpoint = word.find('.');
        bool negative = (word.find('-') != std::string::npos);
        if (decimalpoint != std::string::npos) {
            std::string intpart = word.substr(0, decimalpoint);
            std::string fracpart = word.substr(decimalpoint+1);

            if (intpart == "") intpart = "0";
            Integer theint (intpart, 10);
            theint = abs(theint);

            // Carve out the fractional part. Surprisingly fiddly!
            // Handle a corner case where the fractional part is all zeros:
            int fracdenom = 1;
            int lastNonZeroPos = fracpart.find_last_of("0");
            if(lastNonZeroPos != std::string::npos) {
                 while(lastNonZeroPos > 0 && lastNonZeroPos != std::string::npos) {
                      fracpart = fracpart.substr(0, lastNonZeroPos);
                      lastNonZeroPos = fracpart.find_last_of("0");
                 }
                 if(lastNonZeroPos == 0) {
                      fracpart = "";
                 }
                 fracdenom = pow(10, fracpart.length());
            }
            if(fracpart.size() == 0) {
                 fracpart = "0";
            }
            Integer fracval (fracpart, 10);
            Rational thefrac (fracval, fracdenom);
            thefrac.canonicalize();

            result = theint + thefrac;
            if (negative) result *= -1;
        } else {
            Rational thevalue (word);
            result = thevalue;
        }
        result.canonicalize();
        return result;
    };

@spoznan
Copy link
Author

spoznan commented Oct 23, 2020

The output I get with the old code is
(((((((><((((........))))>(((((.......)))))>...<(((((.......))))))))))))> 1 8 4 -397/10 -347/10

@maxieds maxieds added the bug Something isn't working label Oct 24, 2020
@maxieds
Copy link

maxieds commented Oct 24, 2020

@spoznan
Confirming that the new output I get is

(((((((><((((........))))>(((((.......)))))>...<(((((.......))))))))))))>	1	8	4	-397/10	-347/10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants