Sponsored Content
Top Forums Shell Programming and Scripting Selecting files from a list and passing them to a program using csh Post 302578318 by zaxxon on Thursday 1st of December 2011 10:04:55 AM
Old 12-01-2011
You have tons of posts - it would be nice if you also contribute sometimes instead of always have others... you know the impression one could get.
It is also not allowed to bump up threads - check the rules. What would you do if there wasn't this forum here? Ask in another one?
I hope you got it.

To your code problem:
Code:
$> awk -F"-" '{_[$4 FS $6]=_[$4 FS $6] $0} END{for(e in _){print _[e]}}' infile
n02-z30-dsr65-ndelt0.25-varp0.002-16x12drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.004-16x12drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.006-16x12drw-csq.msfn02-z30-dsr65-ndelt0.25-varp0.008-16x12drw-csq.msfn02-z30-dsr65-ndelt0.25-varp0.010-16x12drw-csq.msf
n02-z30-dsr65-ndelt0.75-varp0.002-16x12drw-csq.msf n02-z30-dsr65-ndelt0.75-varp0.004-16x12drw-csq.msf n02-z30-dsr65-ndelt0.75-varp0.006-16x12drw-csq.msfn02-z30-dsr65-ndelt0.75-varp0.008-16x12drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msfn02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msfn02-z30-dsr65-ndelt0.25-varp0.010-4x3drw-csq.msf

You could redirect the output into a file to check it 1st and then read it with a while-loop and execute the 3 lines as parameter to your tool.
Or you can use xargs and hand it over.

Last edited by zaxxon; 12-01-2011 at 11:10 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing the password in csh ( su )

Hi, How do I pass the password from a csh script when I su to a different user ? ( Root is not running this script ) Thanks (1 Reply)
Discussion started by: ayeger
1 Replies

2. Shell Programming and Scripting

Passing value to an external program problem...

This code is in my 'case' statement and it all else works fine. The problem I have is that the value in 'procno' is not passed on to the external program (fireit). It is passing all zeros instead of the actual process number. By the time I get to this case statement, I know the "Number" and... (1 Reply)
Discussion started by: giannicello
1 Replies

3. Shell Programming and Scripting

how to call awk in a csh Program

Hi Friends, Could you pleas help me out.. I have an awk program which works fine while running it in the command prompt. The awk program is =============== awk 'BEGIN { format="head -%d M2_Sales_N01.txt |tail -%d >M2_Sales_N01_%02d.txt\n" n=0 m=0 } { if (n==0) { tmp=$1 n=1 }... (5 Replies)
Discussion started by: bikas_jena
5 Replies

4. Shell Programming and Scripting

Selecting one file from a list

Hi, I am able to do this by brute force but I am just curious if there is a better way of handling things. Basically the scenario is something like this: There are a number of files in a directory: rib.20071224.1759.gz 24-Dec-2007 17:59 132K rib.20071224.1959.gz 24-Dec-2007... (7 Replies)
Discussion started by: Legend986
7 Replies

5. UNIX for Dummies Questions & Answers

Selecting Unique Values from many List

I have a question I have like 19 different list which contains the name of the server but what I need is just unique ones. First thing I need to do is just make a unique list within the list itself i.e. delete anything that is repeated inside the list like for example in list1 i... (1 Reply)
Discussion started by: pareshan
1 Replies

6. Shell Programming and Scripting

Selecting certain times from a list

Hi all, I have a list of times: ...10:02 15:34 20:05 01:51 06:55 09:00 05:52... That's just part of the list (its huge). How do I go about selecting certain times, e.g. just between 23:00 and 05:00 ?? (4 Replies)
Discussion started by: mikejreading
4 Replies

7. Shell Programming and Scripting

Passing screen value to a program

Hi all, I have the following question. Apparently not very difficult, but I'm not any expert. I have a program, let's say program.x, and a bash script that execute it, let's say program.sh. When the program executes it asks for a value to continue. What I want is just passing the value throw... (2 Replies)
Discussion started by: josegr
2 Replies

8. Shell Programming and Scripting

Running a program using csh

I have a program which I can run on the command line like below and works fine /nethome/chrisd/HSeis/TommyCD/TommyCD-1101/bin/raytrac vmod=npt10-z30.vmod srfile=jcdint.sc rcfile=jcdint.rc phases="SP FS" level=twop format="X T" dtau=0.1 mdacc=0.5 mindist=0.1 maxitertp=25 ray=npt10-z30.ry... (0 Replies)
Discussion started by: kristinu
0 Replies

9. Shell Programming and Scripting

Passing arguments to csh

I have noticed this thing using csh when passing arguments Suppose I call a csh script using ../Scripts/plot-model.csh -vmod="npt02-z30.vmod" -R="0/80/0/30" -c="0/4.5" -aspr="1:10" Somehow the " get removed when doing $argv ending up with -vmod=npt02-z30.vmod... (0 Replies)
Discussion started by: kristinu
0 Replies

10. Programming

Passing argument to a program!!

Hi friends, I have a small query, hope u will help me with it. I want to write a small program which would take an integer as an argument, then I want to save that argument in a variable of type int. Could you please help me with it. Here is my program #include <stdio.h> int main(int... (4 Replies)
Discussion started by: gabam
4 Replies
Bio::AlignIO(3pm)					User Contributed Perl Documentation					 Bio::AlignIO(3pm)

NAME
Bio::AlignIO - Handler for AlignIO Formats SYNOPSIS
use Bio::AlignIO; $inputfilename = "testaln.fasta"; $in = Bio::AlignIO->new(-file => $inputfilename , -format => 'fasta'); $out = Bio::AlignIO->new(-file => ">out.aln.pfam" , -format => 'pfam'); while ( my $aln = $in->next_aln() ) { $out->write_aln($aln); } # OR use Bio::AlignIO; open MYIN,"testaln.fasta"; $in = Bio::AlignIO->newFh(-fh => *MYIN, -format => 'fasta'); open my $MYOUT, '>', 'testaln.pfam'; $out = Bio::AlignIO->newFh(-fh => $MYOUT, -format => 'pfam'); # World's smallest Fasta<->pfam format converter: print $out $_ while <$in>; DESCRIPTION
Bio::AlignIO is a handler module for the formats in the AlignIO set, for example, Bio::AlignIO::fasta. It is the officially sanctioned way of getting at the alignment objects. The resulting alignment is a Bio::Align::AlignI-compliant object. The idea is that you request an object for a particular format. All the objects have a notion of an internal file that is read from or written to. A particular AlignIO object instance is configured for either input or output, you can think of it as a stream object. Each object has functions: $stream->next_aln(); And: $stream->write_aln($aln); Also: $stream->type() # returns 'INPUT' or 'OUTPUT' As an added bonus, you can recover a filehandle that is tied to the AlignIO object, allowing you to use the standard <> and print operations to read and write alignment objects: use Bio::AlignIO; # read from standard input $stream = Bio::AlignIO->newFh(-format => 'Fasta'); while ( $aln = <$stream> ) { # do something with $aln } And: print $stream $aln; # when stream is in output mode Bio::AlignIO is patterned on the Bio::SeqIO module and shares most of its features. One significant difference is that Bio::AlignIO usually handles IO for only a single alignment at a time, whereas Bio::SeqIO handles IO for multiple sequences in a single stream. The principal reason for this is that whereas simultaneously handling multiple sequences is a common requirement, simultaneous handling of multiple alignments is not. The only current exception is format "bl2seq" which parses results of the BLAST "bl2seq" program and which may produce several alignment pairs. This set of alignment pairs can be read using multiple calls to next_aln. CONSTRUCTORS
Bio::AlignIO->new() $seqIO = Bio::AlignIO->new(-file => 'filename', -format=>$format); $seqIO = Bio::AlignIO->new(-fh => *FILEHANDLE, -format=>$format); $seqIO = Bio::AlignIO->new(-format => $format); $seqIO = Bio::AlignIO->new(-fh => *STDOUT, -format => $format); The new class method constructs a new Bio::AlignIO object. The returned object can be used to retrieve or print alignment objects. new accepts the following parameters: -file A file path to be opened for reading or writing. The usual Perl conventions apply: 'file' # open file for reading '>file' # open file for writing '>>file' # open file for appending '+<file' # open file read/write 'command |' # open a pipe from the command '| command' # open a pipe to the command -fh You may provide new() with a previously-opened filehandle. For example, to read from STDIN: $seqIO = Bio::AlignIO->new(-fh => *STDIN); Note that you must pass filehandles as references to globs. If neither a filehandle nor a filename is specified, then the module will read from the @ARGV array or STDIN, using the familiar <> semantics. -format Specify the format of the file. Supported formats include: bl2seq Bl2seq Blast output clustalw clustalw (.aln) format emboss EMBOSS water and needle format fasta FASTA format maf Multiple Alignment Format mase mase (seaview) format mega MEGA format meme MEME format msf msf (GCG) format nexus Swofford et al NEXUS format pfam Pfam sequence alignment format phylip Felsenstein PHYLIP format prodom prodom (protein domain) format psi PSI-BLAST format selex selex (hmmer) format stockholm stockholm format Currently only those formats which were implemented in Bio::SimpleAlign have been incorporated into Bio::AlignIO. Specifically, "mase", "stockholm" and "prodom" have only been implemented for input. See the specific module (e.g. Bio::AlignIO::prodom) for notes on supported versions. If no format is specified and a filename is given, then the module will attempt to deduce it from the filename suffix. If this is unsuccessful, "fasta" format is assumed. The format name is case insensitive; "FASTA", "Fasta" and "fasta" are all treated equivalently. Bio::AlignIO->newFh() $fh = Bio::AlignIO->newFh(-fh => *FILEHANDLE, -format=>$format); # read from STDIN or use @ARGV: $fh = Bio::AlignIO->newFh(-format => $format); This constructor behaves like new, but returns a tied filehandle rather than a Bio::AlignIO object. You can read sequences from this object using the familiar <> operator, and write to it using print. The usual array and $_ semantics work. For example, you can read all sequence objects into an array like this: @sequences = <$fh>; Other operations, such as read(), sysread(), write(), close(), and printf() are not supported. -flush By default, all files (or filehandles) opened for writing alignments will be flushed after each write_aln() making the file immediately usable. If you do not need this facility and would like to marginally improve the efficiency of writing multiple sequences to the same file (or filehandle), pass the -flush option '0' or any other value that evaluates as defined but false: my $clustal = Bio::AlignIO->new( -file => "<prot.aln", -format => "clustalw" ); my $msf = Bio::AlignIO->new(-file => ">prot.msf", -format => "msf", -flush => 0 ); # go as fast as we can! while($seq = $clustal->next_aln) { $msf->write_aln($seq) } OBJECT METHODS
See below for more detailed summaries. The main methods are: $alignment = $AlignIO->next_aln() Fetch an alignment from a formatted file. $AlignIO->write_aln($aln) Write the specified alignment to a file.. TIEHANDLE(), READLINE(), PRINT() These provide the tie interface. See perltie for more details. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Peter Schattner Email: schattner@alum.mit.edu CONTRIBUTORS
Jason Stajich, jason@bioperl.org APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : $stream = Bio::AlignIO->new(-file => $filename, -format => 'Format') Function: Returns a new seqstream Returns : A Bio::AlignIO::Handler initialised with the appropriate format Args : -file => $filename -format => format -fh => filehandle to attach to -displayname_flat => 1 [optional] to force the displayname to not show start/end information newFh Title : newFh Usage : $fh = Bio::AlignIO->newFh(-file=>$filename,-format=>'Format') Function: does a new() followed by an fh() Example : $fh = Bio::AlignIO->newFh(-file=>$filename,-format=>'Format') $sequence = <$fh>; # read a sequence object print $fh $sequence; # write a sequence object Returns : filehandle tied to the Bio::AlignIO::Fh class Args : fh Title : fh Usage : $obj->fh Function: Example : $fh = $obj->fh; # make a tied filehandle $sequence = <$fh>; # read a sequence object print $fh $sequence; # write a sequence object Returns : filehandle tied to the Bio::AlignIO::Fh class Args : _load_format_module Title : _load_format_module Usage : *INTERNAL AlignIO stuff* Function: Loads up (like use) a module at run time on demand Example : Returns : Args : next_aln Title : next_aln Usage : $aln = stream->next_aln Function: reads the next $aln object from the stream Returns : a Bio::Align::AlignI compliant object Args : write_aln Title : write_aln Usage : $stream->write_aln($aln) Function: writes the $aln object into the stream Returns : 1 for success and 0 for error Args : Bio::Seq object _guess_format Title : _guess_format Usage : $obj->_guess_format($filename) Function: Example : Returns : guessed format of filename (lower case) Args : force_displayname_flat Title : force_displayname_flat Usage : $obj->force_displayname_flat($newval) Function: Example : Returns : value of force_displayname_flat (a scalar) Args : on set, new value (a scalar or undef, optional) alphabet Title : alphabet Usage : $obj->alphabet($newval) Function: Get/Set alphabet for purpose of passing to Bio::LocatableSeq creation Example : $obj->alphabet('dna'); Returns : value of alphabet (a scalar) Args : on set, new value (a scalar or undef, optional) perl v5.14.2 2012-03-02 Bio::AlignIO(3pm)
All times are GMT -4. The time now is 02:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy