Giter Club home page Giter Club logo

Comments (3)

dongbohu avatar dongbohu commented on September 27, 2024 1

Instead of using the associative array in bash 4 in for loop, we can use a simpler array like this:

list=(
    9606 "Homo sapiens" "Human"
    4932 "Saccharomyces cerevisiae" "S. cerevisiae"
    10090 "Mus musculus" "Mouse",
    10116 "Rattus norvegicus" "Rat",
    6239 "Caenorhabditis elegans" "C. elegans"
    3702 "Arabidopsis thaliana" "Arabidopsis"
    7227 "Drosophila melanogaster" "Fruit fly"
    7955 "Danio rerio" "Zebrafish"
    208964 "Pseudomonas aeruginosa" "Pseudomonas aeruginosa"
)

count=0
while [ "x${list[count]}" != "x" ]; do
   id=${list[count]}
   sci_name=${list[count + 1]}
   common_name=${list[count + 2]}
   python manage.py organisms_create_or_update --taxonomy_id=$id \
        --scientific_name="$sci_name" --common_name="$common_name"
   count=$(( $count + 3 ))
done

This is an example to replace lines 9-26 of tribe/load_organisms_and_genes_to_db.sh. (May not be the best solution, but it is something worth trying.)

from tribe.

dongbohu avatar dongbohu commented on September 27, 2024 1

Yes, for lines 67-178, you will have to include other fields in the array too. For lines 28-62, the array will include both the name and url.

It also depends on whether you may need to add more python manage xxx commands or not. The more you need to add in, the larger benefit a for loop will give you.

from tribe.

rzelayafavila avatar rzelayafavila commented on September 27, 2024

@dongbohu - Thanks, I agree. Probably the list will need to include the location of the data files for each organism and the systematic_col number if we want to replace lines 67-178. In terms of lines 28-62, it looks like declaring the array and running the loop might be more trouble than it's worth.

from tribe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.