Question: How to efetch specific attributes from BioSamples?
0
gravatar for Arindam Ghosh
15 months ago by
Arindam Ghosh250
India
Arindam Ghosh250 wrote:

I need to extract the sample source for a list of sample ids. I tried using efetch as follows:

efetch -db biosample -id SAMN04383980 -format xml | xtract -pattern BioSampleSet -division BioSample -group Attributes -element Attribute

The problem here is that there are often more than two attributes:

  <Attributes>
         <Attribute attribute_name="source_name" harmonized_name="source_name" display_name="source name">H7 hESCs</Attribute>
         <Attribute attribute_name="cell line" harmonized_name="cell_line" display_name="cell line">H7 derived</Attribute> 
  </Attributes>

How do I extract the one with attribute_name="source_name" only?

eutils xml ncbi • 832 views
ADD COMMENTlink modified 15 months ago by Pierre Lindenbaum128k • written 15 months ago by Arindam Ghosh250
4
gravatar for Pierre Lindenbaum
15 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum128k wrote:

using a xpath expression:

 wget -q -O - "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=biosample&id=SAMN04383980" |\
   xmllint --xpath "/BioSampleSet/BioSample/Attributes/Attribute[@attribute_name='source_name']/text()"  -

H7 hESCs
ADD COMMENTlink written 15 months ago by Pierre Lindenbaum128k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1509 users visited in the last hour