awk to split one field and print the last two fields within the split part.
Hello;
I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is the input file like (>100k rows!!!):
I want the output file with the truncated field-3, which is like following:
What I did is by matching the "UniProt" string in the third field, split this field and only print the last two columns of the split fields, the original 3 fields ($1, $2, $4) need to be printed untouched.
Here is my code:
Have struggled for a while, but did not work out. Appreciate your expertise to help me out. Thanks a lot! Yifang
Hi all,
I have a field in the line, let's say argument $6, which is in the format 00.00
If i want to split the field to get rid of the "." in between of the amount, how can i do that i awk script?
I have it like this
split($6,a,".")
but it will get rid of the last 2 digits after the... (4 Replies)
I am trying to pull data out of a file to execute a series of repetitive commands. One of the fields is a {hex number}.{hex number} pattern. I need the first part of that structure to pass into the command. The file structure is like this:
A 2007/10/20 09:50:00 li text ef6da.1 name ... (6 Replies)
Hi,
I have a comma delimited text file where character fields (as opposed to numeric and date fields) are always enclosed with double quotes. Records are separated by the newline character. In a shell script I would like to split a particular field into two separate fields (enclosed with double... (4 Replies)
Hi there I have a text file with several fields separated by ";" as follow :
5466-43;5466;JOAN;LIGA;LIGA ESPANOLA;43;DEP LA CORUNA - OSASUNA;10/01/10 17:00
5466-44;5466;CARLES;LIGA;LIGA ESPANOLA;44;MALAGA - ATHL BILBAO;10/01/10 17:00
5466-45;5466;FAB;LIGA;LIGA ESPANOLA;45;REAL MADRID -... (4 Replies)
Hi all,
I have a .vcf file which contains 8 coulmns and the data under each column as shown below,
CHROM POS ID REF ALT QUAL FILTER INFO
1 3000012 . A G 126 ... (6 Replies)
I want to use awk to split fields and put them into a file
but I don't know the number of fields
for example, in the following line
Ports: 22/filtered/tcp//ssh///, 53/open/tcp//tcpwrapped///, 111/filtered/tcp//rpcbind///, 543/filtered/tcp//klogin///, 544/filtered/tcp//kshell///,... (3 Replies)
Hi experts,
I need to print the first field first then last two fields should come next and then i need to print rest of the fields.
Input :
a1,abc,jsd,fhf,fkk,b1,b2
a2,acb,dfg,ghj,b3,c4
a3,djf,wdjg,fkg,dff,ggk,d4,d5
Expected output:
a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
I am trying to split a tab-delimeted file using awk after the second _ in bold. The awk below is close but splits on the first _, and I am not sure how to use the second _. Thank you :).
file
chr1 92145889 92149424 NM_001195684_exon_0_10_chr1_92145900_r 0 -
chr1 92161218 ... (4 Replies)
In the tab-delimited input below I am trying to use awk to -10 from $2 and +10 to $3. Something like
awk -F'\t' -v OFS='\t' -v s=10 '{split($4,a,":"); print $1,$2-s,$3+s,a,$5,$6} | awk {split(a,b,"-"); print $1,$2-s,$3+s,b-s,b+s,$5,$6}' input
should do that. I also need to -10 from $4... (2 Replies)
In the awk I am splitting on the : into array a, then splitting on the - into element b. I can not seem to duplicate b if there is no - after it. Lines 1,2,4 are examples. If there is a - after the number in b then the value to the right of it is $3 in the ouput. Thank you :).
awk... (2 Replies)
Discussion started by: cmccabe
2 Replies
LEARN ABOUT DEBIAN
swiss::des
SWISS::DEs(3pm) User Contributed Perl Documentation SWISS::DEs(3pm)Name
SWISS::DEs.pm
Description
SWISS::DEs represents the DE lines of a UniProt Knowledgebase (Swiss-Prot + TrEMBL) entry as specified in the user manual
http://www.expasy.org/sprot/userman.html.
The DEs object basically holds lists of DE objects, each of them representing a protein name element. The "elements", "hasFragment",
"Includes" and "Contains" attributes/methods work as follows :
DE RecName: Full=CAD protein;
DE Short=CAD;
DE AltName: Full=Protein rudimentary;
DE Includes:
DE RecName: Full=Glutamine-dependent carbamoyl-phosphate synthase;
DE EC=6.3.5.5;
DE Includes:
DE RecName: Full=Aspartate carbamoyltransferase;
DE EC=2.1.3.2;
DE Flags: Fragment;
-= Entry::DEs =-
elements (for each DE object, see SWISS::DE.pm documentation) :
toText: "CAD protein", "CAD", "Protein rudimentary"
category: "RecName", "RecName", "AltName"
type: "Full", "Short" "Full"
hasFragment : "Fragment"
Includes : ListBase of DEs (child1, child2)
Contains : empty ListBase
-= child1 =-
elements (for each DE object) :
toText: "Glutamine-dependent carbamoyl-
phosphate synthase", "6.3.5.5"
category: "RecName", "RecName",
type: "Full", "EC"
hasFragment : undef
-= child2 =-
elements (for each DE object) :
toText: "Aspartate carbamoyltransferase", "2.1.3.2"
category: "RecName", "RecName",
type: "Full", "EC"
hasFragment : undef
Note: the old unstructured DE format can still be used, and will be parsed the same way into DE objects (but without setting their
attributes 'category' and 'type'.
DE CAD protein (Protein rudimentary) [Includes: Glutamine-dependent
DE carbamoyl-phosphate synthase (EC 6.3.5.5); Aspartate
DE carbamoyltransferase (EC 2.1.3.2)] (Fragment).
Inherits from
SWISS::ListBase.pm
Attributes
"text"
The (raw) text of the DE line (without the 'DE ' line type prefixes)
"list"
Array reference to the SWISS::DE objects containing the different names for the entry. The first element of the list is the recommended
name. Note: use "elements" method (inherited from ListBase) to get (and loop through) the array of DE objetcs.
"Includes"
"Contains"
Each of these is a SWISS::ListBase object whose list contains a SWISS::DEs object for each 'child' of the protein (i.e. peptide or
functional domain). See the UniProtKB user manual for an explanation. It is possible to have both Includes and Contains in a single
entry:
DE RecName: Full=Arginine biosynthesis bifunctional protein argJ;
DE Includes:
DE RecName: Full=Glutamate N-acetyltransferase;
DE EC=2.3.1.35;
DE AltName: Full=Ornithine acetyltransferase;
DE Short=OATase;
DE AltName: Full=Ornithine transacetylase;
DE Includes:
DE RecName: Full=Amino-acid acetyltransferase;
DE EC=2.3.1.1;
DE AltName: Full=N-acetylglutamate synthase;
DE Short=AGS;
DE RecName: Full=Arginine biosynthesis bifunctional protein argJ alpha chain;
DE Contains:
DE RecName: Full=Arginine biosynthesis bifunctional protein argJ beta chain;
"hasFragment"
Contains 'Fragment' or 'Fragments' (evaluates to true) if the DE lines contain the 'Fragment(s)' indication (in 'Flags:' line with the
new DE line format), otherwise evaluates to false. Compare to the more robust Entry::isFragment which also checks the FT lines for a
NON_CONS or NON_TER.
"isPrecursor"
Returns 1 if the flag 'Precursor' is present (undef if not). Note: only with new DE line format.
Methods
Standard methods
new
fromText
toText
Evidence Tags
With the new DE line format, each DE element can have distinct evidence tags, which are stored in the DE object themself (see SWISS::DE.pm
documentation). The evidence tags for the 'Flags' line are stored in the parent DEs object itself. With the old DE line format, since the
DE line did not have a fixed syntax in TrEMBL, it is impossible to reliably assign evidence tags separately to the different elements of
the DE lines. Therefore, the DE line can only be evidence tagged as a whole, and the following methods have their prototype defined in
SWISS::BaseClass instead of the direct parent of SWISS::DEs, SWISS::ListBase :
addEvidenceTag
deleteEvidenceTags
getEvidenceTags
getEvidenceTagsString
hasEvidenceTag
setEvidenceTags
example :
$evidenceTag = $entry->Stars->EV->addEvidence('P', 'DEfix', '-', 'v1.3');
# add global DE evtag if old DE line format, 'Flags' evtag if new format
$entry -> DEs -> addEvidenceTag($evidenceTag);
perl v5.10.1 2008-07-17 SWISS::DEs(3pm)