110 likes | 241 Views
Command line and batch files Molekular Phylogenetics – Practical. 1.1 The command line. Alternative to the graphical user interface (GUI ) of an operating system. Advantages : Commands can be saved for repeated use One program is able to execute other programs
E N D
1 Kommandozeile 1.1 The commandline • Alternative tothegraphicaluserinterface (GUI) of an operatingsystem • Advantages: • Commandscanbesavedforrepeateduse • Oneprogramisabletoexecuteotherprograms • Experienceduserscanperformsometasksfasterthanwiththe GUI • Drawbacks: • Commandsandoptionshavetobeknownbytheuser (ordisplayed in a moretime-consumingwaythan in the GUI)
1 Kommandozeile 1.2 Usage • An inputconsistsof a commandand a listofparameters. • Command: • Name of an executablefile (e.g.„winword.exe“) • Standard command (e.g. „cd“ forchangedirectory) • Parameter list: • Separatedbyspaces • Providefurtherinformationtotheexecutedapplication • e.g. thenameof a filetoopenedwiththeapplication Befehl Parameter abgetrennt durch Leerzeichen
1 Kommandozeile 1.3 Working directory • The currentworkingdirectoryisdisplayed in front oftheinputcursor • Files in therecanbereferencedwithoutthefullpath • The command„cd“ changestheworkingdirectory command path relative tothecurrentworkingdirectoty („C:\“) astheonlyparameter Changedworkingdirectory
1 Kommandozeile 1.4 Specifiyingpaths (1) • File locations (ascommandsorparameters) canbespecified in different ways: • Applicationanddocumentarebothlocated in thecurrentworkingdirectory (relative pathscanbeusedforboth) • Applicationis in theworkingdirectory, thedocumentisreferencedby a relative path • „..“ means „onelevelupwards“
1 Kommandozeile 1.4 Specifiyingpaths (2) • Application in thecurrentworkingdirectory, documentreferencedby an absolute path • Applicationreferencedby an absolute path, document in thecurrentworkingdirectory • Sincethepathtotheapplicationcontainsspaces, ishastobeput in quotationmarks • Otherwise „C:\Program“ wouldbethecommandandtherewouldbe 4 parameters: • „Files“ • „(x86)\Editoren\Microsoft“ • „Office\Office14\winword.exe“ • „Dokument.docx“ • Ofcourseisisalwayspossibletospecifyapplicationanddokumentwith absolute paths
1 Kommandozeile 1.5 Importantcommands • cd<path>Changestheworkingdirectory • dirLists thecontentsoftheworkingdirectory • del <path>Deletesthespecifiedfile (or all files in thespecifiedfolder) • md <name>Creates a newdirectory • rd<path>Deletesthespecifieddirectory • copy<source> <target>Copies a file • move<source> <target>Moves a file • exitTerminatesthecommandlinesession (The same effectasclosingthecommandlinewindow)
1 Kommandozeile 1.6 Batch files • Expressionsforthecommandlinecan also besaved in textfiles • Repeatedtaskscanbesavedand do havetoretypedevery time • Files havetheextension „bat“ • Every line in thefilecontainsoneexpression (consistingof a commandandpossibleparameters) • Example: • Sets theworkingdirectorytotheDocumentsoftheuser„BenStoever“ andstarts Word • Toexecute a batchfile simple type itsnameintothecommandline (or double click on it)
2. Java Technologie 2.1 Java Virtual Machine • Java applicationscannotbeexecuteddirectly • Theyhavetobeexecutedby a virtualmachine (JVM) • The virtualmachineis an executablefilecompiledfortheaccordingoperatingsystem • The javaapplicationiscontained in a JAR fileandcanbeexecuted on all operatingsystemswhere a virtualmachineisavailable • Advantage: Java applicationsareindendant on theoperatingsystem • Disatvantage: A JVM hastobeinstalled,Complexcalculations in Java codemighttakelongerthan in native applications
2. Java Technologie 2.2 Starting a Java application • Der command (executablefile) isthe JVM in thiscase • Itsfirstparameterisalways„-jar“ • The Java applicationfile (JAR file) isthesecondparameter • Additional parametersthatarespecifiedarepassedtotheapplicationbythe JVM Command (JVM) Parameter forthe Java application Java application
Titel der Präsentation 2.3 ExampleRandSeq • RandSeqis a programtogenerateequallydistributedrandom DNA and RAN sequences • Itiswritten in Java andthereforehastobestarted via java –jar • RandSeqexpectsthefollowingcommandlineparameters: java –jar RandSeq.jar <outputFile> <nucleotideCount> <sequenceType> <cytosineRate> <guanineRate> <adenineRate> • <sequenceType>caneitherbe–dnaor-rna • The remaining rate forthymineoruraciliscalculatedfromtheothers