Import peptide features from a featureXml file, as generated for example
    by the OpenMS node featureFinderCentroided, or a features.tsv file by the
    Dinosaur command line tool.

    :param fiContainer: imported features are added to this instance of
        :class:`FeatureContainer <maspy.core.FeatureContainer>`.
    :param filelocation: Actual file path
    :param specfile: Keyword (filename) to represent file in the
        :class:`FeatureContainer`. Each filename can only occure once, therefore
        importing the same filename again is prevented.

def importPeptideFeatures(fiContainer, filelocation, specfile):
    """ Import peptide features from a featureXml file, as generated for example
    by the OpenMS node featureFinderCentroided, or a features.tsv file by the
    Dinosaur command line tool.

    :param fiContainer: imported features are added to this instance of
        :class:`FeatureContainer <maspy.core.FeatureContainer>`.
    :param filelocation: Actual file path
    :param specfile: Keyword (filename) to represent file in the
        :class:`FeatureContainer`. Each filename can only occure once, therefore
        importing the same filename again is prevented.
    """
    if not os.path.isfile(filelocation):
        warnings.warn('The specified file does not exist %s' %(filelocation, ))
        return None
    elif (not filelocation.lower().endswith('.featurexml') and
          not filelocation.lower().endswith('.features.tsv')
          ):
        #TODO: this is depricated as importPeptideFeatues
        #is not longer be used solely for featurexml
        print('Wrong file extension, %s' %(filelocation, ))
    elif specfile in fiContainer.info:
        print('%s is already present in the SiContainer, import interrupted.'
              %(specfile, )
              )
        return None

    #Prepare the file container for the import
    fiContainer.addSpecfile(specfile, os.path.dirname(filelocation))

    #import featurexml file
    if filelocation.lower().endswith('.featurexml'):
        featureDict = _importFeatureXml(filelocation)
        for featureId, featureEntryDict in viewitems(featureDict):
            rtArea = set()
            for convexHullEntry in featureEntryDict['convexHullDict']['0']:
                rtArea.update([convexHullEntry[0]])

            fi = maspy.core.Fi(featureId, specfile)
            fi.rt = featureEntryDict['rt']
            fi.rtArea = max(rtArea) - min(rtArea)
            fi.rtLow = min(rtArea)
            fi.rtHigh = max(rtArea)
            fi.charge = featureEntryDict['charge']
            fi.mz = featureEntryDict['mz']
            fi.mh = maspy.peptidemethods.calcMhFromMz(featureEntryDict['mz'],
                                                      featureEntryDict['charge'])
            fi.intensity = featureEntryDict['intensity']
            fi.quality = featureEntryDict['overallquality']
            fi.isMatched = False
            fi.isAnnotated = False
            fi.isValid = True

            fiContainer.container[specfile][featureId] = fi

    #import dinosaur tsv file
    elif filelocation.lower().endswith('.features.tsv'):
        featureDict = _importDinosaurTsv(filelocation)
        for featureId, featureEntryDict in viewitems(featureDict):
            fi = maspy.core.Fi(featureId, specfile)
            fi.rt = featureEntryDict['rtApex']
            fi.rtArea = featureEntryDict['rtEnd'] - featureEntryDict['rtStart']
            fi.rtFwhm = featureEntryDict['fwhm']
            fi.rtLow = featureEntryDict['rtStart']
            fi.rtHigh = featureEntryDict['rtEnd']
            fi.charge = featureEntryDict['charge']
            fi.numScans  = featureEntryDict['nScans']
            fi.mz = featureEntryDict['mz']
            fi.mh = maspy.peptidemethods.calcMhFromMz(featureEntryDict['mz'],
                                                      featureEntryDict['charge'])
            fi.intensity = featureEntryDict['intensitySum']
            fi.intensityApex = featureEntryDict['intensityApex']
            #Note: not used keys:
            #mostAbundantMz nIsotopes nScans averagineCorr mass massCalib

            fi.isMatched = False
            fi.isAnnotated = False
            fi.isValid = True

            fiContainer.container[specfile][featureId] = fi