SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell scripting searching directories and subdirectories AnushaC Bioinformatics 20 10-15-2013 12:32 PM
Scripting Help - Common Elements Giorgio C Bioinformatics 10 10-05-2013 10:53 AM
Shell Scripting help *** AnushaC Bioinformatics 19 10-04-2013 02:23 PM
Shell Scripting AnushaC General 1 10-04-2013 03:32 AM
Rookie's plee for advice: PERL or Python, Linux or Windows? A1_UltiMA Bioinformatics 7 11-29-2010 01:07 AM

Reply
 
Thread Tools
Old 08-19-2016, 10:50 AM   #1
JQL
Member
 
Location: MO, USA

Join Date: Apr 2011
Posts: 83
Default books for linux shell scripting and python?

Can you guys recommend a good introductory book for shell scripting, and maybe python? I'm going to have to learn it better.

e.g. what does the % mean here?

for f in *.fasta.gz
do
metaphlan2.py $f --input_type fasta --nproc 4 > ${f%.fasta.gz}_profile.txt
done

thanks
John
JQL is offline   Reply With Quote
Old 08-19-2016, 11:05 AM   #2
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,059
Default

Code:
$ ls *.fastq.gz
P1.fastq.gz  P2.fastq.gz  Pdot1.fastq.gz  Pdot2.fastq.gz
Compare the list above to the output below. Can you see what f% is doing?

Code:
$ for f in *.fastq.gz; do echo ${f%.fastq.gz}; done

P1
P2
Pdot1
Pdot2
GenoMax is offline   Reply With Quote
Old 08-19-2016, 11:49 AM   #3
JQL
Member
 
Location: MO, USA

Join Date: Apr 2011
Posts: 83
Default

Thanks!

I have all the fastq files in the dir of /fastq. but I don't need /fastq, only need P1, P2...
Is there an easy way to pick up what the * stands for?

John

for f in fastq/*.fastq.gz; do echo ${f%.fastq.gz}; done


Quote:
Originally Posted by GenoMax View Post
Code:
$ ls *.fastq.gz
P1.fastq.gz  P2.fastq.gz  Pdot1.fastq.gz  Pdot2.fastq.gz
Compare the list above to the output below. Can you see what f% is doing?

Code:
$ for f in *.fastq.gz; do echo ${f%.fastq.gz}; done

P1
P2
Pdot1
Pdot2
JQL is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 12:40 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO