Sponsored Content
Top Forums Shell Programming and Scripting Perl to change value based on set of rules Post 303003256 by cmccabe on Monday 11th of September 2017 09:51:35 AM
Old 09-11-2017
I think the below will capture lines 2-6, but not line 1 (looks like 018328) is being captured by the regex. Is the syntax correct or is there a better way? Thank you Smilie.

perl
Code:
    if ($FuncrefGene !~ /exonic/i && $GeneDetailrefGene=~/\D(\d+)/) {   # capture the digits into $1
              if ($1 > 11) {   # 
                      $1 ||= 0;  # Give it a value of zero if no numeric value was found.
                        $classification = 'Likely Benign';  # Reclassify intronic variants (with distance only) based on distance to exon > 10 to Likely Benign
         }
     }
    else {
              if ($FuncrefGene !~ /exonic/i && $GeneDetailrefGene=~/(\D\d+)/) {   # capture the digits after any non-digit into $1
                 if ($1 > 11) {   # 
                      $1 ||= 0;  # Give it a value of zero if no numeric value was found.
                        $classification = 'Likely Benign';  # Reclassify intronic variants (with distance only) based on distance to exon > 10 to Likely Benign
         }
     }
    else {
              if ($FuncrefGene !~ /exonic/i) {
                 my ($transcript) = ($GeneDetailrefGene) =~ /(?:\.\d+[+*-])/;   # Get a numeric value if exists using (.) and (+/-) and capture digits into $transcript.
                           $transcript ||= 0;  # Give it a value of zero if no numeric value was found.
                             $classification = 'Likely Benign' if $transcript > 11; # Reclassify intronic variants (following c. nomenclature) to Likely Benign if distance greater than 10
         }
     }

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to change "set" values in perl, windows...

i am using perl in win2000advanced server... --------------------------- perl -version: --------------------------- This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 638 provided by... (1 Reply)
Discussion started by: sekar sundaram
1 Replies

2. Shell Programming and Scripting

Need to change a set of lines between two given Pattrens

Hi All I have a Small Requiement I wanted to replace all the Follwing lines as follows Input:: file1 EVALUATE WS-TEMP-ATTR(15:1) WHEN 'D' MOVE DFHDARK TO WS-ATTR-COLOR WHEN OTHER MOVE DFHDFT ... (9 Replies)
Discussion started by: pbsrinivas
9 Replies

3. UNIX for Dummies Questions & Answers

Server wide password enforcement rules? 90 day force change.

Using Solaris 9 and 10. What we want to do is set up global rules for our password files to restrict all users, not only new ones set up with the rules but also the ones that have been sitting on the system for years. Is there a global way to force all users to change their password every 90... (1 Reply)
Discussion started by: LordJezo
1 Replies

4. Solaris

help me to change the character set

dears i am using solaris 10 i am facing a problem when i make setup for solaris i choose the country egypt and i select the language north america but i forget to do that the i found the date Jun written in arabic i want to change character set to written in english -rw-r--r-- 1 root ... (4 Replies)
Discussion started by: hosney00ux
4 Replies

5. Shell Programming and Scripting

Matching string on two files based on match rules.

Hi, How to check if a string on file2 exactly matches with a part or complete string on file1, and return a match indicator based on some match rules. 1) only records on file1 with category A should be matched. for other category, the output match indicator should default to 'N' 2) on file2... (13 Replies)
Discussion started by: effay
13 Replies

6. Shell Programming and Scripting

Help with allocated text content based on specific rules...

Input file format: /tag="ABL" /note="abl homolog 2 /tag="ABLIM1" /note="actin binding LIM 1 /tag="ABP1" /note="amiloride binding protein 1 (amine oxidase (copper- containing)) /tag="ABR" /note="active BCR-related /tag="AC003042.1" /note="SDR family member 11 precursor . . . (4 Replies)
Discussion started by: perl_beginner
4 Replies

7. Shell Programming and Scripting

Generating a passwordlist based on rules

Hy there! Some time ago I encrypted the harddrive of my notebook. Now, I can't remember it correctly. I want to create a list with all possible combinations of the words I used (I still remember all the words....). The password was created like this: ... (1 Reply)
Discussion started by: santiago10k
1 Replies

8. Shell Programming and Scripting

Delete lines based on Rules

Hi My requirement is very simple . I juts need to delte some lines from a file. here comes theactual scenario I have some data in file like say srinivasa prabhu kumar antony srinivas king prabhu antony srinivas prabhu king yar venkata venkata kingson srinivas... (6 Replies)
Discussion started by: ptappeta
6 Replies

