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

Updating databases in Galaxy #86

Open
PHemarajata opened this issue Jul 4, 2019 · 20 comments
Open

Updating databases in Galaxy #86

PHemarajata opened this issue Jul 4, 2019 · 20 comments

Comments

@PHemarajata
Copy link

Hi, I was wondering how I can update the databases used by the tool in Galaxy. Thank you!

@apetkau
Copy link
Member

apetkau commented Jul 5, 2019

Hello @PHemarajata, this isn't currently supported in the Galaxy wrapper but I will look into adding this in the future. I can let you know how to do it by hand, but this requires you to run some commands to update the databases in the conda environment used by Galaxy.

@apetkau
Copy link
Member

apetkau commented Jul 5, 2019

Specifically you could activate the conda environment for staramr conda activate [email protected] and then run staramr db update -d to update to the latest revisions.

However, note that any new genes added (or modified) will show up as unknown in the phenotype/drug resistance columns of the output since they link between genes and drugs have not been defined in these cases.

@suzukimicro
Copy link

I have a different question. In the Galaxy version we can modify settings of "Percent identity threshold for BLAST" and "Percent length overlap of BLAST hit for ResFinder database". How do you configure these in the command line version?

@suzukimicro
Copy link

Sorry I figured out myself.
--pid-threshold for Percent identity threshold for BLAST
--percent-length-overlap-resfinder for ercent length overlap of BLAST hit for ResFinder database

Another question. Can we use the --recursive option?

@apetkau
Copy link
Member

apetkau commented Sep 25, 2020

I'm glad you were able to figure it out yourself.

What do you mean by --recursive? Do you mean recursively scan directories for input files?

@suzukimicro
Copy link

@apetkau Thank you for your reply.

Do you mean recursively scan directories for input files?

Yes. Good to have that option when we are dealing with a lot of input files.

@apetkau
Copy link
Member

apetkau commented Sep 25, 2020

@suzukimicro okay, I understand. There is no built-in way to recursively search for input files in a directory, but if you have the correct shell you can make use of shell wildcards to do exactly what you want. In particular, you can use the globstar option in bash.

First you need to enable globstar:

shopt -s globstar

Then, to search for all files ending in .fasta under the directory input you can do:

staramr search -o output input/**/*.fasta

Here your shell (bash) will expand input/**/*.fasta to any files ending in .fasta within the input/ directory and all sub-directories. You can pass multiple patterns as input to staramr, for example:

staramr search -o output input-1/**/*.fasta input-2/**/*.fasta

Other shells may have their own recursive wildcard expansions available. Alternatively you could likely use the find command to recursively search for fasta files and pass to staramr:

staramr search -o output `find input/ -iname '*.fasta' -printf '%p '`

This will search under the input/ directory for any files ending in .fasta and print out the names separated by a space (the -printf '%p ' part). This list of files is then passed to staramr.

I hope this helps you out.

@suzukimicro
Copy link

@apetkau Thank you for your kind help.

I could recursively input fasta files in folders, but somehow the resulting output folder included only hits, but no others such as results.xlsx and summary.tsv. I simply did the following command. Can you find the possible reasons?

staramr search -o output *.fasta

@apetkau
Copy link
Member

apetkau commented Sep 26, 2020

Which version of staramr are you using (staramr --version)? And was there any error messages printed out?

@suzukimicro
Copy link

@apetkau Thank you for your reply.
I use the latest version of staramr (v0.7.1) on Terminal.app of macOS Catalina v10.15.6. If there were within three fasta files, it was no problem, however, if there were more than four fasta files, no files except for the hits folder was output. No errors other than 'Predicted Phenotype' appeared to be displayed. Are there any possible causes?

@apetkau
Copy link
Member

apetkau commented Sep 27, 2020

@suzukimicro would it be possible to post the messages you do get here? I am uncertain as to what's going on.

@suzukimicro
Copy link

@apetkau Thank you for your reply.
I have found that if a fasta file that makes 'Predicted Phenotype' error is included for calculation, all the results were not output except for the hits folder. Do you have any solutions?

@suzukimicro
Copy link

@apetkau Thank you for your reply.
I use the latest version of staramr (v0.7.1) on Terminal.app of macOS Catalina v10.15.6. If there were within three fasta files, it was no problem, however, if there were more than four fasta files, no files except for the hits folder was output. No errors other than 'Predicted Phenotype' appeared to be displayed. Are there any possible causes?

The fourth file made 'Predicted Phenotype' error.

@apetkau
Copy link
Member

apetkau commented Sep 27, 2020

@suzukimicro when you say a 'Predicted Phenotype' error do you mean this error #115? If so, then the solution is to change the version of the pandas library (version 0.25.3 worked for me). Changing the version depends on how you installed staramr. If you used conda it would be conda install pandas==0.25.3. If it was with pip it would be pip install pandas==0.25.3.

@suzukimicro
Copy link

@apetkau Thank you for your reply.
The 'Predicted Phenotype' error could be avoided after updating the pandas library. But, I faced other error as follows.
ERROR: Index length not within range, for [rep21_24_rep(CN1_plasmid2)_NC_022227]
If a file that makes this error was included in calculation, only the hit folder was output. Do you have any solutions?

@apetkau
Copy link
Member

apetkau commented Sep 28, 2020

That's great news @suzukimicro, getting closer to having all the files work.

For the Index length error, I suspect it could be related to windows newlines in the file (which uses two characters instead of one character to represent a newline) - https://en.wikipedia.org/wiki/Newline#Issues_with_different_newline_formats

You should be able to check for this by using the file command on the file:

file file.fasta

You can convert to unix-style line endings with dos2unix:

dos2unix file.fasta

However, I don't know if this programs exist by default on a mac. dos2unix may have to be installed via homebrew (https://formulae.brew.sh/formula/dos2unix).

@suzukimicro
Copy link

suzukimicro commented Sep 28, 2020

@apetkau Thank you for your reply.
Using my MacBook Pro, I have converted fsa files in staramr/databases/data/update/plasmidfinder (just in case) and fasta files (for calculation) to Unix format by dos2unix, but still faced this error after running staramr..
ERROR: Index length not within range, for [rep21_24_rep(CN1_plasmid2)_NC_022227]
There would be a problem with some fasta files for calculation?

@suzukimicro
Copy link

The fasta files (for calculation) were shown as "ASCII text" by file.

@apetkau
Copy link
Member

apetkau commented Sep 29, 2020

@suzukimicro I'm not really sure what the issue is then. If you look at the rep21_24_rep(CN1_plasmid2)_NC_022227 entry in the fasta file, is there any sequence data associated with it? Or is the sequence data stored on lines that are longer than other lines? Is there any special characters in the sequence data? Or maybe there's issues with the ( and ) symbols in the sequence name.

Without seeing the fasta file I don't think I can give much more for answers.

@suzukimicro
Copy link

@apetkau Thank you for your reply.
I will try to find out which fasta file(s) made the error. About 12,000 fasta files were being analyzed then.. When I analyzed them with staramr in Galaxy, I was able to perform without problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants