Sponsored Content
Top Forums Shell Programming and Scripting reading information from a table and apply a command on multiple files Post 302708825 by @man on Tuesday 2nd of October 2012 09:38:53 AM
Old 10-02-2012
MySQL reading information from a table and apply a command on multiple files

Hey gyuz,

I wanna calculate the number of mapped reads of a bam file in a region of interest. I used this code to do so :

Code:
samtools view input.bam chrname:region1 > region1.txt

This will store all the reads from given bam file within the region of interest in region1.txt

Now I have several bam files and several regions for each which are different. (regions are not the same in all bam files)

I prepared a list of them like below:

bam1 region1
bam1 region2
bam1 region3
bam2 region4
bam2 region4
bam3 region5

I want the script to read from the table and apply the function on proper bam file and regions and report the output for each region in a single file. region1.txt, region2.txt, region3.txt,.....

If you can help me with this you saved my time so much!!

Thanks in advance.

Last edited by @man; 10-02-2012 at 12:44 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Apply `chmod` for multiple files through FTP

Hi all, Can you please help me in this aspect. I devoloped a FTP script to copy a directory to remote server. Now i got stuck-up in changing the file permissions for all the files in directory. I tried to change the permissions of single file and I did it but failed in changing... (3 Replies)
Discussion started by: Chanakya.m
3 Replies

2. Shell Programming and Scripting

How to Pull out multiple files from DB table and redirect all those files to a differetn directory?

Hi everyone!! I have a database table, which has file_name as one of its fields. Example: File_ID File_Name Directory Size 0001 UNO_1232 /apps/opt 234 0002 UNO_1234 /apps/opt 788 0003 UNO_1235 /apps/opt 897 0004 UNO_1236 /apps/opt 568 I have to... (3 Replies)
Discussion started by: ss3944
3 Replies

3. Shell Programming and Scripting

Apply 'awk' to all files in a directory or individual files from a command line

Hi All, I am using the awk command to replace ',' by '\t' (tabs) in a csv file. I would like to apply this to all .csv files in a directory and create .txt files with the tabs. How would I do this in a script? I have the following script called "csvtabs": awk 'BEGIN { FS... (4 Replies)
Discussion started by: ScKaSx
4 Replies

4. Shell Programming and Scripting

apply record separator to multiple files within a directory using awk

Hi, I have a bunch of records within a directory where each one has this form: (example file1) 1 2 50 90 80 90 43512 98 0909 79869 -9 7878 33222 8787 9090 89898 7878 8989 7878 6767 89 89 78676 9898 000 7878 5656 5454 5454 and i want for all of these files to be... (3 Replies)
Discussion started by: amarn
3 Replies

5. Shell Programming and Scripting

extracting information from multiple files

Hello there, I am trying to extract (string) information ( a list words) from 4 files and then put the results into 1 file. Currently I am doing this using grep -f list.txt file1 . and repeat the process for the other 3 files. The reasons i am doing that (a) I do know how to code (b) each file... (4 Replies)
Discussion started by: houkto
4 Replies

6. UNIX for Dummies Questions & Answers

Reading Table name from a list of files in a Directory

Hi , I have searched through the forum but not able to find out any help :( i have a directory having lot of files which contains sql statemtns eg : file 1 contains select from table_name1 where ..................... select from table_name2 where .......... select from ... (3 Replies)
Discussion started by: Trendz
3 Replies

7. Shell Programming and Scripting

search information in multiple files and save in new files

hi everyone, im stuck in here with shell :) can you help me?? i have a directory with alot files (genbank files ... all ended in .gbk ) more than 1000 for sure ... and i want to read each one of them and search for some information and if i found the right one i save in new file with new... (6 Replies)
Discussion started by: andreia
6 Replies

8. UNIX for Dummies Questions & Answers

Load multiple files into a table

Hi, I need to load data from two files to a single table. My requirement is that I get two files in which a few column data are manadatory. These files are identified based on the file name. For example, I have two files ABCFile and BCDFile. ABCFile has mandatory data in column 3 and 4... (0 Replies)
Discussion started by: reshma15193
0 Replies

9. Shell Programming and Scripting

Apply command to all files in folder

Hi all! I have this command grep -E '^\To: |^\Date: |^\Subject: ' fileA.txt > fileA_1.txt && grep -v '^\To: |^\Date: |^\Subject: ' fileA.txt >> fileA_1.txt && rm fileA.txt && sed -i -e 's/\(Date: \|Subject: \|To: \)//g' fileA_1.txtHow do I apply it to all the files in the folder (each file has a... (7 Replies)
Discussion started by: guilliber
7 Replies

10. UNIX for Beginners Questions & Answers

How to apply the update statement in multiple servers on multiple dbs at a time .?

Hi , Can any please help the below requirement on all multiple servers and multiple dbs. update configuration set value='yes' ;1) the above statement apply on 31 Databases at a time on different Ip address eg : 10.104.1.12 (unix ip address ) the above ip box contains 4 db's eg : db... (2 Replies)
Discussion started by: venkat918
2 Replies
Gtk2::Gdk::Region(3pm)					User Contributed Perl Documentation				    Gtk2::Gdk::Region(3pm)

NAME
Gtk2::Gdk::Region - wrapper for GdkRegion HIERARCHY
Glib::Boxed +----Gtk2::Gdk::Region METHODS
region = Gtk2::Gdk::Region->new rectangle = $region->get_clipbox boolean = $region->empty boolean = $region1->equal ($region2) o $region2 (Gtk2::Gdk::Region) $source1->intersect ($source2) o $source2 (Gtk2::Gdk::Region) $region->offset ($dx, $dy) o $dx (integer) o $dy (integer) boolean = $region->point_in ($x, $y) o $x (integer) o $y (integer) region = Gtk2::Gdk::Region->polygon ($points_ref, $fill_rule) o $points_ref (scalar) o $fill_rule (Gtk2::Gdk::FillRule) boolean = $region->rect_equal ($rectangle) o $rectangle (Gtk2::Gdk::Rectangle) Since: gtk+ 2.18 overlaptype = $region->rect_in ($rect) o $rect (Gtk2::Gdk::Rectangle) region = Gtk2::Gdk::Region->rectangle ($rectangle) o $rectangle (Gtk2::Gdk::Rectangle) list = $region->get_rectangles Returns a list of rectangles (Gtk2::Gdk::Rectangle's), the area covered by the region. $region->shrink ($dx, $dy) o $dx (integer) o $dy (integer) $region->spans_intersect_foreach ($spans_ref, $sorted, $func, $data=undef) o $spans_ref (scalar) arrayref of triples [$x1,$y1,$width1, $x2,$y2,$width2, ...] o $sorted (boolean) o $func (scalar) o $data (scalar) Call $function for horizontal lines which intersect $region. $spans_ref is an arrayref of x,y,width horizontal lines. If $sorted is true then they're assumed to be sorted by increasing y coordinate (allowing a single pass across the region rectangles). $function is called &$function ($x, $y, $width, $data) for each portion of a span which intersects $region. $function must not change $region. $region->spans_intersect_foreach ([ 0,0,50, 20,20,100, 0,10,50 ], 0, # spans not sorted by y &my_callback, 'hello'); # userdata sub my_callback { my ($x, $y, $width, $userdata) = @_; print "$userdata: $x, $y, $width "; } $source1->subtract ($source2) o $source2 (Gtk2::Gdk::Region) $source1->union ($source2) o $source2 (Gtk2::Gdk::Region) $region->union_with_rect ($rect) o $rect (Gtk2::Gdk::Rectangle) $source1->xor ($source2) o $source2 (Gtk2::Gdk::Region) ENUMS AND FLAGS
enum Gtk2::Gdk::FillRule o 'even-odd-rule' / 'GDK_EVEN_ODD_RULE' o 'winding-rule' / 'GDK_WINDING_RULE' enum Gtk2::Gdk::OverlapType o 'in' / 'GDK_OVERLAP_RECTANGLE_IN' o 'out' / 'GDK_OVERLAP_RECTANGLE_OUT' o 'part' / 'GDK_OVERLAP_RECTANGLE_PART' SEE ALSO
Gtk2, Glib::Boxed COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::Gdk::Region(3pm)
All times are GMT -4. The time now is 05:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy