Sponsored Content
Full Discussion: Gap length between intervals
Top Forums UNIX for Dummies Questions & Answers Gap length between intervals Post 302956441 by lsantome on Wednesday 30th of September 2015 03:06:29 AM
Old 09-30-2015
Gap length between intervals

hi all,

I wish to calculate the length between intervals whose are defined by a starting and an end possition. The data looks like this:

Code:
1 10
23 30
45 60
70 100

...

The desired output should be:
Code:
13 # (23-10)
15 # (45-30)
10 # (70-60)

...

I donīt know how to operate with different rows. I'm blocked.
Any suggestion?
Thank you in advance!
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies

2. UNIX for Dummies Questions & Answers

Sed working on lines of small length and not large length

Hi , I have a peculiar case, where my sed command is working on a file which contains lines of small length. sed "s/XYZ:1/XYZ:3/g" abc.txt > xyz.txt when abc.txt contains lines of small length(currently around 80 chars) , this sed command is working fine. when abc.txt contains lines of... (3 Replies)
Discussion started by: thanuman
3 Replies

3. Shell Programming and Scripting

Decrease the Line Gap in a files and Echo a strings

Hi Expert, I have a file contains-- GET:RSUB:ISI,432350114637601; RESP:0:MDN,9352608473:ISI,432350114637601:T11,1:T21,1:T22,1:B16,1:T62,1:BAIC,0:BAOC,0:BOIC,0:BIRO,0:BORO,0:BOIH,0:BOS4,0:CLIP,1:CLIR,0:CFB,1; GET:RSUB:ISI,432350114281653; ... (5 Replies)
Discussion started by: thepurple
5 Replies

4. Shell Programming and Scripting

How to use while loop in bash shell to read a file with 4 lines of gap

Hi , I am currently using the while loop in bash shell, as follows. while read line do echo $line done < file.txt However, i want to use the while loop on file.txt, which will read the file with 4 lines of gap. Ex- if file.txt is a file of 100 lines, then i want to use the loop such... (3 Replies)
Discussion started by: jitendriya.dash
3 Replies

5. Shell Programming and Scripting

Need to find the gap in the sequence of numbers

Hi Guys, I have a file with numbers in sequence. The sequence have been broken somewhere.. I need to find out at which number the sequence has been broken... For an example, consider this sequence, it needs to give me output as 4 (as 5 is missing) and 6(as 7 is missing) Thanks for... (3 Replies)
Discussion started by: mac4rfree
3 Replies

6. Shell Programming and Scripting

Flat file-make field length equal to header length

Hello Everyone, I am stuck with one issue while working on abstract flat file which i have to use as input and load data to table. Input Data- ------ ------------------------ ---- ----------------- WFI001 Xxxxxx Control Work Item A Number of Records ------ ------------------------... (5 Replies)
Discussion started by: sonali.s.more
5 Replies

7. Shell Programming and Scripting

Finding contiguous numbers in a list but with a gap number tolerance

Dear all, I have a imput file like this imput scaffold_0 10558458 10558459 1.8 scaffold_0 10558464 10558465 1.75 scaffold_0 10558467 10558468 1.8 scaffold_0 10558468 10558469 1.71428571428571 scaffold_0 10558469... (5 Replies)
Discussion started by: valente
5 Replies
Bio::Search::Tiling::MapTileUtils(3pm)			User Contributed Perl Documentation		    Bio::Search::Tiling::MapTileUtils(3pm)