9. Shell Programming and Scripting

Filtering duplicates based on lookup table and rules

please help solving the following. I have access to redhat linux cluster having 32gigs of ram. I have duplicate ids for variable names, in the file 1,2 are duplicates;3,4 and 5 are duplicates;6 and 7 are duplicates. My objective is to use only the first occurrence of these duplicates. Lookup... (4 Replies)
Discussion started by: ritakadm
4 Replies

10. Shell Programming and Scripting

Perl to update field based on a specific set of rules

In the perl below, which does execute, I am having trouble with the else in Rule 3. The digit in f{8} is extracted and used to update f accordinly along with the value in f. There can be either - * or + before the number that is extracted but the same logic applies, that is if the value is greater... (5 Replies)
Discussion started by: cmccabe
5 Replies
Bio::Map::GenePosition(3pm)				User Contributed Perl Documentation			       Bio::Map::GenePosition(3pm)

NAME
Bio::Map::GenePosition - A typed position, suitable for modelling the various regions of a gene. SYNOPSIS
use Bio::Map::GenePosition; use Bio::Map::GeneMap; # say that the first transcript of a particular gene on a particular map # (species) is 1000bp long my $map = Bio::Map:GeneMap->get(-universal_name => 'BRCA2', -species => 'human'); my $gene = $map->gene; Bio::Map::GenePosition->new(-map => $map, -element => $gene, -start => 0, -length => 1000, -type => 'transcript'); # say that the coding region of the gene starts 30bp into the first # transcript Bio::Map::GenePosition->new(-map => $map, -element => $gene, -start => 30, -length => 600, -type => 'coding'); # A GenePosition isa PositionWithSequence, so can have sequence associated # with it my $exon = Bio::Map::GenePosition->new(-map => $map, -element => $gene, -start => 0, -type => 'exon', -seq => 'ATGGGGTGGG'); my $length = $exon->length; # $length is 10 DESCRIPTION
Define where various sub-regions (transcripts, exons, introns etc.) of a gene are. Do this so that you can then go onto to model other mappable elements as having positions 20bp upstream of transcript 2, or 10bp into intron 3 etc., all without having to know the absolute position of anything. See Bio::Map::GeneRelative and t/Map/Map.t for more example usage. 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 the Bioperl mailing list. 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 of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Sendu Bala Email bix@sendu.me.uk APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : my $obj = Bio::Map::GenePosition->new(); Function: Builds a new Bio::Map::GenePosition object Returns : Bio::Map::GenePosition Args : -map => Bio::Map::GeneMap object -element => Bio::Map::Gene object -relative => Bio::Map::GeneRelative object -type => 'transcript|coding|exon|intron', REQUIRED -seq => string, length of this string will set the length of this position's range * If this position has no range, or if a single value can describe the range * -value => scalar : something that describes the single point position or range of this Position, most likely an int * Or if this position has a range, at least two of * -start => int : value of the start co-ordinate -end => int : value of the end co-ordinate -length => int : length of the range map Title : map Usage : my $map = $position->map(); $position->map($map); Function: Get/set the map the position is in. Returns : L<Bio::Map::MapI> Args : none to get new L<Bio::Map::MapI> to set element Title : element Usage : my $element = $position->element(); $position->element($element); Function: Get/set the element the position is for. Returns : L<Bio::Map::MappableI> Args : none to get new L<Bio::Map::MappableI> to set type Title : type Usage : my $type = $position->type(); $position->type($type); Function: Get/set the type of this position. Returns : string Args : none to get, OR string transcript|coding|exon|intron to set relative Title : relative Usage : my $relative = $position->relative(); $position->relative($relative); Function: Get/set the thing this Position's coordinates (numerical(), start(), end()) are relative to, as described by a RelativeI object. Returns : Bio::Map::GeneRelative. The default GeneRelative returned has a meaning that depends on the type() of GenePosition this is: 'transcript' : "relative to the start of the gene on the Position's map" 'coding|exon|intron' : "relative to the start of the default transcript of the gene on the Position's map" Args : none to get, OR Bio::Map::GeneRelative to set seq Title : seq Usage : my $string = $position->seq(); Function: Get/set the sequence as a string of letters. If no sequence is manually set by you, the position's map will be asked for the sequence, and if available, that will be returned. Returns : scalar Args : Optionally on set the new value (a string). An optional second argument presets the alphabet (otherwise it will be guessed). perl v5.14.2 2012-03-02 Bio::Map::GenePosition(3pm)
All times are GMT -4. The time now is 05:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy