Victoria Offord

Victoria Offord

As a Prinicipal Bioinformatician in Experimental Cancer Genetics at the Wellcome Sanger Institute, I develop and run pipelines for saturation mutagenesis, CRISPR screens, RNA-Seq and variant calling.

Location UK

Activity

  • @FaryalYousaf if you paste the script contents, happy to have a look and help debug.

  • Yes, but you would need to give the path to its location.

  • Hi Ege, great question. Yes, you could put it in quotes e.g. 'apple pie' and this should allow for spaces in the user input.

  • Hi Ege, yes, these are covered in more depth in step 2.12. We also skim across it in one of the script comments in 2.11.

  • These need to be considered in relation to your script command. Everything that follows your script (separated by a space) can be considered a positional argument - i.e. when we have "apple pear orange" following our script, apple is the first item ($1), pear is the second item ($2) and orange would be the third item ($3). When we use those predefined...

  • Yes, but you'll want to be cautious and make sure each nested if-else closes where you expect it to. May be worth considering a case statement instead.

  • I'm not sure I've come across anything specifically for comments, but it is possible to change the terminal palette - that will depend on the terminal application. Here is an example for ubuntu (https://itsfoss.com/change-terminal-color-ubuntu/) - there will be similar walkthroughs online for Windows or OSX.

  • A directory is the equivalent of a folder (i.e. a place where you can store objects like files). An argument typically relates to a command and is equivalent to a parameter that you want the program to take in and act on. A directory itself cannot be an argument, but the path to a directory can be a value supplied to an argument.

  • Depends on where you look for the answer - folks seem to debate this. Wikipedia has it as 'print working directory'.

  • Aha! Yes, so those code snippets need to be saved in a file and then executed as a script.

  • @TimothyBAMGBOSE Do you have this at the start of the script?

    #!/usr/bin/env bash

  • @StigPaul - good questions!

    One potential caveat might be if you try setting the value of the global variable in a script or elsewhere, it can be tricky to track back if things go wrong.

    You can use 'unset' followed by the variable name (i.e. unset MY_NAME) to remove/unset the variable.

    Whether it's saved after restart will depend on where you set...

  • @TimothyBAMGBOSE if you copy the contents of the script and the command used to run it into the comments I can have a look and see :)

  • Great question! Unix is quite broadly applicable - not limited to bioinformatics :)

  • @MG I'd assume that without setting a value for temperature, it is always meeting this condition "temperature -lt min_temperature" which gives "Too cold" as a response.

  • @Amie-LouiseHartington I can promise that even a seasoned coder will make syntax errors...and lose hours looking for that one rogue comma or whitespace! I don't know about others, but I often find that it's in making those errors I learn the most :) Great to hear you're learning loads - hope you'll enjoy week 3!

  • You will need to run the function within the bash script only. There are ways to export functions for use in your terminal (outside of a script) but they aren't covered as part of this course :)

  • @YasmienKhodary we'll go into that in more detail in step 2.12 :)

  • @WessalHanout these are covered in more detail in step 2.12 :)

  • @RuthReyes @ZainabKashim-Bello happy to help debug if you copy and paste the script you created with nano :)

  • Looks like Very Good has a space which is confusing the script. Try providing it encased in quotation marks e.g. "Very Good" which should stop it being interpreted as two separate values. Let us know how you get on!

  • Great questions! An argument is a value we provide the script when we execute it on the command line. That value may be stored in a positional variable e.g. $1 or $2. In this script we're reassigning the value to a variable with a more descriptive name (temperature). In this case, temperature is a variable (something assigned a value) in the same way...

  • To access the exported variable in the environment/outside of the script, you would likely need to source the script itself.

  • Absolutely! It's not essential to use .sh as the extension, but as Abdullah rightly says, it's a useful indicator of what's inside the file (and its purpose).

  • It's not essential, but it's probably good practice - especially as you might share your script with someone else who has multiple interpreters installed. :)

  • Good question! It allows you to execute the script without having to add `bash` to the start of your command.

  • @ArkashaSadhewa we don't have to, but it does look cleaner for the user/person seeing it on the command line.

  • Great question!

    Wikipedia has a comparison of the most common shells here:
    https://en.wikipedia.org/wiki/Comparison_of_command_shells

    I'd recommend Bash as it's the default on most Linux distributions and you'll be more likely to find support for it from other informaticians.

  • @RitaHoldhus exactly :)

    Typing 'man echo' (without the quotes) on the command line will give you the manual/documentation for the echo command and explain the various options available.

    There's a good explanation here: https://www.gnu.org/software/bash/manual/html_node/Escape-Character.html

    Common examples would be:

    \n = new line
    \r = carriage...

  • There may be some commands/syntax shared between shells, so it is possible, but probably not recommended.

  • Hi @AsandaGambu, if you copy the contents of the script into the comments, we can try to help debug :)

  • It looks like there may be a missing '/'. Does changing the shebang to /usr/bin/env work?

  • In many ways it's probably personal preference. But the former is probably preferable in situations where you want your scripts accessible on your PATH - for example you could put scripts in a `bin` (or other named) directory, make them executable and then run them without having to either be in that directory or specify their full path. An example of how this...

  • It looks like there may be a rogue quotation mark. Did you want to copy paste your script contents into the comments and we can try to debug?

  • Hi @DianaValencia, thanks for your comment on our course. We would love to use it to demonstrate the impact of the course. May we have your permission to do this?

  • Hi @SARAIMORALESRAMIREZ, , thanks for your comment on our course. We would love to use it to demonstrate the impact of the course. May we have your permission to do this?

  • Hi @BaoChiWong, thanks for your comment on our course. We would love to use it to demonstrate the impact of the course. May we have your permission to do this?

  • Hi @VITÓRIARODRIGUESGUIMARÃESALVES, thanks for your comment on our course. We would love to use it to demonstrate the impact of the course. May we have your permission to do this?

  • Hi @KylieBalotin, thanks for your comment on our course. We would love to use it to demonstrate the impact of the course. May we have your permission to do this?

  • Hi @PageneckChikondowa, thanks for your comment on our course. We would love to use it to demonstrate the impact of the course. May we have your permission to do this?

  • Hi @AlexandraMilliken, thanks for your comment on our course. We would love to use it to demonstrate the impact of the course. May we have your permission to do this?

  • Hi @SayakaOgawa, thanks for your comment on our course. We would love to use it to demonstrate the impact of the course. May we have your permission to do this?