fredhutchio / tfcb_2019

class materials for MCB517A through UW/Fred Hutch
10 stars 10 forks source link

Questions for homework 4: command line #26

Open k8hertweck opened 5 years ago

k8hertweck commented 5 years ago

Homework questions here

@matsen and I are happy to answer questions about the homework here. For general questions about command line, please use #27

LABrumage commented 5 years ago

For number 5, are the use of ImageMagick and parallel going to be discussed in class on Tuesday of next week? Thank you!

k8hertweck commented 5 years ago

@LABrumage Yes, we'll cover GNU parallel in the scripting section.

Everything you need to know about ImageMagick is included in the homework question. If you have other questions, I recommend looking at the documentation, or bringing specific questions for @matsen

stephen-rettie commented 5 years ago

I was able to do question 5 on my local machine but on rhino the same code does nothing. I'm happy to post my answer if that's okay in this channel.

The manual for my local machine is like 1000X longer than the one on rhino. Maybe the version on rhino is old?

k8hertweck commented 5 years ago

@stephen-rettie We left out one small thing in the homework assignment, that is required to be able to use ImageMagick on rhino. You'll need to run the following code to load ImageMagick and make it available for use:

ml ImageMagick

After that, you should be able to complete the exercise as described. Thanks for catching this, and I'll update the question in the homework.

k8hertweck commented 5 years ago

Alright, it looks like the default version of parallel on rhino isn't compatible with question 5, but luckily, we can load an updated version:

ml parallel

I've updated the homework question accordingly.

Amandakr713 commented 5 years ago

For question 1, after we've completed the tutorial, should our answer just include our thoughts about the tutorial and areas we found particularly challenging?

matsen commented 5 years ago

That would be great!

On Fri, Nov 1, 2019, 3:18 PM Amanda Riley notifications@github.com wrote:

For question 1, after we've completed the tutorial, should our answer just include our thoughts about the tutorial and areas we found particularly challenging?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fredhutchio/tfcb_2019/issues/26?email_source=notifications&email_token=AAA3QRD7VPEUWVM23IFMTV3QRSTJXA5CNFSM4JHOCHD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC4JYEA#issuecomment-548969488, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA3QRFUDFV5KW3UAHAKOE3QRSTJXANCNFSM4JHOCHDQ .

sbest0128 commented 5 years ago

For question 5, do we need to actually open a text editor, write our script and save the .txt file containing the script in our slides/images directory so that somebody can actually run that script?

matsen commented 5 years ago

Yes, please! Although we aren't validating that with the way the homework is set up, we'd like for you to do so.

On Sun, Nov 3, 2019 at 1:43 PM sbest0128 notifications@github.com wrote:

For question 5, do we need to actually open a text editor, write our script and save the .txt file containing the script in our slides/images directory so that somebody can actually run that script?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fredhutchio/tfcb_2019/issues/26?email_source=notifications&email_token=AAA3QRHI3VVZBE4R3MWZB6DQR4ZVLA5CNFSM4JHOCHD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC55UCI#issuecomment-549181961, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA3QRHFCS4HMDYRWYVR34LQR4ZVLANCNFSM4JHOCHDQ .

-- Frederick "Erick" Matsen, Associate Member Fred Hutchinson Cancer Research Center http://matsen.fredhutch.org/

alexgal8 commented 5 years ago

For question 3: I understand what tee does but I'm confused about where it goes and where the pipe operator goes. Here is what I have for question 1: ./tfcb_2019/lectures/lecture09/scripting/script2.sh 1> stdout.txt 2> stderr.txt Where in here does tee and | go?

alexgal8 commented 5 years ago

For question 4: After I get the words from anthony.txt listed one by one, how do I sort them? After googling, it sounds like I press v to select and then drag my cursor, but this doesn't work (when I click v it just types "v" and after that selecting by dragging cursor doesn't seem to work).

matsen commented 5 years ago

Where in here does tee and | go?

Play around and see what works!

On Mon, Nov 4, 2019 at 4:57 PM alexgal8 notifications@github.com wrote:

For question 3: I understand what tee does but I'm confused about where it goes and where the pipe operator goes. Here is what I have for question 1: ./tfcb_2019/lectures/lecture09/scripting/script2.sh 1> stdout.txt 2> stderr.txt Where in here does tee and | go?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fredhutchio/tfcb_2019/issues/26?email_source=notifications&email_token=AAA3QRAW4K4RSMWXVDOUVADQSDAJLA5CNFSM4JHOCHD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDBHRWQ#issuecomment-549615834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA3QRAJPS4CLPML6IV7JU3QSDAJLANCNFSM4JHOCHDQ .

-- Frederick "Erick" Matsen, Associate Member Fred Hutchinson Cancer Research Center http://matsen.fredhutch.org/

matsen commented 5 years ago

For question 4: After I get the words from anthony.txt listed one by one, how do I sort them? After googling, it sounds like I press v to select and then drag my cursor, but this doesn't work (when I click v it just types "v" and after that selecting by dragging cursor doesn't seem to work).

It sounds like you're in vim. This question has to do with building a series of commands piped together in the shell.

sbest0128 commented 5 years ago

So for question 5, I have saved wrote and saved a perfectly-working script (jpg-to-png_montage.sh) and is currently sitting on my Desktop. How am I able to take this script file and save it within the ~/tfcb_2019/lectures/lecture09/slides/images directory on the rhino server? Is this possible to do?

sbest0128 commented 5 years ago

Nevermind my last question, I just created a new file within the ~/tfcb_2019/lectures/lecture09/slides/images directory on the rhino server using the cat > filename.sh function in which contains my script.

alexgal8 commented 5 years ago

Where in here does tee and | go? Play around and see what works!

I did for an hour and can't seem to find the right order to get both stderr and stdout to redirect to files while only getting stdout to display. Do you have any hints?

alexgal8 commented 5 years ago

Where in here does tee and | go? Play around and see what works!

I did for an hour and can't seem to find the right order to get both stderr and stdout to redirect to files while only getting stdout to display. Do you have any hints?

For question 4: After I get the words from anthony.txt listed one by one, how do I sort them? After googling, it sounds like I press v to select and then drag my cursor, but this doesn't work (when I click v it just types "v" and after that selecting by dragging cursor doesn't seem to work).

It sounds like you're in vim. This question has to do with building a series of commands piped together in the shell.

When I try sort tfcb_2019_lectures_lecture09_vim_anthony.txt | uniq it says there is no such file or directory. Can you tell my why this is?

matsen commented 5 years ago

I did for an hour and can't seem to find the right order to get both stderr and stdout to redirect to files while only getting stdout to display. Do you have any hints?

Well, you want tee to be the only thing getting stdout. Note that the previous redirections you mentioned can go in any order.

When I try sort tfcb_2019_lectures_lecture09_vim_anthony.txt | uniq it says there is no such file or directory. Can you tell my why this is?

Hm, that doesn't look like a unix path to me. Did you substitute the slashes with underscores? Note that you can check if a file exists by providing it as an argument to ls.

alexgal8 commented 5 years ago

I did for an hour and can't seem to find the right order to get both stderr and stdout to redirect to files while only getting stdout to display. Do you have any hints?

Well, you want tee to be the only thing getting stdout. Note that the previous redirections you mentioned can go in any order.

When I try sort tfcb_2019_lectures_lecture09_vim_anthony.txt | uniq it says there is no such file or directory. Can you tell my why this is?

Hm, that doesn't look like a unix path to me. Did you substitute the slashes with underscores? Note that you can check if a file exists by providing it as an argument to ls.

Ah yes thank you, I mixed up slashes and underscores. So when I enter sort tfcb_2019/lectures/lecture09/vim/anthony.txt | uniq I get the contents of anthony.txt but it is not sorted alphabetically with one word per line, which I thought was what sort did. Am I missing something? Thanks for your help!

matsen commented 5 years ago

I get the contents of anthony.txt but it is not sorted alphabetically with one word per line, which I thought was what sort did. Am I missing something? Thanks for your help!

Take another look at the question and at the documentation for sort.