NAME
Bio::Search::Tiling::MapTileUtils - utilities for manipulating closed intervals for an HSP tiling algorithm SYNOPSIS
Not used directly. DESCRIPTION
Not used directly. NOTE
An "interval" in this module is defined as an arrayref "[$a0, $a1]", where "$a0, $a1" are scalar numbers satisfying "$a0 <= $a1". AUTHOR
Mark A. Jensen - maj -at- fortinbras -dot- us APPENDIX
interval_tiling Title : interval_tiling() Usage : @tiling = interval_tiling( @array_of_intervals ) Function: Find minimal set of intervals covering the input set Returns : array of arrayrefs of the form ( [$interval => [ @indices_of_collapsed_input_intervals ]], ...) Args : arrayref of intervals decompose_interval Title : decompose_interval Usage : @decomposition = decompose_interval( @overlappers ) Function: Calculate the disjoint decomposition of a set of overlapping intervals, each annotated with a list of covering intervals Returns : array of arrayrefs of the form ( [[@interval] => [@indices_of_coverers]], ... ) Args : arrayref of intervals (arrayrefs like [$a0, $a1], with Note : Each returned interval is associated with a list of indices of the original intervals that cover that decomposition component (scalar size of this list could be called the 'coverage coefficient') Note : Coverage: each component of the decomp is completely contained in the input intervals that overlap it, by construction. Caveat : This routine expects the members of @overlappers to overlap, but doesn't check this. are_disjoint Title : are_disjoint Usage : are_disjoint( [$a0, $a1], [$b0, $b1] ) Function: Determine if two intervals are disjoint Returns : True if the intervals are disjoint, false if they overlap Args : array of two intervals min_covering_interval Title : min_covering_interval Usage : $interval = min_covering_interval( [$a0,$a1],[$b0,$b1] ) Function: Determine the minimal covering interval for two intervals Returns : an interval Args : two intervals get_intervals_from_hsps Title : get_intervals_from_hsps Usage : @intervals = get_intervals_from_hsps($type, @hsp_objects) Function: Return array of intervals of the form [ $start, $end ], from an array of hsp objects Returns : an array of intervals Args : scalar $type, array of HSPI objects; where $type is one of 'hit', 'subject', 'query' _allowable_filters Title : _allowable_filters Usage : _allowable_filters($Bio_Search_Hit_HitI, $type) Function: Return the HSP filters (strand, frame) allowed, based on the reported algorithm Returns : String encoding allowable filters: s = strand, f = frame Empty string if no filters allowed undef if algorithm unrecognized Args : A Bio::Search::Hit::HitI object, scalar $type, one of 'hit', 'subject', 'query'; default is 'query' _set_attributes Title : _set_attributes Usage : $tiling->_set_attributes() Function: Sets attributes for invocant that depend on algorithm name Returns : True on success Args : none Note : setting based on the configuration table %alg_lookup containing_hsps() Title : containing_hsps Usage : @hsps = containing_hsps($interval, @hsps_to_search) Function: Return a list of hsps whose coordinates completely contain the given $interval Returns : Array of HSP objects Args : $interval : [$int1, $int2], array of HSP objects covering_groups() Title : covering_groups Usage : Function: divide a list of **ordered,disjoint** intervals (as from a coverage map) into a set of disjoint covering groups Returns : array of arrayrefs, each arrayref a covering set of intervals Args : array of intervals matches_MT Title : matches_MT Usage : $hsp->matches($type, $action, $start, $end) Purpose : Get the total number of identical or conserved matches in the query or sbjct sequence for the given HSP. Optionally can report data within a defined interval along the seq. Returns : scalar int Args : Comments : Relies on seq_str('match') to get the string of alignment symbols between the query and sbjct lines which are used for determining the number of identical and conservative matches. Note : Modeled on Bio::Search::HSP::HSPI::matches get_SeqFeatures Title : get_SeqFeatures Usage : Function: Get the feature objects held by this feature holder. Features which are not top-level are subfeatures of one or more of the returned feature objects, which means that you must traverse the subfeature arrays of each top-level feature object in order to traverse all features associated with this sequence. Top-level features can be obtained by tag, specified in the argument. Use get_all_SeqFeatures() if you want the feature tree flattened into one single array. Example : Returns : an array of Bio::SeqFeatureI implementing objects Args : [optional] scalar string (feature tag) feature_count Title : feature_count Usage : $seq->feature_count() Function: Return the number of SeqFeatures attached to a sequence Returns : integer representing the number of SeqFeatures Args : None add_SeqFeature Title : add_SeqFeature Usage : $seq->add_SeqFeature($feat); $seq->add_SeqFeature(@feat); Function: Adds the given feature object (or each of an array of feature objects to the feature array of this sequence. The object passed is required to implement the Bio::SeqFeatureI interface. Returns : 1 on success Args : A Bio::SeqFeatureI implementing object, or an array of such objects. remove_SeqFeatures Title : remove_SeqFeatures Usage : $seq->remove_SeqFeatures(); Function: Flushes all attached SeqFeatureI objects. To remove individual feature objects, delete those from the returned array and re-add the rest. Example : Returns : The array of Bio::SeqFeatureI objects removed from this seq. Args : None perl v5.14.2 2012-03-02 Bio::Search::Tiling::MapTileUtils(3pm)
All times are GMT -4. The time now is 01:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy