Skip to content

Tools II

Juan Gonzalez-Gomez edited this page Feb 27, 2019 · 18 revisions

Session 2: Tools

  • Goals: Learn how to use Github inside pycharm
  • Time: 2h
  • Date: Wednesday, Jan-2nd-2019

Contents

Github

You are supposed to have an account in github, created in the previous session. Do not forget to write your real name and github nickname in the forum of the Aula Virtual

Follow the instructions of the teachers for the next activities:

  • Create your first repo in github. The name should be 2018-19-PNE-practices (NOTE: It is very important that you use exactly that name)
    • Go to your github page and click on the repositories tab
    • Click on the NEW button to create the repo
    • Introduce the name (2018-19-PNE-practices) and brief description (Ex. Repo for storing my assingments for the Programming in Network environment subject)
    • Check the box that says Initialize the repository with a README
    • Add an opensource license, such as GPL v3
    • Click on the create repository button

Once created, you should see something like this:

Congrats! You have created your first repo!

Pycharm + Github

Now we will learn how to access to the new repo from pycharm. Follow the instructions give by your teacher

  • Launch the pycharm environment
  • Click on the option "Check out from Version Control" and select "GIT". What we want to do is to download the new repo into our local machine, for working on it
  • We have to enter the URL of the new repo. Got to github and enter into the 2018-19-PNE-practices repo. Press the green boton (Clone or download) and copy the link you find there
  • Paste the link on the URL entry in the pycharm windows and click the blue button "Clone"
  • Select the PycharmProjects folder for storing the project
  • We add the hello world example that we created in the previous session. Using the file manager, copy the file hello.py into the session-2 folder in the 2019-19-PNE-practises project. We are using the folder session 2 for storing all the files added in this second session
  • Execute the hello world program for making sure everything is ok
  • Now is time to add this file to our repo. First we have to add it locally. Select the file and click on the add option. We've told the pycharm that the hello.py is part of our project inside the repo
  • Perform the contribution: VCS/Commit. Whenever with make a contribution, is mandatory to write a short message indicating what we have done
  • Click the button that says "Commit and push"
  • As it is the first time we are pushing commits into our repo, the pycharm will ask for the github password
  • Let's check if the hello.py file is already in github: It should be there. Contrats! You've done your first contribution to a github repo!
  • Now you are ready to continue working on the hello.py. The workflow is as follows:
    • You introduce changes in the hello.py
    • Once you are happy withe the changes, and everything works ok, you commit and pushed that changes into the repo

Exercise 1

  • Add more prints to the hello.py program. Check that the program is working fine, both by executing the full program and doing it step by step
  • Send the changes to the github repo
  • Check that the changes are already there

Exercise 2

  • Add the print_numbers.py file into your project (It should also store into the session-2 folder)
  • Upload the file into your github repo
  • Check that the file is there

Exercise 3

  • Add all the pending files from the session 1: sum.py, sumN.py, fibonaccy.py and fibonacci_sum.py
  • Upload them into your github repo

Exercise 4

Create a program for counting the number of bases presented in a DNA sequence. The user introduces a sequence of letter representing the DNA chain: CATGTAGACTAG. Our program should calculate the total length, and the number of bases that compound the sequence. In the previous sequence, the output should be:

  • Introduce the sequence: CATGTAGACTAG
  • Total length: 12
  • A: 4
  • C: 2
  • T: 3
  • G: 3

Exercise 5

Repeat the exercise 4, but now the sequences should be read from an external file that can have sequeces in separated lines

For example, the file should be something like this:

AGTACACTGGT
ACCAGTGTACT
ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG

The program should open the file, count the total number of bases, and the number of the different bases

End of the session

What you should be able to do:

  • Create repos in github
  • Clone the repos and work with them in Pycharm
  • Modify the python files and upload the changes to the github repo
  • Add new python files and upload them to the github repo

News related to the Biomedical engineering

Authors

Credits

  • Alvaro del Castillo. He designed and created the original content of this subject. Thanks a lot :-)

License

Links

Clone this wiki locally