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

Scripting access of django databases #276

Merged
merged 40 commits into from
Aug 1, 2019
Merged

Scripting access of django databases #276

merged 40 commits into from
Aug 1, 2019

Conversation

deming7h777
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Apr 17, 2019

Codecov Report

Merging #276 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #276   +/-   ##
=======================================
  Coverage   51.01%   51.01%           
=======================================
  Files          64       64           
  Lines        2662     2662           
=======================================
  Hits         1358     1358           
  Misses       1304     1304

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fadd774...555ca93. Read the comment docs.

@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@NAL-i5K NAL-i5K deleted a comment Apr 17, 2019
@r06942072
Copy link
Member

r06942072 commented Jul 22, 2019

I am on my personal laptop.
I met a problem once I want to start running django

This is what I did:

  1. Spin up the project by genomics-VM.
    https://github.com/NAL-i5K/genomics-VM

  2. Enter virtualenv
    cd genomics-workspace
    source py2.7/bin/activate

  3. python manage.py runserver, and I got a message as below

0721_vagrant

@r06942072
Copy link
Member

  • postgresql not found
    0722_pgsql_notfound

@r06942072
Copy link
Member

r06942072 commented Jul 23, 2019

#280

python manage.py addorganism Aethina tumida

python manage.py addblast Aethina tumida -t peptide protein -f GCF_001937115.1_Atum_1.0_genomic.fna

python manage.py makeblast GCF_001937115.1_Atum_1.0_genomic.fna

python manage.py populatesequence GCF_001937115.1_Atum_1.0_genomic.fna

python manage.py delete -o Aethina tumida

python manage.py delete -b GCF_001937115.1_Atum_1.0_genomic.fna

python manage.py delete -h GCF_001937115.1_Atum_1.0_genomic.fna

python manage.py addhmmer GCF_001937115.1_Atum_1.0_genomic.fna

Copy link
Member

@r06942072 r06942072 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module is not found
This is the process I did

  1. git clone --branch addorg2 https://github.com/NAL-i5K/genomics-workspace.git
  2. source py2.7/bin/activate (use the py2.7 env created when running genomics-VM)
  3. pip install -r requirements.txt
  4. new added python manage.py command as below screenshot
    image

@hsiaoyi0504
Copy link
Member

@r06942072 As far as I can tell, you should follow the step of setup guide. https://genomics-workspace.readthedocs.io/en/latest/setup_guide_centos.html

@deming7h777
Copy link
Contributor Author

The module is not found
This is the process I did

  1. git clone --branch addorg2 https://github.com/NAL-i5K/genomics-workspace.git
  2. virtualenv venv (I create virtualenv myself, but I do not know if there exist one in repo)
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. new added python manage.py command as below screenshot
    image

try to add init.py under blast/management/commands

@hsiaoyi0504
Copy link
Member

@deming7h777
If this is the solution to @r06942072 's problem,

try to add init.py under blast/management/commands

maybe it should be added directly on that branch.

misc/add_func.py Outdated
#organism = options["organism"][0].lower().capitalize() + " " + options["organism"][1].lower()
Organism.objects.filter(display_name = name).delete()
return ("remove %s in database"%name)
'''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't include these commented out lines. It seems to me that these lines are for initial development, right ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, good point

misc/add_func.py Outdated
@@ -0,0 +1,160 @@
from blast.models import BlastDb, SequenceType
#from django.core.management.base import BaseCommand, CommandError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused import directly rather than commenting it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

misc/add_func.py Outdated
data2 = re2.json()
key = data1['query']['search'][0]['pageid']
key = str(key)
#print type(key)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove debug purpose code will be great.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

misc/add_func.py Outdated
sys.exit(0)

def delete_org(name):
#if options["organism"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused lines here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gottcha

@r06942072
Copy link
Member

@r06942072 As far as I can tell, you should follow the step of setup guide. https://genomics-workspace.readthedocs.io/en/latest/setup_guide_centos.html

@hsiaoyi0504 I use repo genomics-VM to set up a new VM, so I didn't go through the process manually in Setup Guide

@r06942072
Copy link
Member

@deming7h777
I tried to run those commands on #280
only addorganism work

  • Here is what I did (I use honeybee as an example organism)

    • cd ~/Downloads
    • wget ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/003/254/395/GCF_003254395.2_Amel_HAv3.1/GCF_003254395.2_Amel_HAv3.1_genomic.fna.gz
    • gzip -d *.gz
    • cd ~/genomics-workspace
    • python manage.py addorganism Apis mellifera (This one work, I checked it through browser)
  • Down below three screenshot described the bug I met:

    • 3 commands not found
      0725_unknown_3

    • addblast
      0725_addblast

    • addhmmer
      0725_addhmmer

@deming7h777
Copy link
Contributor Author

@r06942072 you get the error because you don't need to type the full path of fasta file , just the name and title of blast db or hmmer db

@NAL-i5K NAL-i5K deleted a comment Jul 25, 2019
@NAL-i5K NAL-i5K deleted a comment Jul 25, 2019
@NAL-i5K NAL-i5K deleted a comment Jul 25, 2019
@NAL-i5K NAL-i5K deleted a comment Jul 25, 2019
@r06942072
Copy link
Member

r06942072 commented Jul 26, 2019

@r06942072 you get the error because you don't need to type the full path of fasta file , just the name and title of blast db or hmmer db

Do you mean like this? I got the same error(See pic1 and pic2)

  • pic1
    0725_addblast_2
  • pic2
    0725_addblast_3

@r06942072 you get the error because you don't need to type the full path of fasta file , just the name and title of blast db or hmmer db

@hsiaoyi0504
Copy link
Member

@deming7h777 In my opinion, it will be good to handle path no matter it‘s full path or not. That is, you should handle relative path and absolute path at the same time.

@r06942072
Copy link
Member

Friday, I pull the update of addorg2, and ran, same error messsage

  • pull
    0726_pull_addorg2
  • run
    0726_addblast_makeblast

@r06942072
Copy link
Member

Monday, what I did
cd ~/genomics-workspace

*On personal laptop, make a folder called 'media'
mkdir -p media/blast/db media/hmmer/db
cp ../Downloads/GCF_003254395.2_Amel_HAv3.1_genomic.fna ./media/blast/db/
cp ../Downloads/GCF_003254395.2_Amel_HAv3.1_genomic.fna ./media/hmmer/db/

*command 1 works
python manage.py addblast Apis mellifera -t peptide protein -f GCF_003254395.2_Amel_HAv3.1_genomic.fna

*command2 not works
python manage.py blast_utility GCF_003254395.2_Amel_HAv3.1_genomic.fna -m
see screenshot

0729_addorg2

Copy link
Contributor Author

@deming7h777 deming7h777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Monday, what I did
cd ~/genomics-workspace

*On personal laptop, make a folder called 'media'
mkdir -p media/blast/db media/hmmer/db
cp ../Downloads/GCF_003254395.2_Amel_HAv3.1_genomic.fna ./media/blast/db/
cp ../Downloads/GCF_003254395.2_Amel_HAv3.1_genomic.fna ./media/hmmer/db/

*command 1 works
python manage.py addblast Apis mellifera -t peptide protein -f GCF_003254395.2_Amel_HAv3.1_genomic.fna

*command2 not works
python manage.py blast_utility GCF_003254395.2_Amel_HAv3.1_genomic.fna -m
see screenshot

0729_addorg2

please run npm run build first

misc/add_func.py Outdated
@@ -0,0 +1,160 @@
from blast.models import BlastDb, SequenceType
#from django.core.management.base import BaseCommand, CommandError
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

misc/add_func.py Outdated
data2 = re2.json()
key = data1['query']['search'][0]['pageid']
key = str(key)
#print type(key)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

misc/add_func.py Outdated
sys.exit(0)

def delete_org(name):
#if options["organism"]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gottcha

misc/add_func.py Outdated
#organism = options["organism"][0].lower().capitalize() + " " + options["organism"][1].lower()
Organism.objects.filter(display_name = name).delete()
return ("remove %s in database"%name)
'''
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, good point

@deming7h777
Copy link
Contributor Author

Monday, what I did
cd ~/genomics-workspace
*On personal laptop, make a folder called 'media'
mkdir -p media/blast/db media/hmmer/db
cp ../Downloads/GCF_003254395.2_Amel_HAv3.1_genomic.fna ./media/blast/db/
cp ../Downloads/GCF_003254395.2_Amel_HAv3.1_genomic.fna ./media/hmmer/db/
*command 1 works
python manage.py addblast Apis mellifera -t peptide protein -f GCF_003254395.2_Amel_HAv3.1_genomic.fna
*command2 not works
python manage.py blast_utility GCF_003254395.2_Amel_HAv3.1_genomic.fna -m
see screenshot
0729_addorg2

please run npm run build first, finish the set up guide first

@r06942072
Copy link
Member

r06942072 commented Jul 31, 2019

July.31, 1st post

  • create a checklist for this PR in All feature under manage.py command #280

  • sudo yum install npm

  • npm
    0731_node_and_npm

  • npm run build not success, see error message
    0731_npm run build
    ...
    0731_npm_error

  • Try to makeblastdb on admin page through mouse clicking, but get error message same as running script, no such file
    0731_addorg2_webpage
    0731_makeblastdb_on_website

  • try addhmmer, but an error is too few argument
    0731_addhmmer

@r06942072
Copy link
Member

r06942072 commented Jul 31, 2019

July31, 2nd post

  • see the checklist for this PR in All feature under manage.py command #280

  • update npm and node to a higher version, and run npm run build
    0731_success_node_npm

  • successfully run npm run build
    0731_npm_success

  • successfully run
    python manage.py blast_utility GCF_003254395.2_Amel_HAv3.1_genomic.fna -m
    python manage.py blast_utility GCF_003254395.2_Amel_HAv3.1_genomic.fna -p
    0731_success_m_p

  • check those through browser
    0731_success_check

  • successfully run (It was my typo in July31, 1st post)
    python manage.py addhmmer Apis mellifera -f GCF_003254395.2_Amel_HAv3.1_genomic.fna

  • command python manage.py delete not found
    0731_unknown_command_delete

@r06942072 r06942072 merged commit 555ca93 into master Aug 1, 2019
@hsiaoyi0504 hsiaoyi0504 deleted the addorg2 branch September 23, 2019 06:42
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

Successfully merging this pull request may close these issues.

3 participants