Getting help online#

Depending on the question you want to answer, reading through the manual page of a command may not be sufficient for understanding how a command works and how you have to use it to solve your specific problem. Luckily, a lot of people have worked on solving many different computational problems for many years and most often you will find that someone else has already struggled with a very similar problem than you.

Browser-based problem solving#

Informative browser prompts#

A first approach to find more examples on how a command is used is to type a browser-based search that should be broad enough to capture your problem but specific enough to give you related information to the task at hand.

For instance, if you want to learn more about the command wc, its options and how to use it to count the numbers of characters, you could:

# Open browser page and type one of the following search
"wc options"
"wc unix options"
"how to use wc command in unix"
"how to use wc command in unix to count numbers of characters"

Programming community forums#

For more complex problems requiring commands with multiple options, you often want to search for examples online that someone else may have posted to a very similar problem. In this case, programming networks and forums can be a nice resource for browsing through discussions between people about a certain type of problem.

# Open Stackoverflow and browse through the discussions about the command wc
https://stackoverflow.com/
"wc unix options"

Searching for error messages#

Imagine you receive an error message on the command line and you do not know what it means. One of the first steps would probably be to copy/paste that error into Google and see whether anyone else has encountered the same error and has found a solution to it.

For instance, even if echo –help did not lead to an error message, it did not print the result you wanted. One way to find out why this is the case is to simply describe your error (or your actual aim that you did not achieve) in an online search.

# Open browser page and describe what echo does/does not do
"why does echo --help not print help page" #you describe the wrong outcome that you obtained when running the command
"how to print echo help page" #here you describe what you want to achieve

AI-based problem solving#

With recent advancements in Artificial Intelligence (AI), it has become more common and potentially more efficient for people doing bioinformatics to try to solve problems that they are facing by asking AI-based systems for an answer. One of these tools is ChatGPT, a large language model (LLM)-based tool developed by OpenAI as a general purpose chatbot. These tools are incredibly good at interpreting a language-based question asked by you and providing an answer, but the answers may carry risks in terms of legitimacy and interpretation.

Some of the most common risks are that AI-based systems 1) provide false information because ultimately their answers are based on the collective knowledge found online and building sentence structures similar to human communication, 2) do not give you any sources of the information they provided and 3) that users interpret the answers wrong because they overestimate the skills of the system. You should therefore become aware that it is crucial to follow an iterative process of re-evaluating the answers received by such chat bots and that the legitimacy of the provided answers should be carefully assessed.

../../_images/chatgpt_iteration.png

Obviously, these AI-based tools are continuously being further developed to improve their performance. In this course we will use ChatGPT-3.5 which is the free version, while ChatGPT-4 is currently only available by paid subscription but promises to be more reliable and creative in its conversations than ChatGPT-3.5 and also allow for longer conversations. Bard, an AI-based tool developed by Google is targeting to become better at providing resources to provided answers and allows for file and image handling in conversations, but we will not go into more detail here. If you are interested in a general comparison between the two tools, have a look here https://www.techrepublic.com/article/chatgpt-vs-google-bard/

Exercise 2.2#

Exercise 2.2

  • Try to learn more about the command wc by testing a browser-based search typing “wc options”. What do you learn about the different options? How do your browser-based results compare to those obtained by your fellow student neighbours?

# Open a browser window
Type 'wc options'
# Note that when you click on images, clearly there is a mixture of results targeted at your intended question and those that are completely out of topic (namely toilet images)
  • Try to adapt your browser-based search to be more targeted at the command (and options) you want to learn more about.

# Open a browser window
Type 'wc unix options'
# Note that the image search now provides more examples of the command wc used on a terminal
Type 'wc unix -l options'
# Note that the entries now are more focused on the -l option to count the number of lines
  • Try to learn more about the command (and options) with help of Stackoverflow.

# Go to Stackoverflow https://stackoverflow.com/
Type 'wc unix options'
# Note that the results are discussion-based and rather provide answers to specific problems that other people experienced
  • Find out how to print the help page of the command echo.

echo --help # does not print help page

# Open a browser window
why does echo --help not print help page
how to print echo help page
# Note that to print the help page of echo you need to type the following so that --help does not get interpreted as a string to print
help echo
  • Ask ChatGPT how to find out the word count of a text file with the command wc.

# Login to ChatGPT and ask a question that should give you the answer of interest
# Note that after receiving an answer, importantly you should follow the iterative approach to test whether the given answer is actually legit and makes sense
# Go to the command line
wc --help   # Confirm that wc -w gives you the word count within a file

Example conversation

../../_images/chatgpt_wordcount.png

Note that even in this almost perfect example answer, the last sentence is not really logical. ChatGPT writes that additionally wc can count words (which is redundant and not in addition to the sentences before).

  • Ask ChatGPT how to retrieve the number of occurrences of a pattern within a text file. We prepared a text file /nfs/teaching/551-0132-00L/2_Good_practices/pattern_occurrence.txt with multiple occurrences of the word “dnaA” so you can check the answer provided by ChatGPT.

# Ask a question that should give you the answer of interest
# Note that after receiving an answer, importantly you should follow the iterative approach to test whether the given answer is actually legit and makes sense
# Go to the command line
grep --help   # Confirm that grep -c gives you the count of the lines matching a pattern within a file

Example conversation

../../_images/chatgpt_grepcount.png

Note that ChatGPT tells you that grep -c will provide the counts of a pattern. In the command line help page you can read that instead it actually provides the counts of lines containing a pattern. Depending on the use case, this makes a difference if you think about a file where a line contains a pattern twice. What will happen in that case?

  • Can you iterate and provide a better question to ChatGPT so that it actually gives you the right answer for what grep -c does?

# Ask a question that should give you the answer of interest

Example conversation

../../_images/chatgpt_grepcount_improved.png

Note that the answer has similar content but changed in a seemingly pre-defined manner influenced by the question you asked. But also consider that this would still not solve your problem if you wanted to count the number of occurrences of a pattern and not the number of lines.

  • Ask ChatGPT where the provided information originates from.

# Ask a question that should give you the answer of interest

Example conversation

../../_images/chatgpt_grepresource.png

Note that ChatGPT has some awareness of its inability to provide resources, but it can give you text-based suggestions of potentially existing resources which you could then search for. Again you should iterate by browser-based searching for these resources to check whether they exist and are legitimate and helpful.